diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json index 7b2ad37..b57ebab 100644 --- a/buddybook/.vite/manifest.json +++ b/buddybook/.vite/manifest.json @@ -1,6 +1,6 @@ { - "_events-DyQEop7s.js": { - "file": "assets/events-DyQEop7s.js", + "_events-DTVtRakk.js": { + "file": "assets/events-DTVtRakk.js", "name": "events", "imports": [ "index.html" @@ -10,55 +10,64 @@ "file": "assets/hooks.module-D0gf0yJl.js", "name": "hooks.module" }, - "_index-BE2r4h4L.js": { - "file": "assets/index-BE2r4h4L.js", + "_index-CTvXdnRL.js": { + "file": "assets/index-CTvXdnRL.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html", - "_inherits_browser-B8fZ3Rhe.js", + "_inherits_browser-c-WsrrNw.js", "_hooks.module-D0gf0yJl.js", - "_events-DyQEop7s.js" + "_events-DTVtRakk.js" ] }, - "_index-DskNhwDJ.js": { - "file": "assets/index-DskNhwDJ.js", + "_index-Do02Tqa-.js": { + "file": "assets/index-Do02Tqa-.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html" + ], + "dynamicImports": [ + "node_modules/@walletconnect/modal-ui/dist/index.js" + ] + }, + "_index-Drc-C73D.js": { + "file": "assets/index-Drc-C73D.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html", - "_events-DyQEop7s.js" + "_index-s1Uh1I2b.js", + "_events-DTVtRakk.js" ] }, - "_index-Dt2-TQyK.js": { - "file": "assets/index-Dt2-TQyK.js", + "_index-s1Uh1I2b.js": { + "file": "assets/index-s1Uh1I2b.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html" - ], - "dynamicImports": [ - "node_modules/@walletconnect/modal-ui/dist/index.js" ] }, - "_inherits_browser-B8fZ3Rhe.js": { - "file": "assets/inherits_browser-B8fZ3Rhe.js", + "_inherits_browser-c-WsrrNw.js": { + "file": "assets/inherits_browser-c-WsrrNw.js", "name": "inherits_browser", "imports": [ "index.html" ] }, "index.html": { - "file": "assets/index-BpI4vT-j.js", + "file": "assets/index-tpwTCyHS.js", "name": "index", "src": "index.html", "isEntry": true, "dynamicImports": [ "node_modules/viem/_esm/utils/ccip.js", "node_modules/@coinbase/wallet-sdk/dist/index.js", - "_index-BE2r4h4L.js", - "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", - "_index-DskNhwDJ.js", + "_index-CTvXdnRL.js", + "_index-s1Uh1I2b.js", + "_index-Drc-C73D.js", "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" ], "css": [ @@ -66,7 +75,7 @@ ] }, "node_modules/@coinbase/wallet-sdk/dist/index.js": { - "file": "assets/index-BhnqxX7Q.js", + "file": "assets/index-yzjEDxfO.js", "name": "index", "src": "node_modules/@coinbase/wallet-sdk/dist/index.js", "isDynamicEntry": true, @@ -75,41 +84,32 @@ "_hooks.module-D0gf0yJl.js" ] }, - "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js": { - "file": "assets/index-Ctx71FWU.js", - "name": "index", - "src": "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", - "isDynamicEntry": true, - "imports": [ - "index.html" - ] - }, "node_modules/@walletconnect/ethereum-provider/dist/index.es.js": { - "file": "assets/index.es-BwINMB1n.js", + "file": "assets/index.es-D5UVwycq.js", "name": "index.es", "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", "isDynamicEntry": true, "imports": [ "index.html", - "_events-DyQEop7s.js", - "_inherits_browser-B8fZ3Rhe.js" + "_events-DTVtRakk.js", + "_inherits_browser-c-WsrrNw.js" ], "dynamicImports": [ - "_index-Dt2-TQyK.js" + "_index-Do02Tqa-.js" ] }, "node_modules/@walletconnect/modal-ui/dist/index.js": { - "file": "assets/index-CHNnLDtA.js", + "file": "assets/index-DWNoNvLC.js", "name": "index", "src": "node_modules/@walletconnect/modal-ui/dist/index.js", "isDynamicEntry": true, "imports": [ - "_index-Dt2-TQyK.js", + "_index-Do02Tqa-.js", "index.html" ] }, "node_modules/viem/_esm/utils/ccip.js": { - "file": "assets/ccip-BfnZBgwN.js", + "file": "assets/ccip-zypZ5n5w.js", "name": "ccip", "src": "node_modules/viem/_esm/utils/ccip.js", "isDynamicEntry": true, diff --git a/buddybook/assets/ccip-BfnZBgwN.js b/buddybook/assets/ccip-BfnZBgwN.js deleted file mode 100644 index 767ade6..0000000 --- a/buddybook/assets/ccip-BfnZBgwN.js +++ /dev/null @@ -1 +0,0 @@ -import{i as h,I as m,B as p,w,x as g,y as E,z as O,c as x,e as b,H as y,A as M}from"./index-BpI4vT-j.js";function R(r,a){if(!h(r,{strict:!1}))throw new m({address:r});if(!h(a,{strict:!1}))throw new m({address:a});return r.toLowerCase()===a.toLowerCase()}class S extends p{constructor({callbackSelector:a,cause:t,data:n,extraData:i,sender:d,urls:s}){var c;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(c=t.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(f=>` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={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 G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={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 G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;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;r{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' 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 s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",ut="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return ut}return e}function pt(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function ft(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&pt(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.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 b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.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:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!gt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function gt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),mt=se(),wt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return wt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function bt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=bt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return mt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||vt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function yt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function vt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function kt(){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:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Et(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Ct(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function It(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function St(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Mt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return It(e,s)}async function xt(t,e){return JSON.parse(await St(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class At{constructor(){this.storage=new v("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($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Et();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Ct(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.1",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function _t(){return globalThis.coinbaseWalletExtension}function Lt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=_t();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Lt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Pt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Rt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new At,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},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(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Mt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await xt(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Nt=rt(at),{keccak_256:Tt}=Nt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Dt(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function qt(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Ht(t){return t.lastIndexOf("]")===t.length-1}function Kt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);qt(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function Vt(t,e){return w.keccak(Fe(t,e))}var zt={rawEncode:Kt,solidityPack:Fe,soliditySHA3:Vt};const y=Ve,U=zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",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);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var q={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return Zt(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function Zt(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const Ft="walletUsername",ee="Addresses",$t="AppVersion";function m(t){return t.errorMessage!==void 0}class Gt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Yt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(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(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Jt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,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,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,Qt=6e4;class Xt{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Ft,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated($t,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Gt(e.secret),this.listener=n;const i=new Jt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Yt(s,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}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(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);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>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:Qt}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class es{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ot(ct(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ts(){try{return window.frameElement!==null}catch{return!1}}function ss(){try{return ts()&&window.top?window.top.location:window.location}catch{return window.location}}function ns(){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)}function Ge(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const is='@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}';function Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(is)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(ds,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,rs),h("div",{class:"-cbwsdk-snackbar"},t.children)),ds=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);lt(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:as,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:os,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class ls{constructor(){this.attached=!1,this.snackbar=new cs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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}]}:s={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(s)}}const hs=".-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}";class us{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(ps,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const ps=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,hs),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},fs="https://keys.coinbase.com/connect",be="https://www.walletlink.org",gs="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new us}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(gs);s.searchParams.append("redirect_url",ss().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.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()}}}class S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=ns(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new es,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new Xt({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new ls;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)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 s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return A(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:yt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function ms(){return tt.getItem(et)}function ws(t){tt.setItem(et,t)}async function bs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;vs(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ys(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Rt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function vs(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const ks=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. - -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Es=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,s=await fetch(e,{method:"HEAD"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=s.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(ks)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:st,getCrossOriginOpenerPolicy:Cs}=Es(),Ee=420,Ce=540;function Is(t){const e=(window.innerWidth-Ee)/2+window.screenX,s=(window.innerHeight-Ce)/2+window.screenY;Ms(t);const n=window.open(t,"Smart Wallet",`width=${Ee}, height=${Ce}, left=${e}, top=${s}`);if(n==null||n.focus(),!n)throw l.rpc.internal("Pop up window failed to open");return n}function Ss(t){t&&!t.closed&&t.close()}function Ms(t){const e={sdkName:Oe,sdkVersion:T,origin:window.location.origin,coop:Cs()};for(const[s,n]of Object.entries(e))t.searchParams.append(s,n.toString())}class xs{constructor({url:e=fs,metadata:s,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const r=this.onMessage(({requestId:a})=>a===i.id);return this.postMessage(i),await r},this.onMessage=async i=>new Promise((r,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const d=c.data;i(d)&&(r(d),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{Ss(this.popup),this.popup=null,this.listeners.forEach(({reject:i},r)=>{i(l.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=Is(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:T,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw l.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=s,this.preference=n}}function As(t){const e=ft(_s(t),{shouldIncludeStack:!0}),s=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return s.searchParams.set("version",T),s.searchParams.set("code",e.code.toString()),s.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:s.href})}function _s(t){var e;if(typeof t=="string")return{message:t,code:u.rpc.internal};if(m(t)){const s=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:s.match(/(denied|rejected)/i)?u.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:s,code:n,data:{method:t.method}})}return t}class Ls extends dt{}var Ps=function(t,e){var s={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i(i||(i=Rs(n)),i)}}export{Os as CoinbaseWalletSDK,js as createCoinbaseWalletSDK,Os as default}; diff --git a/buddybook/assets/index-BE2r4h4L.js b/buddybook/assets/index-CTvXdnRL.js similarity index 99% rename from buddybook/assets/index-BE2r4h4L.js rename to buddybook/assets/index-CTvXdnRL.js index 17e4564..085517e 100644 --- a/buddybook/assets/index-BE2r4h4L.js +++ b/buddybook/assets/index-CTvXdnRL.js @@ -1,4 +1,4 @@ -import{E as xo,f as Q,j as Zr,p as ii,q as su,r as ou,h as au}from"./index-BpI4vT-j.js";import{r as Ws,i as vt}from"./inherits_browser-B8fZ3Rhe.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-DyQEop7s.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.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,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&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")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","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"],C=[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],x=[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,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==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)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.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 u;this.length>o.length?u=o:u=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 u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.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 u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._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 p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?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 u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,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 u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+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 u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="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,u)},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 u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?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 u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},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 u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},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 X(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 L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,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()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),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(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.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}};Nt.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 li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.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 ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.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 Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.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 ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[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],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.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 lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.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 Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.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};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[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],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.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 Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.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};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.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 Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(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))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[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 Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}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,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r +import{E as xo,j as Q,g as Zr,q as ii,r as su,u as ou,a as au}from"./index-tpwTCyHS.js";import{r as Ws,i as vt}from"./inherits_browser-c-WsrrNw.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-DTVtRakk.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.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,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&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")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","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"],C=[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],x=[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,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==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)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.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 u;this.length>o.length?u=o:u=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 u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.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 u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._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 p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?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 u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,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 u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+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 u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="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,u)},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 u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?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 u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},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 u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},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 X(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 L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,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()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),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(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.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}};Nt.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 li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.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 ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.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 Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.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 ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[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],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.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 lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.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 Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.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};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[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],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.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 Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.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};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.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 Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(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))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[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 Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}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,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r `:"",a=t.width,l=t.height,d=r.length,h=a/(d+2*t.padding),m=l/(d+2*t.padding),R=typeof t.join<"u"?!!t.join:!1,y=typeof t.swap<"u"?!!t.swap:!1,C=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,x=typeof t.predefined<"u"?!!t.predefined:!1,B=x?i+''+s:"",O=i+''+s,M="",T="",N=0;N'+s:M+=i+''+s}}R&&(M=i+'');let X="";if(this.options.image!==void 0&&this.options.image.svg){const S=a*this.options.image.width/100,o=l*this.options.image.height/100,u=a/2-S/2,f=l/2-o/2;X+=``,X+=this.options.image.svg+s,X+=""}var ne="";switch(e.container){case"svg":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"svg-viewbox":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"g":ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;default:ne+=(B+O+M+X).replace(/^\s+/,"");break}return ne};var Zh=Tc,Kh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ki,"__esModule",{value:!0});ki.QRCode=void 0;const Qh=tt,qo=Ei,Yh=Kh(Zh),Xh=e=>{const[t,r]=(0,qo.useState)("");return(0,qo.useEffect)(()=>{var n,i;const s=new Yh.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(n=e.width)!==null&&n!==void 0?n:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),a=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${a}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Qh.h)("img",{src:t,alt:"QR Code"}):null};ki.QRCode=Xh;var Ci={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.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 ed=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.Spinner=void 0;const Wn=tt,td=ed(Gs),rd=e=>{var t;const r=(t=e.size)!==null&&t!==void 0?t:64,n=e.color||"#000";return(0,Wn.h)("div",{class:"-cbwsdk-spinner"},(0,Wn.h)("style",null,td.default),(0,Wn.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Wn.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};Ci.Spinner=rd;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.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 Nc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.CoinbaseWalletSteps=Vr.ConnectContent=void 0;const hr=Nc(Cn),oe=tt,nd=q,id=Qr,sd=Si,od=Ri,ad=Mi,cd=ki,ld=Ci,ud=Nc(Zs),cs={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Lc},hd=e=>e==="light"?"#FFFFFF":"#0A0B0D";function dd(e){const{theme:t}=e,r=(0,nd.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=cs.steps;return(0,oe.h)("div",{"data-testid":"connect-content",className:(0,hr.default)("-cbwsdk-connect-content",t)},(0,oe.h)("style",null,ud.default),(0,oe.h)("div",{className:"-cbwsdk-connect-content-header"},(0,oe.h)("h2",{className:(0,hr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,oe.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,oe.h)(sd.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,oe.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,oe.h)(fd,{title:cs.title,description:cs.description,theme:t})),(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,oe.h)(cd.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,oe.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:id.LIB_VERSION}),(0,oe.h)("input",{type:"hidden",value:r})),(0,oe.h)(n,{theme:t}),!e.isConnected&&(0,oe.h)("div",{"data-testid":"connecting-spinner",className:(0,hr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,oe.h)(ld.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,oe.h)("p",null,"Connecting...")))))}Vr.ConnectContent=dd;function fd({title:e,description:t,theme:r}){return(0,oe.h)("div",{className:(0,hr.default)("-cbwsdk-connect-item",r)},(0,oe.h)("div",null,(0,oe.h)(od.CoinbaseWalletRound,null)),(0,oe.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,oe.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,oe.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function Lc({theme:e}){return(0,oe.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,oe.h)("span",null,"Tap ",(0,oe.h)("strong",null,"Scan")," "),(0,oe.h)("span",{className:(0,hr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,oe.h)(ad.QRCodeIcon,{fill:hd(e)})))))}Vr.CoinbaseWalletSteps=Lc;var Ii={},xi={};Object.defineProperty(xi,"__esModule",{value:!0});xi.ArrowLeftIcon=void 0;const Jo=tt;function pd(e){return(0,Jo.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,Jo.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"}))}xi.ArrowLeftIcon=pd;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.LaptopIcon=void 0;const ls=tt;function gd(e){return(0,ls.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,ls.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,ls.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"}))}Ai.LaptopIcon=gd;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SafeIcon=void 0;const Go=tt;function md(e){return(0,Go.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Go.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"}))}Ti.SafeIcon=md;var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.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 Oc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.TryExtensionContent=void 0;const rr=Oc(Cn),We=tt,us=Ei,vd=xi,bd=Ai,wd=Ti,_d=Oc(Ks);function yd({theme:e}){const[t,r]=(0,us.useState)(!1),n=(0,us.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,us.useCallback)(()=>{t?window.location.reload():(n(),r(!0))},[n,t]);return(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension",e)},(0,We.h)("style",null,_d.default),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("h3",{class:(0,rr.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,We.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,We.h)("button",{class:(0,rr.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,We.h)("div",null,!t&&(0,We.h)(vd.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(bd.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(wd.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Ii.TryExtensionContent=yd;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.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 Pc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yi,"__esModule",{value:!0});yi.ConnectDialog=void 0;const hs=Pc(Cn),nr=tt,ds=Ei,Ed=Vr,Sd=Ii,Rd=Pc(Qs),Md=e=>{const{isOpen:t,darkMode:r}=e,[n,i]=(0,ds.useState)(!t),[s,a]=(0,ds.useState)(!t);(0,ds.useEffect)(()=>{const d=[window.setTimeout(()=>{a(!t)},10)];return t?i(!1):d.push(window.setTimeout(()=>{i(!0)},360)),()=>{d.forEach(window.clearTimeout)}},[t]);const l=r?"dark":"light";return(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,nr.h)("style",null,Rd.default),(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-backdrop",l,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,nr.h)("div",{class:"-cbwsdk-connect-dialog"},(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,nr.h)(Ed.ConnectContent,{theme:l,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,nr.h)(Sd.TryExtensionContent,{theme:l}))))};yi.ConnectDialog=Md;Object.defineProperty(_i,"__esModule",{value:!0});_i.LinkFlow=void 0;const fs=tt,kd=yi;class Cd{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,fs.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,fs.render)((0,fs.h)(kd.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)}}_i.LinkFlow=Cd;var Ys={},Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(e){var t=Q&&Q.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const r=t(Cn),n=tt,i=Ei,s=t(Xs),a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",l="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{constructor(y){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=y.darkMode}attach(y){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",y.appendChild(this.root),this.render()}presentItem(y){const C=this.nextItemKey++;return this.items.set(C,y),this.render(),()=>{this.items.delete(C),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([y,C])=>(0,n.h)(e.SnackbarInstance,Object.assign({},C,{key:y}))))),this.root)}}e.Snackbar=d;const h=R=>(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"},R.children));e.SnackbarContainer=h;const m=({autoExpand:R,message:y,menuItems:C})=>{const[x,B]=(0,i.useState)(!0),[O,M]=(0,i.useState)(R??!1);(0,i.useEffect)(()=>{const N=[window.setTimeout(()=>{B(!1)},1),window.setTimeout(()=>{M(!0)},1e4)];return()=>{N.forEach(window.clearTimeout)}});const T=()=>{M(!O)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",x&&"-cbwsdk-snackbar-instance-hidden",O&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:T},(0,n.h)("img",{src:a,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},y),(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:l,class:"-gear-icon",title:"Expand"}))),C&&C.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},C.map((N,D)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:N.onClick,key:D},(0,n.h)("svg",{width:N.svgWidth,height:N.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":N.defaultFillRule,"clip-rule":N.defaultClipRule,d:N.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},N.info)))))};e.SnackbarInstance=m})(Ys);Object.defineProperty(Mn,"__esModule",{value:!0});Mn.WalletLinkRelayUI=void 0;const Id=kn,xd=_i,Ad=Ys;class Td{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new Ad.Snackbar({darkMode:t.darkMode}),this.linkFlow=new xd.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",t.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,Id.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let r;return t.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}Mn.WalletLinkRelayUI=Td;Object.defineProperty(_n,"__esModule",{value:!0});_n.WalletLinkRelay=void 0;const Lr=gn,Nd=Ve,Fe=q,ir=Yr,Zo=ht,Pt=Xr,Ld=vi,sr=Kr,Od=Mn;class Tt extends Zo.RelayAbstract{constructor(t){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{var l;this.isLinked=a;const d=this.storage.getItem(Zo.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this.session.linked=a),this.isUnlinkedErrorState=!1,d){const h=d.split(" "),m=this.storage.getItem("IsStandaloneSigning")==="true";if(h[0]!==""&&!a&&this.session.linked&&!m){this.isUnlinkedErrorState=!0;const R=this.getSessionIdHash();(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:R})}}},this.metadataUpdated=(a,l)=>{this.storage.setItem(a,l)},this.chainUpdated=(a,l)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===l||(this.chainCallbackParams={chainId:a,jsonRpcUrl:l},this.chainCallback&&this.chainCallback(a,l))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),Tt.accountRequestCallbackIds.size>0&&(Array.from(Tt.accountRequestCallbackIds.values()).forEach(l=>{const d={type:"WEB3_RESPONSE",id:l,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},d),{id:l}))}),Tt.accountRequestCallbackIds.clear())},this.connectedUpdated=a=>{this.ui.setConnected(a)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(r=t.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const t=Pt.Session.load(this.storage)||new Pt.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new Ld.WalletLinkConnection({session:t,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:a}=this.options,l=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:a,session:t});return i.connect(),{session:t,ui:l,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,r;const n=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log(ir.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=Pt.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(ir.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Pt.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:a,connection:l}=this.subscribe();this._session=s,this.connection=l,this.ui=a,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,r){this.appName=t,this.appLogoUrl=r}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,r){this.storage.setItem(t,r)}signEthereumMessage(t,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),signature:(0,Fe.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Fe.hexStringFromBuffer)(t,!0),chainId:r}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,Fe.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,r){return this.sendRequest({method:"generic",params:{action:r,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let r=null;const n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,a),r==null||r()};return{promise:new Promise((a,l)=>{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,sr.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)}),this.ui.isStandalone()?this.sendRequestStandalone(n,t):this.publishWeb3RequestEvent(n,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof Od.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,r){var n;const i={type:"WEB3_REQUEST",id:t,request:r},s=Pt.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ir.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(a=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:a.message}})})}publishWeb3RequestCanceledEvent(t){const r={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(t,r,n){return this.connection.publishEvent(t,r,n)}handleWeb3ResponseMessage(t){var r;const{response:n}=t;if((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Tt.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),Tt.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,r,n,i){var s;const a=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,Lr.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:r,errorMessage:a,errorCode:i}})}invokeCallback(t){const r=this.relayEventManager.callbacks.get(t.id);r&&(r(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,Fe.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s)};return{promise:new Promise((s,a)=>{if(this.relayEventManager.callbacks.set(r,l=>{if(this.ui.hideRequestEthereumAccounts(),(0,sr.isErrorResponse)(l))return a(new Error(l.errorMessage));s(l)}),this.ui.inlineAccountsResponse()){const l=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:d}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:l})}else{const l=Lr.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(l)})}Tt.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,t)}),cancel:n}}selectProvider(t){const r={method:"selectProvider",params:{providerOptions:t}},n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,a)},s=new Promise((a,l)=>{this.relayEventManager.callbacks.set(n,m=>{if((0,sr.isErrorResponse)(m))return l(new Error(m.errorMessage));a(m)});const d=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:Nd.ProviderType.Unselected}})},h=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:m}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:h,onCancel:d,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,r,n,i,s,a){const l={method:"watchAsset",params:{type:t,options:{address:r,symbol:n,decimals:i,image:s},chainId:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};this.ui.inlineWatchAsset()||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload}));const R=new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!1}})},B=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:B,onCancel:x,type:t,address:r,symbol:n,decimals:i,image:s,chainId:a}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)});return{cancel:m,promise:R}}addEthereumChain(t,r,n,i,s,a){const l={method:"addEthereumChain",params:{chainId:t,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};return this.ui.inlineAddEthereumChain(t)||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload})),{promise:new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},B=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:O}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:x,onApprove:B,chainId:l.params.chainId,rpcUrls:l.params.rpcUrls,blockExplorerUrls:l.params.blockExplorerUrls,chainName:l.params.chainName,iconUrls:l.params.iconUrls,nativeCurrency:l.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)}),cancel:m}}switchEthereumChain(t,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:r})},i=(0,Fe.randomBytesHex)(8),s=l=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,l)};return{promise:new Promise((l,d)=>{this.relayEventManager.callbacks.set(i,R=>{if((0,sr.isErrorResponse)(R)&&R.errorCode)return d(Lr.standardErrors.provider.custom({code:R.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,sr.isErrorResponse)(R))return d(new Error(R.errorMessage));l(R)});const h=R=>{var y;if(R){const C=(y=(0,Lr.getErrorCode)(R))!==null&&y!==void 0?y:Lr.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",R instanceof Error?R:Lr.standardErrors.provider.unsupportedChain(t),C)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},m=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:R}}})};this.ui.switchEthereumChain({onCancel:h,onApprove:m,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return Pt.Session.hash(this._session.id)}sendRequestStandalone(t,r){const n=s=>{this.handleErrorResponse(t,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}_n.WalletLinkRelay=Tt;Tt.accountRequestCallbackIds=new Set;var In={},Ni={},$c={};(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ys,e)})($c);var eo={};Object.defineProperty(eo,"__esModule",{value:!0});eo.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 Bc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.RedirectDialog=void 0;const Pd=Bc(Cn),Rt=tt,$d=kn,Bd=$c,Dd=Bc(eo);class Fd{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,$d.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,Rt.render)(null,this.root),t&&(0,Rt.render)((0,Rt.h)(jd,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}Ni.RedirectDialog=Fd;const jd=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,Rt.h)(Bd.SnackbarContainer,{darkMode:r},(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Rt.h)("style",null,Dd.default),(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,Rt.h)("div",{class:(0,Pd.default)("-cbwsdk-redirect-dialog-box",s)},(0,Rt.h)("p",null,e),(0,Rt.h)("button",{onClick:n},t))))};Object.defineProperty(In,"__esModule",{value:!0});In.MobileRelayUI=void 0;const Hd=Ni;class Ud{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Hd.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),t&&r.searchParams.append("wl_url",t);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}In.MobileRelayUI=Ud;Object.defineProperty(wn,"__esModule",{value:!0});wn.MobileRelay=void 0;const Wd=q,Vd=_n,zd=In;class qd extends Vd.WalletLinkRelay{constructor(t){var r;super(t),this._enableMobileWalletLink=(r=t.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,Wd.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,r){if(super.publishWeb3RequestEvent(t,r),!(this._enableMobileWalletLink&&this.ui instanceof zd.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}wn.MobileRelay=qd;var $s={exports:{}},Dc=si.EventEmitter,ps,Ko;function Jd(){if(Ko)return ps;Ko=1;function e(x,B){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(x);B&&(M=M.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),O.push.apply(O,M)}return O}function t(x){for(var B=1;B0?this.tail.next=M:this.head=M,this.tail=M,++this.length}},{key:"unshift",value:function(O){var M={data:O,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}},{key:"shift",value:function(){if(this.length!==0){var O=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,O}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(O){if(this.length===0)return"";for(var M=this.head,T=""+M.data;M=M.next;)T+=O+M.data;return T}},{key:"concat",value:function(O){if(this.length===0)return h.alloc(0);for(var M=h.allocUnsafe(O>>>0),T=this.head,N=0;T;)C(T.data,M,N),N+=T.data.length,T=T.next;return M}},{key:"consume",value:function(O,M){var T;return OD.length?D.length:O;if(L===D.length?N+=D:N+=D.slice(0,O),O-=L,O===0){L===D.length?(++T,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=D.slice(L));break}++T}return this.length-=T,N}},{key:"_getBuffer",value:function(O){var M=h.allocUnsafe(O),T=this.head,N=1;for(T.data.copy(M),O-=T.data.length;T=T.next;){var D=T.data,L=O>D.length?D.length:O;if(D.copy(M,M.length-O,0,L),O-=L,O===0){L===D.length?(++N,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice(L));break}++N}return this.length-=N,M}},{key:y,value:function(O,M){return R(this,t(t({},M),{},{depth:0,customInspect:!1}))}}]),x}(),ps}var or={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function Gd(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,or.nextTick(Bs,this,e)):or.nextTick(Bs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?or.nextTick(Xn,r):(r._writableState.errorEmitted=!0,or.nextTick(Qo,r,s)):or.nextTick(Qo,r,s):t?(or.nextTick(Xn,r),t(s)):or.nextTick(Xn,r)}),this)}function Qo(e,t){Bs(e,t),Xn(e)}function Xn(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zd(){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 Bs(e,t){e.emit("error",t)}function Kd(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var Fc={destroy:Gd,undestroy:Zd,errorOrDestroy:Kd},mr={};function Qd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var jc={};function pt(e,t,r){r||(r=Error);function n(s,a,l){return typeof t=="string"?t:t(s,a,l)}var i=function(s){Qd(a,s);function a(l,d,h){return s.call(this,n(l,d,h))||this}return a}(r);i.prototype.name=r.name,i.prototype.code=e,jc[e]=i}function Yo(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Yd(e,t,r){return e.substr(0,t.length)===t}function Xd(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ef(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}pt("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);pt("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Yd(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xd(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Yo(t,"type"));else{var s=ef(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Yo(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);pt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");pt("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});pt("ERR_STREAM_PREMATURE_CLOSE","Premature close");pt("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});pt("ERR_MULTIPLE_CALLBACK","Callback called multiple times");pt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");pt("ERR_STREAM_WRITE_AFTER_END","write after end");pt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);pt("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);pt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");mr.codes=jc;var tf=mr.codes.ERR_INVALID_OPT_VALUE;function rf(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function nf(e,t,r,n){var i=rf(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new tf(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var Hc={getHighWaterMark:nf},sf=of;function of(e,t){if(gs("noDeprecation"))return e;var r=!1;function n(){if(!r){if(gs("throwDeprecation"))throw new Error(t);gs("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function gs(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var ms,Xo;function Uc(){if(Xo)return ms;Xo=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};ms=Z;function t(A){var I=this;this.next=null,this.entry=null,this.finish=function(){V(I,A)}}var r;Z.WritableState=W;var n={deprecate:sf},i=Dc,s=ii.Buffer,a=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(A){return s.from(A)}function d(A){return s.isBuffer(A)||A instanceof a}var h=Fc,m=Hc,R=m.getHighWaterMark,y=mr.codes,C=y.ERR_INVALID_ARG_TYPE,x=y.ERR_METHOD_NOT_IMPLEMENTED,B=y.ERR_MULTIPLE_CALLBACK,O=y.ERR_STREAM_CANNOT_PIPE,M=y.ERR_STREAM_DESTROYED,T=y.ERR_STREAM_NULL_VALUES,N=y.ERR_STREAM_WRITE_AFTER_END,D=y.ERR_UNKNOWN_ENCODING,L=h.errorOrDestroy;vt(Z,i);function F(){}function W(A,I,$){r=r||zr(),A=A||{},typeof $!="boolean"&&($=I instanceof r),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=R(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var K=A.decodeStrings===!1;this.decodeStrings=!K,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){p(I,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}W.prototype.getBuffer=function(){for(var I=this.bufferedRequest,$=[];I;)$.push(I),I=I.next;return $},function(){try{Object.defineProperty(W.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var te;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(te=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(I){return te.call(this,I)?!0:this!==Z?!1:I&&I._writableState instanceof W}})):te=function(I){return I instanceof this};function Z(A){r=r||zr();var I=this instanceof r;if(!I&&!te.call(Z,this))return new Z(A);this._writableState=new W(A,this,I),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),i.call(this)}Z.prototype.pipe=function(){L(this,new O)};function z(A,I){var $=new N;L(A,$),e.nextTick(I,$)}function X(A,I,$,K){var G;return $===null?G=new T:typeof $!="string"&&!I.objectMode&&(G=new C("chunk",["string","Buffer"],$)),G?(L(A,G),e.nextTick(K,G),!1):!0}Z.prototype.write=function(A,I,$){var K=this._writableState,G=!1,b=!K.objectMode&&d(A);return b&&!s.isBuffer(A)&&(A=l(A)),typeof I=="function"&&($=I,I=null),b?I="buffer":I||(I=K.defaultEncoding),typeof $!="function"&&($=F),K.ending?z(this,$):(b||X(this,K,A,$))&&(K.pendingcb++,G=S(this,K,b,A,I,$)),G},Z.prototype.cork=function(){this._writableState.corked++},Z.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&k(this,A))},Z.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new D(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(Z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ne(A,I,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof I=="string"&&(I=s.from(I,$)),I}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function S(A,I,$,K,G,b){if(!$){var _=ne(I,K,G);K!==_&&($=!0,G="buffer",K=_)}var P=I.objectMode?1:K.length;I.length+=P;var j=I.length>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function a(M,T,N){var D=T.length-1;if(D=0?(L>0&&(M.lastNeed=L-1),L):--D=0?(L>0&&(M.lastNeed=L-2),L):--D=0?(L>0&&(L===2?L=0:M.lastNeed=L-3),L):0))}function l(M,T,N){if((T[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return M.lastNeed=2,"�"}}function d(M){var T=this.lastTotal-this.lastNeed,N=l(this,M);if(N!==void 0)return N;if(this.lastNeed<=M.length)return M.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,T,0,M.length),this.lastNeed-=M.length}function h(M,T){var N=a(this,M,T);if(!this.lastNeed)return M.toString("utf8",T);this.lastTotal=N;var D=M.length-(N-this.lastNeed);return M.copy(this.lastChar,0,D),M.toString("utf8",T,D)}function m(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+"�":T}function R(M,T){if((M.length-T)%2===0){var N=M.toString("utf16le",T);if(N){var D=N.charCodeAt(N.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",T,M.length-1)}function y(M){var T=M&&M.length?this.write(M):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,N)}return T}function C(M,T){var N=(M.length-T)%3;return N===0?M.toString("base64",T):(this.lastNeed=3-N,this.lastTotal=3,N===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",T,M.length-N))}function x(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function B(M){return M.toString(this.encoding)}function O(M){return M&&M.length?this.write(M):""}return bs}var na=mr.codes.ERR_STREAM_PREMATURE_CLOSE;function af(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof _!="string"&&!J.objectMode&&Object.getPrototypeOf(_)!==i.prototype&&(_=a(_)),j)J.endEmitted?F(b,new T):ne(b,J,_,!0);else if(J.ended)F(b,new O);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!P?(_=J.decoder.write(_),J.objectMode||_.length!==0?ne(b,J,_,!1):k(b,J)):ne(b,J,_,!1)}else j||(J.reading=!1,k(b,J))}return!J.ended&&(J.length=o?b=o:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function f(b,_){return b<=0||_.length===0&&_.ended?0:_.objectMode?1:b!==b?_.flowing&&_.length?_.buffer.head.data.length:_.length:(b>_.highWaterMark&&(_.highWaterMark=u(b)),b<=_.length?b:_.ended?_.length:(_.needReadable=!0,0))}z.prototype.read=function(b){h("read",b),b=parseInt(b,10);var _=this._readableState,P=b;if(b!==0&&(_.emittedReadable=!1),b===0&&_.needReadable&&((_.highWaterMark!==0?_.length>=_.highWaterMark:_.length>0)||_.ended))return h("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?$(this):v(this),null;if(b=f(b,_),b===0&&_.ended)return _.length===0&&$(this),null;var j=_.needReadable;h("need readable",j),(_.length===0||_.length-b<_.highWaterMark)&&(j=!0,h("length less than watermark",j)),_.ended||_.reading?(j=!1,h("reading or ended",j)):j&&(h("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,_.reading||(b=f(P,_)));var ue;return b>0?ue=I(b,_):ue=null,ue===null?(_.needReadable=_.length<=_.highWaterMark,b=0):(_.length-=b,_.awaitDrain=0),_.length===0&&(_.ended||(_.needReadable=!0),P!==b&&_.ended&&$(this)),ue!==null&&this.emit("data",ue),ue};function p(b,_){if(h("onEofChunk"),!_.ended){if(_.decoder){var P=_.decoder.end();P&&P.length&&(_.buffer.push(P),_.length+=_.objectMode?1:P.length)}_.ended=!0,_.sync?v(b):(_.needReadable=!1,_.emittedReadable||(_.emittedReadable=!0,E(b)))}}function v(b){var _=b._readableState;h("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(h("emitReadable",_.flowing),_.emittedReadable=!0,e.nextTick(E,b))}function E(b){var _=b._readableState;h("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(b.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,A(b)}function k(b,_){_.readingMore||(_.readingMore=!0,e.nextTick(g,b,_))}function g(b,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var P=_.length;if(h("maybeReadMore read 0"),b.read(0),P===_.length)break}_.readingMore=!1}z.prototype._read=function(b){F(this,new M("_read()"))},z.prototype.pipe=function(b,_){var P=this,j=this._readableState;switch(j.pipesCount){case 0:j.pipes=b;break;case 1:j.pipes=[j.pipes,b];break;default:j.pipes.push(b);break}j.pipesCount+=1,h("pipe count=%d opts=%j",j.pipesCount,_);var ue=(!_||_.end!==!1)&&b!==e.stdout&&b!==e.stderr,J=ue?at:le;j.endEmitted?e.nextTick(J):P.once("end",J),b.on("unpipe",Y);function Y(nt,ce){h("onunpipe"),nt===P&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,Ht())}function at(){h("onend"),b.end()}var he=c(P);b.on("drain",he);var pe=!1;function Ht(){h("cleanup"),b.removeListener("close",xt),b.removeListener("finish",fe),b.removeListener("drain",he),b.removeListener("error",de),b.removeListener("unpipe",Y),P.removeListener("end",at),P.removeListener("end",le),P.removeListener("data",ge),pe=!0,j.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&he()}P.on("data",ge);function ge(nt){h("ondata");var ce=b.write(nt);h("dest.write",ce),ce===!1&&((j.pipesCount===1&&j.pipes===b||j.pipesCount>1&&G(j.pipes,b)!==-1)&&!pe&&(h("false write response, pause",j.awaitDrain),j.awaitDrain++),P.pause())}function de(nt){h("onerror",nt),le(),b.removeListener("error",de),r(b,"error")===0&&F(b,nt)}te(b,"error",de);function xt(){b.removeListener("finish",fe),le()}b.once("close",xt);function fe(){h("onfinish"),b.removeListener("close",xt),le()}b.once("finish",fe);function le(){h("unpipe"),P.unpipe(b)}return b.emit("pipe",P),j.flowing||(h("pipe resume"),P.resume()),b};function c(b){return function(){var P=b._readableState;h("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&r(b,"data")&&(P.flowing=!0,A(b))}}z.prototype.unpipe=function(b){var _=this._readableState,P={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return b&&b!==_.pipes?this:(b||(b=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,b&&b.emit("unpipe",this,P),this);if(!b){var j=_.pipes,ue=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J0,j.flowing!==!1&&this.resume()):b==="readable"&&!j.endEmitted&&!j.readableListening&&(j.readableListening=j.needReadable=!0,j.flowing=!1,j.emittedReadable=!1,h("on readable",j.length,j.reading),j.length?v(this):j.reading||e.nextTick(U,this)),P},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(b,_){var P=n.prototype.removeListener.call(this,b,_);return b==="readable"&&e.nextTick(w,this),P},z.prototype.removeAllListeners=function(b){var _=n.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&e.nextTick(w,this),_};function w(b){var _=b._readableState;_.readableListening=b.listenerCount("readable")>0,_.resumeScheduled&&!_.paused?_.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){h("readable nexttick read 0"),b.read(0)}z.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,H(this,b)),b.paused=!1,this};function H(b,_){_.resumeScheduled||(_.resumeScheduled=!0,e.nextTick(V,b,_))}function V(b,_){h("resume",_.reading),_.reading||b.read(0),_.resumeScheduled=!1,b.emit("resume"),A(b),_.flowing&&!_.reading&&b.read(0)}z.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 A(b){var _=b._readableState;for(h("flow",_.flowing);_.flowing&&b.read()!==null;);}z.prototype.wrap=function(b){var _=this,P=this._readableState,j=!1;b.on("end",function(){if(h("wrapped end"),P.decoder&&!P.ended){var Y=P.decoder.end();Y&&Y.length&&_.push(Y)}_.push(null)}),b.on("data",function(Y){if(h("wrapped data"),P.decoder&&(Y=P.decoder.write(Y)),!(P.objectMode&&Y==null)&&!(!P.objectMode&&(!Y||!Y.length))){var at=_.push(Y);at||(j=!0,b.pause())}});for(var ue in b)this[ue]===void 0&&typeof b[ue]=="function"&&(this[ue]=function(at){return function(){return b[at].apply(b,arguments)}}(ue));for(var J=0;J=_.length?(_.decoder?P=_.buffer.join(""):_.buffer.length===1?P=_.buffer.first():P=_.buffer.concat(_.length),_.buffer.clear()):P=_.buffer.consume(b,_.decoder),P}function $(b){var _=b._readableState;h("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,e.nextTick(K,_,b))}function K(b,_){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,_.readable=!1,_.emit("end"),b.autoDestroy)){var P=_._writableState;(!P||P.autoDestroy&&P.finished)&&_.destroy()}}typeof Symbol=="function"&&(z.from=function(b,_){return L===void 0&&(L=hf()),L(z,b,_)});function G(b,_){for(var P=0,j=b.length;P0;return Sf(a,d,h,function(m){i||(i=m),m&&s.forEach(la),!d&&(s.forEach(la),n(i))})});return t.reduce(Rf)}var Cf=kf;(function(e,t){t=e.exports=Vc(),t.Stream=t,t.Readable=t,t.Writable=Uc(),t.Duplex=zr(),t.Transform=zc,t.PassThrough=bf,t.finished=to,t.pipeline=Cf})($s,$s.exports);var Gc=$s.exports;const{Transform:If}=Gc;var xf=e=>class Zc extends If{constructor(r,n,i,s,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Zc(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Af}=Gc;var Tf=e=>class Kc extends Af{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Kc(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const Nf=xf,Lf=Tf;var Of=function(e){const t=Nf(e),r=Lf(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},Qc={};const ua=[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];Qc.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],m=e[8]^e[18]^e[28]^e[38]^e[48],R=e[9]^e[19]^e[29]^e[39]^e[49];let y=m^(i<<1|s>>>31),C=R^(s<<1|i>>>31);const x=e[0]^y,B=e[1]^C,O=e[10]^y,M=e[11]^C,T=e[20]^y,N=e[21]^C,D=e[30]^y,L=e[31]^C,F=e[40]^y,W=e[41]^C;y=r^(a<<1|l>>>31),C=n^(l<<1|a>>>31);const te=e[2]^y,Z=e[3]^C,z=e[12]^y,X=e[13]^C,ne=e[22]^y,S=e[23]^C,o=e[32]^y,u=e[33]^C,f=e[42]^y,p=e[43]^C;y=i^(d<<1|h>>>31),C=s^(h<<1|d>>>31);const v=e[4]^y,E=e[5]^C,k=e[14]^y,g=e[15]^C,c=e[24]^y,w=e[25]^C,U=e[34]^y,H=e[35]^C,V=e[44]^y,A=e[45]^C;y=a^(m<<1|R>>>31),C=l^(R<<1|m>>>31);const I=e[6]^y,$=e[7]^C,K=e[16]^y,G=e[17]^C,b=e[26]^y,_=e[27]^C,P=e[36]^y,j=e[37]^C,ue=e[46]^y,J=e[47]^C;y=d^(r<<1|n>>>31),C=h^(n<<1|r>>>31);const Y=e[8]^y,at=e[9]^C,he=e[18]^y,pe=e[19]^C,Ht=e[28]^y,ge=e[29]^C,de=e[38]^y,xt=e[39]^C,fe=e[48]^y,le=e[49]^C,nt=x,ce=B,me=M<<4|O>>>28,wr=O<<4|M>>>28,ve=T<<3|N>>>29,be=N<<3|T>>>29,_r=L<<9|D>>>23,we=D<<9|L>>>23,_e=F<<18|W>>>14,yr=W<<18|F>>>14,ye=te<<1|Z>>>31,Ee=Z<<1|te>>>31,Er=X<<12|z>>>20,Se=z<<12|X>>>20,Re=ne<<10|S>>>22,Sr=S<<10|ne>>>22,Me=u<<13|o>>>19,ke=o<<13|u>>>19,Rr=f<<2|p>>>30,Ce=p<<2|f>>>30,Ie=E<<30|v>>>2,Mr=v<<30|E>>>2,xe=k<<6|g>>>26,Ae=g<<6|k>>>26,kr=w<<11|c>>>21,Te=c<<11|w>>>21,Ne=U<<15|H>>>17,Cr=H<<15|U>>>17,Le=A<<29|V>>>3,Oe=V<<29|A>>>3,Ir=I<<28|$>>>4,Pe=$<<28|I>>>4,$e=G<<23|K>>>9,xr=K<<23|G>>>9,Be=b<<25|_>>>7,De=_<<25|b>>>7,Ut=P<<21|j>>>11,Wt=j<<21|P>>>11,Vt=J<<24|ue>>>8,zt=ue<<24|J>>>8,qt=Y<<27|at>>>5,Jt=at<<27|Y>>>5,Gt=he<<20|pe>>>12,Zt=pe<<20|he>>>12,Kt=ge<<7|Ht>>>25,Qt=Ht<<7|ge>>>25,Yt=de<<8|xt>>>24,Xt=xt<<8|de>>>24,er=fe<<14|le>>>18,tr=le<<14|fe>>>18;e[0]=nt^~Er&kr,e[1]=ce^~Se&Te,e[10]=Ir^~Gt&ve,e[11]=Pe^~Zt&be,e[20]=ye^~xe&Be,e[21]=Ee^~Ae&De,e[30]=qt^~me&Re,e[31]=Jt^~wr&Sr,e[40]=Ie^~$e&Kt,e[41]=Mr^~xr&Qt,e[2]=Er^~kr&Ut,e[3]=Se^~Te&Wt,e[12]=Gt^~ve&Me,e[13]=Zt^~be&ke,e[22]=xe^~Be&Yt,e[23]=Ae^~De&Xt,e[32]=me^~Re&Ne,e[33]=wr^~Sr&Cr,e[42]=$e^~Kt&_r,e[43]=xr^~Qt&we,e[4]=kr^~Ut&er,e[5]=Te^~Wt&tr,e[14]=ve^~Me&Le,e[15]=be^~ke&Oe,e[24]=Be^~Yt&_e,e[25]=De^~Xt&yr,e[34]=Re^~Ne&Vt,e[35]=Sr^~Cr&zt,e[44]=Kt^~_r&Rr,e[45]=Qt^~we&Ce,e[6]=Ut^~er&nt,e[7]=Wt^~tr&ce,e[16]=Me^~Le&Ir,e[17]=ke^~Oe&Pe,e[26]=Yt^~_e&ye,e[27]=Xt^~yr&Ee,e[36]=Ne^~Vt&qt,e[37]=Cr^~zt&Jt,e[46]=_r^~Rr&Ie,e[47]=we^~Ce&Mr,e[8]=er^~nt&Er,e[9]=tr^~ce&Se,e[18]=Le^~Ir&Gt,e[19]=Oe^~Pe&Zt,e[28]=_e^~ye&xe,e[29]=yr^~Ee&Ae,e[38]=Vt^~qt&me,e[39]=zt^~Jt&wr,e[48]=Rr^~Ie&$e,e[49]=Ce^~Mr&xr,e[0]^=ua[t*2],e[1]^=ua[t*2+1]}};const ti=Qc;function tn(){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}tn.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};tn.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(ti.p1600(this.state),this.count=0);return t};tn.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 Pf=tn,$f=Of(Pf);const Bf=$f,Df=ci;function Yc(e){return Buffer.allocUnsafe(e).fill(0)}function Xc(e,t,r){const n=Yc(t);return e=Pi(e),r?e.length"u")throw new Error("Not an array?");if(r=il(e),r!=="dynamic"&&r!==0&&t.length>r)throw new Error("Elements exceed array size: "+r);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(St(e,t[s]));if(r==="dynamic"){var a=St("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([St("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,dr.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(r=Fr(e),r<1||r>32)throw new Error("Invalid bytes width: "+r);return dr.setLengthRight(t,32)}else if(e.startsWith("uint")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(r=ha(e),n=ar(t),n<0)throw new Error("Supplied ufixed is negative");return St("uint256",n.mul(new lr(2).pow(new lr(r[1]))))}else if(e.startsWith("fixed"))return r=ha(e),St("int256",ar(t).mul(new lr(2).pow(new lr(r[1]))))}throw new Error("Unsupported or invalid type: "+e)}function Wf(e){return e==="string"||e==="bytes"||il(e)==="dynamic"}function Vf(e){return e.lastIndexOf("]")===e.length-1}function zf(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var a=nl(e[s]),l=t[s],d=St(a,l);Wf(a)?(r.push(St("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function sl(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(dr.setLengthRight(l,r))}else if(a.startsWith("uint")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(a.startsWith("int")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function qf(e,t){return dr.keccak(sl(e,t))}var Jf={rawEncode:zf,solidityPack:sl,soliditySHA3:qf};const mt=rl,un=Jf,ol={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"]},Ss={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const a=(l,d,h)=>{if(r[d]!==void 0)return["bytes32",h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":mt.keccak(this.encodeData(d,h,r,n))];if(h===void 0)throw new Error(`missing value for field ${l} of type ${d}`);if(d==="bytes")return["bytes32",mt.keccak(h)];if(d==="string")return typeof h=="string"&&(h=Buffer.from(h,"utf8")),["bytes32",mt.keccak(h)];if(d.lastIndexOf("]")===d.length-1){const m=d.slice(0,d.lastIndexOf("[")),R=h.map(y=>a(l,m,y));return["bytes32",mt.keccak(un.rawEncode(R.map(([y])=>y),R.map(([,y])=>y)))]}return[d,h]};for(const l of r[e]){const[d,h]=a(l.name,l.type,t[l.name]);i.push(d),s.push(h)}}else for(const a of r[e]){let l=t[a.name];if(l!==void 0)if(a.type==="bytes")i.push("bytes32"),l=mt.keccak(l),s.push(l);else if(a.type==="string")i.push("bytes32"),typeof l=="string"&&(l=Buffer.from(l,"utf8")),l=mt.keccak(l),s.push(l);else if(r[a.type]!==void 0)i.push("bytes32"),l=mt.keccak(this.encodeData(a.type,l,r,n)),s.push(l);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(l)}}return un.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(i=>i!==e);n=[e].concat(n.sort());for(const i of n){if(!t[i])throw new Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:a,type:l})=>l+" "+a).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||t[e]===void 0)return r;r.push(e);for(const n of t[e])for(const i of this.findTypeDependencies(n.type,t,r))!r.includes(i)&&r.push(i);return r},hashStruct(e,t,r,n=!0){return mt.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return mt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in ol.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),mt.keccak(Buffer.concat(n))}};var Gf={TYPED_MESSAGE_SCHEMA:ol,TypedDataUtils:Ss,hashForSignTypedDataLegacy:function(e){return Zf(e.data)},hashForSignTypedData_v3:function(e){return Ss.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Ss.hash(e.data)}};function Zf(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const r=e.map(function(s){return s.type==="bytes"?mt.toBuffer(s.value):s.value}),n=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return un.soliditySHA3(["bytes32","bytes32"],[un.soliditySHA3(new Array(e.length).fill("string"),i),un.soliditySHA3(n,r)])}var qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.filterFromParam=qr.FilterPolyfill=void 0;const $r=Ve,Ye=q,Kf=5*60*1e3,cr={jsonrpc:"2.0",id:0};class Qf{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,$r.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const r=al(t),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Ye.hexStringFromIntNumber)(n)}async newBlockFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.blockFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}uninstallFilter(t){const r=(0,Ye.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(t){const r=(0,Ye.intNumberFromHexString)(t);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Vn())}async getFilterLogs(t){const r=(0,Ye.intNumberFromHexString)(t),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(n)]})):Vn()}makeFilterId(){return(0,$r.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((r,n)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const r=this.logFilters.get(t),n=this.cursors.get(t);if(!n||!r)return Vn();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return zn();console.info(`Fetching logs from ${n} to ${s} for filter ${t}`);const a=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(a.result)){const l=a.result.map(h=>(0,Ye.intNumberFromHexString)(h.blockNumber||"0x0")),d=Math.max(...l);if(d&&d>n){const h=(0,$r.IntNumber)(d+1);console.info(`Moving cursor position for filter (${t}) from ${n} to ${h}`),this.cursors.set(t,h)}}return a}async getBlockFilterChanges(t){const r=this.cursors.get(t);if(!r)return Vn();const n=await this.getCurrentBlockHeight();if(r>n)return zn();console.info(`Fetching blocks from ${r} to ${n} for filter (${t})`);const i=(await Promise.all((0,Ye.range)(r,n+1).map(a=>this.getBlockHashByNumber((0,$r.IntNumber)(a))))).filter(a=>!!a),s=(0,$r.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${t}) from ${r} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},cr),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(zn())}async setInitialCursorPosition(t,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(t,i),i}setFilterTimeout(t){const r=this.timeouts.get(t);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},Kf);this.timeouts.set(t,n)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_blockNumber",params:[]}));return(0,Ye.intNumberFromHexString)((0,Ye.ensureHexString)(t))}async getBlockHashByNumber(t){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getBlockByNumber",params:[(0,Ye.hexStringFromIntNumber)(t),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Ye.ensureHexString)(r.result.hash):null}}qr.FilterPolyfill=Qf;function al(e){return{fromBlock:fa(e.fromBlock),toBlock:fa(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}qr.filterFromParam=al;function da(e){const t={fromBlock:pa(e.fromBlock),toBlock:pa(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function fa(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,$r.IntNumber)(0);if((0,Ye.isHexString)(e))return(0,Ye.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function pa(e){return e==="latest"?e:(0,Ye.hexStringFromIntNumber)(e)}function Vn(){return Object.assign(Object.assign({},cr),{error:{code:-32e3,message:"filter not found"}})}function zn(){return Object.assign(Object.assign({},cr),{result:[]})}var $i={},cl={},Bi={},ro=Yf;function Yf(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const ga=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let i=0;i{t.errorFirst?n.push(function(a,l){if(t.multiArgs){const d=new Array(arguments.length-1);for(let h=1;h{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=i=>{const s=a=>typeof a=="string"?i===a:a.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let n;typeof e=="function"?n=function(){return t.excludeMain?e.apply(this,arguments):ga(e,t).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]=typeof s=="function"&&r(i)?ga(s,t):s}return n},xn={},An={};Object.defineProperty(An,"__esModule",{value:!0});const e0=si;function ma(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function t0(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")ma(s,this,r);else{const a=s.length,l=t0(s);for(let d=0;de+t,va=["sync","latest"];class a0 extends i0.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*s0,this._usePastBlocks=t.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(t){return t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t){va.includes(t)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return va.map(t=>this.listenerCount(t)).reduce(o0)}_shouldUseNewBlock(t){const r=this._currentBlock;if(!r)return!0;const n=ba(t),i=ba(r);return this._usePastBlocks&&ni}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const r=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:r,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}xn.BaseBlockTracker=a0;function ba(e){return Number.parseInt(e,16)}var ll={},ul={},Ke={};class hl extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...a}=t,{path:l}=t,d=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(s??d),s!=null&&(this.cause=d),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function c0(e){return ft(e)&&typeof e[Symbol.iterator]=="function"}function ft(e){return typeof e=="object"&&e!=null}function wa(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ze(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function l0(e){const{done:t,value:r}=e.next();return t?void 0:r}function u0(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:a}=r,{refinement:l,message:d=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${ze(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:s,...e,message:d}}function*Ds(e,t,r,n){c0(e)||(e=[e]);for(const i of e){const s=u0(i,t,r,n);s&&(yield s)}}function*no(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:a=!1}=r,l={path:n,branch:i};if(s&&(e=t.coercer(e,l),a&&t.type!=="type"&&ft(t.schema)&&ft(e)&&!Array.isArray(e)))for(const h in e)t.schema[h]===void 0&&delete e[h];let d="valid";for(const h of t.validator(e,l))h.explanation=r.message,d="not_valid",yield[h,void 0];for(let[h,m,R]of t.entries(e,l)){const y=no(m,R,{path:h===void 0?n:[...n,h],branch:h===void 0?i:[...i,m],coerce:s,mask:a,message:r.message});for(const C of y)C[0]?(d=C[0].refinement!=null?"not_refined":"not_valid",yield[C[0],void 0]):s&&(m=C[1],h===void 0?e=m:e instanceof Map?e.set(h,m):e instanceof Set?e.add(m):ft(e)&&(m!==void 0||h in e)&&(e[h]=m))}if(d!=="not_valid")for(const h of t.refiner(e,l))h.explanation=r.message,d="not_refined",yield[h,void 0];d==="valid"&&(yield[void 0,e])}class Ue{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:a=d=>d,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(d,h)=>{const m=i(d,h);return Ds(m,h,this,d)}:this.validator=()=>[],s?this.refiner=(d,h)=>{const m=s(d,h);return Ds(m,h,this,d)}:this.refiner=()=>[]}assert(t,r){return dl(t,this,r)}create(t,r){return fl(t,this,r)}is(t){return io(t,this)}mask(t,r){return pl(t,this,r)}validate(t,r={}){return rn(t,this,r)}}function dl(e,t,r){const n=rn(e,t,{message:r});if(n[0])throw n[0]}function fl(e,t,r){const n=rn(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function pl(e,t,r){const n=rn(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function io(e,t){return!rn(e,t)[0]}function rn(e,t,r={}){const n=no(e,t,r),i=l0(n);return i[0]?[new hl(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function h0(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Nn(n):Tn(n)}function rt(e,t){return new Ue({type:e,schema:null,validator:t})}function d0(e,t){return new Ue({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function f0(e){return new Ue({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function p0(e){let t;return new Ue({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function g0(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function m0(e){const t=e instanceof Ue,r=t?{...e.schema}:{...e};for(const n in r)r[n]=gl(r[n]);return t&&e.type==="type"?Nn(r):Tn(r)}function v0(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function b0(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),rt(e,t)}function w0(){return rt("any",()=>!0)}function _0(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${ze(t)}`}})}function y0(){return rt("bigint",e=>typeof e=="bigint")}function E0(){return rt("boolean",e=>typeof e=="boolean")}function S0(){return rt("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ze(e)}`)}function R0(e){const t={},r=e.map(n=>ze(n)).join();for(const n of e)t[n]=n;return new Ue({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${ze(n)}`}})}function M0(){return rt("func",e=>typeof e=="function"||`Expected a function, but received: ${ze(e)}`)}function k0(e){return rt("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ze(t)}`)}function C0(){return rt("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ze(e)}`)}function I0(e){return new Ue({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function x0(e){const t=ze(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${ze(n)}`}})}function A0(e,t){return new Ue({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${ze(r)}`}})}function so(){return rt("never",()=>!1)}function T0(e){return new Ue({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function N0(){return rt("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${ze(e)}`)}function Tn(e){const t=e?Object.keys(e):[],r=so();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&ft(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ft(n)||`Expected an object, but received: ${ze(n)}`},coercer(n){return ft(n)?{...n}:n}})}function gl(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function L0(e,t){return new Ue({type:"record",schema:null,*entries(r){if(ft(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ft(r)||`Expected an object, but received: ${ze(r)}`}})}function O0(){return rt("regexp",e=>e instanceof RegExp)}function P0(e){return new Ue({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${ze(t)}`}})}function ml(){return rt("string",e=>typeof e=="string"||`Expected a string, but received: ${ze(e)}`)}function $0(e){const t=so();return new Ue({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...a]=no(r,s,n),[l]=a;if(l[0])for(const[d]of a)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ze(r)}`,...i]}})}function vl(){return rt("unknown",()=>!0)}function oo(e,t,r){return new Ue({...e,coercer:(n,i)=>io(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function D0(e,t,r={}){return oo(e,vl(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&wa(n)&&wa(i)){const s={...n};let a=!1;for(const l in i)s[l]===void 0&&(s[l]=i[l],a=!0);if(a)return s}return n})}function F0(e){return oo(e,ml(),t=>t.trim())}function j0(e){return vr(e,"empty",t=>{const r=bl(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function bl(e){return e instanceof Map||e instanceof Set?e.size:e.length}function H0(e,t,r={}){const{exclusive:n}=r;return vr(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function W0(e){return vr(e,"nonempty",t=>bl(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function V0(e,t){return vr(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function z0(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return vr(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:a}=s;return t<=a&&a<=r||`${n} with a size ${i} but received one with a size of \`${a}\``}else{const{length:a}=s;return t<=a&&a<=r||`${n} with a length ${i} but received one with a length of \`${a}\``}})}function vr(e,t,r){return new Ue({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),a=Ds(s,i,e,n);for(const l of a)yield{...l,refinement:t}}})}const q0=Object.freeze(Object.defineProperty({__proto__:null,Struct:Ue,StructError:hl,any:w0,array:_0,assert:dl,assign:h0,bigint:y0,boolean:E0,coerce:oo,create:fl,date:S0,defaulted:D0,define:rt,deprecated:d0,dynamic:f0,empty:j0,enums:R0,func:M0,instance:k0,integer:C0,intersection:I0,is:io,lazy:p0,literal:x0,map:A0,mask:pl,max:H0,min:U0,never:so,nonempty:W0,nullable:T0,number:N0,object:Tn,omit:g0,optional:gl,partial:m0,pattern:V0,pick:v0,record:L0,refine:vr,regexp:O0,set:P0,size:z0,string:ml,struct:b0,trimmed:F0,tuple:$0,type:Nn,union:B0,unknown:vl,validate:rn},Symbol.toStringTag,{value:"Module"})),br=Zr(q0);Object.defineProperty(Ke,"__esModule",{value:!0});Ke.assertExhaustive=Ke.assertStruct=Ke.assert=Ke.AssertionError=void 0;const J0=br;function G0(e){return typeof e=="object"&&e!==null&&"message"in e}function Z0(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function K0(e){const t=G0(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function wl(e,t){return Z0(e)?new e({message:t}):e({message:t})}class ao extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}Ke.AssertionError=ao;function Q0(e,t="Assertion failed.",r=ao){if(!e)throw t instanceof Error?t:wl(r,t)}Ke.assert=Q0;function Y0(e,t,r="Assertion failed",n=ao){try{(0,J0.assert)(e,t)}catch(i){throw wl(n,`${r}: ${K0(i)}.`)}}Ke.assertStruct=Y0;function X0(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Ke.assertExhaustive=X0;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.base64=void 0;const e1=br,t1=Ke,r1=(e,t={})=>{var r,n;const i=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=t.characterSet)!==null&&n!==void 0?n:"base64";let a;s==="base64"?a=String.raw`[A-Za-z0-9+\/]`:((0,t1.assert)(s==="base64url"),a=String.raw`[-_A-Za-z0-9]`);let l;return i?l=new RegExp(`^(?:${a}{4})*(?:${a}{3}=|${a}{2}==)?$`,"u"):l=new RegExp(`^(?:${a}{4})*(?:${a}{2,3}|${a}{3}=|${a}{2}==)?$`,"u"),(0,e1.pattern)(e,l)};Ln.base64=r1;var ae={},On={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=br,r=Ke;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function n(h){return(0,t.is)(h,e.HexStruct)}e.isHexString=n;function i(h){return(0,t.is)(h,e.StrictHexStruct)}e.isStrictHexString=i;function s(h){(0,r.assert)(n(h),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function a(h){(0,r.assert)(i(h),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=a;function l(h){return h.startsWith("0x")?h:h.startsWith("0X")?`0x${h.substring(2)}`:`0x${h}`}e.add0x=l;function d(h){return h.startsWith("0x")||h.startsWith("0X")?h.substring(2):h}e.remove0x=d})(On);Object.defineProperty(ae,"__esModule",{value:!0});ae.createDataView=ae.concatBytes=ae.valueToBytes=ae.stringToBytes=ae.numberToBytes=ae.signedBigIntToBytes=ae.bigIntToBytes=ae.hexToBytes=ae.bytesToString=ae.bytesToNumber=ae.bytesToSignedBigInt=ae.bytesToBigInt=ae.bytesToHex=ae.assertIsBytes=ae.isBytes=void 0;const ot=Ke,Fs=On,_a=48,ya=58,Ea=87;function n1(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const i1=n1();function co(e){return e instanceof Uint8Array}ae.isBytes=co;function nn(e){(0,ot.assert)(co(e),"Value must be a Uint8Array.")}ae.assertIsBytes=nn;function _l(e){if(nn(e),e.length===0)return"0x";const t=i1(),r=new Array(e.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return Di(t)}ae.bigIntToBytes=El;function c1(e,t){(0,ot.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function l1(e,t){(0,ot.assert)(typeof e=="bigint","Value must be a bigint."),(0,ot.assert)(typeof t=="number","Byte length must be a number."),(0,ot.assert)(t>0,"Byte length must be greater than 0."),(0,ot.assert)(c1(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i>=BigInt(8);return n.reverse()}ae.signedBigIntToBytes=l1;function Sl(e){(0,ot.assert)(typeof e=="number","Value must be a number."),(0,ot.assert)(e>=0,"Value must be a non-negative number."),(0,ot.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return Di(t)}ae.numberToBytes=Sl;function Rl(e){return(0,ot.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}ae.stringToBytes=Rl;function Ml(e){if(typeof e=="bigint")return El(e);if(typeof e=="number")return Sl(e);if(typeof e=="string")return e.startsWith("0x")?Di(e):Rl(e);if(co(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}ae.valueToBytes=Ml;function u1(e){const t=new Array(e.length);let r=0;for(let i=0;it.call(r,n,i,this))}get(t){return Xe(this,gt,"f").get(t)}has(t){return Xe(this,gt,"f").has(t)}keys(){return Xe(this,gt,"f").keys()}values(){return Xe(this,gt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}Jr.FrozenMap=lo;class uo{constructor(t){yt.set(this,void 0),Il(this,yt,new Set(t),"f"),Object.freeze(this)}get size(){return Xe(this,yt,"f").size}[(yt=new WeakMap,Symbol.iterator)](){return Xe(this,yt,"f")[Symbol.iterator]()}entries(){return Xe(this,yt,"f").entries()}forEach(t,r){return Xe(this,yt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}has(t){return Xe(this,yt,"f").has(t)}keys(){return Xe(this,yt,"f").keys()}values(){return Xe(this,yt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}Jr.FrozenSet=uo;Object.freeze(lo);Object.freeze(lo.prototype);Object.freeze(uo);Object.freeze(uo.prototype);var xl={};Object.defineProperty(xl,"__esModule",{value:!0});var Al={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=br,r=Ke,n=()=>(0,t.define)("finite number",L=>(0,t.is)(L,(0,t.number)())&&Number.isFinite(L));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),n(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(L,F)=>{function W(te,Z){const X=[...Z.validator(te,F)];return X.length>0?X:!0}try{const te=W(L,e.UnsafeJsonStruct);return te!==!0?te:W(JSON.parse(JSON.stringify(L)),e.UnsafeJsonStruct)}catch(te){return te instanceof RangeError?"Circular reference detected":!1}});function i(L){return(0,t.is)(L,e.JsonStruct)}e.isValidJson=i;function s(L){(0,r.assertStruct)(L,e.JsonStruct,"Invalid JSON value");const F=JSON.stringify(L);return new TextEncoder().encode(F).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function a(L){return(0,t.is)(L,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=a;function l(L,F){(0,r.assertStruct)(L,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",F)}e.assertIsJsonRpcNotification=l;function d(L){return(0,t.is)(L,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=d;function h(L,F){(0,r.assertStruct)(L,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",F)}e.assertIsJsonRpcRequest=h,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function m(L){return(0,t.is)(L,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=m;function R(L,F){(0,r.assertStruct)(L,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",F)}e.assertIsPendingJsonRpcResponse=R;function y(L){return(0,t.is)(L,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=y;function C(L,F){(0,r.assertStruct)(L,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",F)}e.assertIsJsonRpcResponse=C;function x(L){return(0,t.is)(L,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=x;function B(L,F){(0,r.assertStruct)(L,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",F)}e.assertIsJsonRpcSuccess=B;function O(L){return(0,t.is)(L,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=O;function M(L,F){(0,r.assertStruct)(L,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",F)}e.assertIsJsonRpcFailure=M;function T(L){return(0,t.is)(L,e.JsonRpcErrorStruct)}e.isJsonRpcError=T;function N(L,F){(0,r.assertStruct)(L,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",F)}e.assertIsJsonRpcError=N;function D(L){const{permitEmptyString:F,permitFractions:W,permitNull:te}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},L);return z=>!!(typeof z=="number"&&(W||Number.isInteger(z))||typeof z=="string"&&(F||z.length>0)||te&&z===null)}e.getJsonRpcIdValidator=D})(Al);var Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});var Gr={},E1=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createModuleLogger=Gr.createProjectLogger=void 0;const S1=E1(su),R1=(0,S1.default)("metamask");function M1(e){return R1.extend(e)}Gr.createProjectLogger=M1;function k1(e,t){return e.extend(t)}Gr.createModuleLogger=k1;var Nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(h){return Array.isArray(h)&&h.length>0}e.isNonEmptyArray=t;function r(h){return h==null}e.isNullOrUndefined=r;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}e.isObject=n;const i=(h,m)=>Object.hasOwnProperty.call(h,m);e.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"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(h){if(typeof h!="object"||h===null)return!1;try{let m=h;for(;Object.getPrototypeOf(m)!==null;)m=Object.getPrototypeOf(m);return Object.getPrototypeOf(h)===m}catch{return!1}}e.isPlainObject=s;function a(h){return h.charCodeAt(0)<=127}e.isASCII=a;function l(h){var m;return h.split("").reduce((y,C)=>a(C)?y+1:y+2,0)+((m=h.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&m!==void 0?m:[]).length}e.calculateStringSize=l;function d(h){return h.toString().length}e.calculateNumberSize=d})(Nl);var It={};Object.defineProperty(It,"__esModule",{value:!0});It.hexToBigInt=It.hexToNumber=It.bigIntToHex=It.numberToHex=void 0;const jr=Ke,fn=On,C1=e=>((0,jr.assert)(typeof e=="number","Value must be a number."),(0,jr.assert)(e>=0,"Value must be a non-negative number."),(0,jr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,fn.add0x)(e.toString(16)));It.numberToHex=C1;const I1=e=>((0,jr.assert)(typeof e=="bigint","Value must be a bigint."),(0,jr.assert)(e>=0,"Value must be a non-negative bigint."),(0,fn.add0x)(e.toString(16)));It.bigIntToHex=I1;const x1=e=>{(0,fn.assertIsHexString)(e);const t=parseInt(e,16);return(0,jr.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};It.hexToNumber=x1;const A1=e=>((0,fn.assertIsHexString)(e),BigInt((0,fn.add0x)(e)));It.hexToBigInt=A1;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var Ol={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,a)=>{if(!t(s))throw new Error(`"${a}" must be a non-negative integer. Received: "${s}".`)};function n(s,a){return r(s,"count"),s*a}e.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=i})(Ol);var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});var $l={},js={exports:{}};const T1="2.0.0",Bl=256,N1=Number.MAX_SAFE_INTEGER||9007199254740991,L1=16,O1=Bl-6,P1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Hi={MAX_LENGTH:Bl,MAX_SAFE_COMPONENT_LENGTH:L1,MAX_SAFE_BUILD_LENGTH:O1,MAX_SAFE_INTEGER:N1,RELEASE_TYPES:P1,SEMVER_SPEC_VERSION:T1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$1={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},Rs={};const B1=typeof $1=="object"&&Rs&&Rs.NODE_DEBUG&&/\bsemver\b/i.test(Rs.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ui=B1;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hi,s=Ui;t=e.exports={};const a=t.re=[],l=t.safeRe=[],d=t.src=[],h=t.t={};let m=0;const R="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",i],[R,n]],C=B=>{for(const[O,M]of y)B=B.split(`${O}*`).join(`${O}{0,${M}}`).split(`${O}+`).join(`${O}{1,${M}}`);return B},x=(B,O,M)=>{const T=C(O),N=m++;s(B,N,O),h[B]=N,d[N]=O,a[N]=new RegExp(O,M?"g":void 0),l[N]=new RegExp(T,M?"g":void 0)};x("NUMERICIDENTIFIER","0|[1-9]\\d*"),x("NUMERICIDENTIFIERLOOSE","\\d+"),x("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${R}*`),x("MAINVERSION",`(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})`),x("MAINVERSIONLOOSE",`(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})`),x("PRERELEASEIDENTIFIER",`(?:${d[h.NUMERICIDENTIFIER]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASEIDENTIFIERLOOSE",`(?:${d[h.NUMERICIDENTIFIERLOOSE]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASE",`(?:-(${d[h.PRERELEASEIDENTIFIER]}(?:\\.${d[h.PRERELEASEIDENTIFIER]})*))`),x("PRERELEASELOOSE",`(?:-?(${d[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[h.PRERELEASEIDENTIFIERLOOSE]})*))`),x("BUILDIDENTIFIER",`${R}+`),x("BUILD",`(?:\\+(${d[h.BUILDIDENTIFIER]}(?:\\.${d[h.BUILDIDENTIFIER]})*))`),x("FULLPLAIN",`v?${d[h.MAINVERSION]}${d[h.PRERELEASE]}?${d[h.BUILD]}?`),x("FULL",`^${d[h.FULLPLAIN]}$`),x("LOOSEPLAIN",`[v=\\s]*${d[h.MAINVERSIONLOOSE]}${d[h.PRERELEASELOOSE]}?${d[h.BUILD]}?`),x("LOOSE",`^${d[h.LOOSEPLAIN]}$`),x("GTLT","((?:<|>)?=?)"),x("XRANGEIDENTIFIERLOOSE",`${d[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),x("XRANGEIDENTIFIER",`${d[h.NUMERICIDENTIFIER]}|x|X|\\*`),x("XRANGEPLAIN",`[v=\\s]*(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:${d[h.PRERELEASE]})?${d[h.BUILD]}?)?)?`),x("XRANGEPLAINLOOSE",`[v=\\s]*(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:${d[h.PRERELEASELOOSE]})?${d[h.BUILD]}?)?)?`),x("XRANGE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAIN]}$`),x("XRANGELOOSE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAINLOOSE]}$`),x("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),x("COERCE",`${d[h.COERCEPLAIN]}(?:$|[^\\d])`),x("COERCEFULL",d[h.COERCEPLAIN]+`(?:${d[h.PRERELEASE]})?(?:${d[h.BUILD]})?(?:$|[^\\d])`),x("COERCERTL",d[h.COERCE],!0),x("COERCERTLFULL",d[h.COERCEFULL],!0),x("LONETILDE","(?:~>?)"),x("TILDETRIM",`(\\s*)${d[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",x("TILDE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAIN]}$`),x("TILDELOOSE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAINLOOSE]}$`),x("LONECARET","(?:\\^)"),x("CARETTRIM",`(\\s*)${d[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",x("CARET",`^${d[h.LONECARET]}${d[h.XRANGEPLAIN]}$`),x("CARETLOOSE",`^${d[h.LONECARET]}${d[h.XRANGEPLAINLOOSE]}$`),x("COMPARATORLOOSE",`^${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]})$|^$`),x("COMPARATOR",`^${d[h.GTLT]}\\s*(${d[h.FULLPLAIN]})$|^$`),x("COMPARATORTRIM",`(\\s*)${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]}|${d[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",x("HYPHENRANGE",`^\\s*(${d[h.XRANGEPLAIN]})\\s+-\\s+(${d[h.XRANGEPLAIN]})\\s*$`),x("HYPHENRANGELOOSE",`^\\s*(${d[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[h.XRANGEPLAINLOOSE]})\\s*$`),x("STAR","(<|>)?=?\\s*\\*"),x("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),x("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(js,js.exports);var Pn=js.exports;const D1=Object.freeze({loose:!0}),F1=Object.freeze({}),j1=e=>e?typeof e!="object"?D1:e:F1;var ho=j1;const Ra=/^[0-9]+$/,Dl=(e,t)=>{const r=Ra.test(e),n=Ra.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eDl(t,e);var Fl={compareIdentifiers:Dl,rcompareIdentifiers:H1};const qn=Ui,{MAX_LENGTH:Ma,MAX_SAFE_INTEGER:Jn}=Hi,{safeRe:ka,t:Ca}=Pn,U1=ho,{compareIdentifiers:Or}=Fl;let W1=class Et{constructor(t,r){if(r=U1(r),t instanceof Et){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ma)throw new TypeError(`version is longer than ${Ma} characters`);qn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ka[Ca.LOOSE]:ka[Ca.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Jn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Jn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Jn||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]),Or(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var et=W1;const Ia=et,V1=(e,t,r=!1)=>{if(e instanceof Ia)return e;try{return new Ia(e,t)}catch(n){if(!r)return null;throw n}};var sn=V1;const z1=sn,q1=(e,t)=>{const r=z1(e,t);return r?r.version:null};var J1=q1;const G1=sn,Z1=(e,t)=>{const r=G1(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var K1=Z1;const xa=et,Q1=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new xa(e instanceof xa?e.version:e,r).inc(t,n,i).version}catch{return null}};var Y1=Q1;const Aa=sn,X1=(e,t)=>{const r=Aa(e,null,!0),n=Aa(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,a=s?r:n,l=s?n:r,d=!!a.prerelease.length;if(!!l.prerelease.length&&!d)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const m=d?"pre":"";return r.major!==n.major?m+"major":r.minor!==n.minor?m+"minor":r.patch!==n.patch?m+"patch":"prerelease"};var ep=X1;const tp=et,rp=(e,t)=>new tp(e,t).major;var np=rp;const ip=et,sp=(e,t)=>new ip(e,t).minor;var op=sp;const ap=et,cp=(e,t)=>new ap(e,t).patch;var lp=cp;const up=sn,hp=(e,t)=>{const r=up(e,t);return r&&r.prerelease.length?r.prerelease:null};var dp=hp;const Ta=et,fp=(e,t,r)=>new Ta(e,r).compare(new Ta(t,r));var bt=fp;const pp=bt,gp=(e,t,r)=>pp(t,e,r);var mp=gp;const vp=bt,bp=(e,t)=>vp(e,t,!0);var wp=bp;const Na=et,_p=(e,t,r)=>{const n=new Na(e,r),i=new Na(t,r);return n.compare(i)||n.compareBuild(i)};var fo=_p;const yp=fo,Ep=(e,t)=>e.sort((r,n)=>yp(r,n,t));var Sp=Ep;const Rp=fo,Mp=(e,t)=>e.sort((r,n)=>Rp(n,r,t));var kp=Mp;const Cp=bt,Ip=(e,t,r)=>Cp(e,t,r)>0;var Wi=Ip;const xp=bt,Ap=(e,t,r)=>xp(e,t,r)<0;var po=Ap;const Tp=bt,Np=(e,t,r)=>Tp(e,t,r)===0;var jl=Np;const Lp=bt,Op=(e,t,r)=>Lp(e,t,r)!==0;var Hl=Op;const Pp=bt,$p=(e,t,r)=>Pp(e,t,r)>=0;var go=$p;const Bp=bt,Dp=(e,t,r)=>Bp(e,t,r)<=0;var mo=Dp;const Fp=jl,jp=Hl,Hp=Wi,Up=go,Wp=po,Vp=mo,zp=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Fp(e,r,n);case"!=":return jp(e,r,n);case">":return Hp(e,r,n);case">=":return Up(e,r,n);case"<":return Wp(e,r,n);case"<=":return Vp(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Ul=zp;const qp=et,Jp=sn,{safeRe:Gn,t:Zn}=Pn,Gp=(e,t)=>{if(e instanceof qp)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Gn[Zn.COERCEFULL]:Gn[Zn.COERCE]);else{const d=t.includePrerelease?Gn[Zn.COERCERTLFULL]:Gn[Zn.COERCERTL];let h;for(;(h=d.exec(e))&&(!r||r.index+r[0].length!==e.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",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",l=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jp(`${n}.${i}.${s}${a}${l}`,t)};var Zp=Gp;class Kp{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var Qp=Kp,Ms,La;function wt(){if(La)return Ms;La=1;const e=/\s+/g;class t{constructor(u,f){if(f=i(f),u instanceof t)return u.loose===!!f.loose&&u.includePrerelease===!!f.includePrerelease?u:new t(u.raw,f);if(u instanceof s)return this.raw=u.value,this.set=[[u]],this.formatted=void 0,this;if(this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease,this.raw=u.trim().replace(e," "),this.set=this.raw.split("||").map(p=>this.parseRange(p.trim())).filter(p=>p.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const p=this.set[0];if(this.set=this.set.filter(v=>!B(v[0])),this.set.length===0)this.set=[p];else if(this.set.length>1){for(const v of this.set)if(v.length===1&&O(v[0])){this.set=[v];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let u=0;u0&&(this.formatted+="||");const f=this.set[u];for(let p=0;p0&&(this.formatted+=" "),this.formatted+=f[p].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(u){const p=((this.options.includePrerelease&&C)|(this.options.loose&&x))+":"+u,v=n.get(p);if(v)return v;const E=this.options.loose,k=E?d[h.HYPHENRANGELOOSE]:d[h.HYPHENRANGE];u=u.replace(k,ne(this.options.includePrerelease)),a("hyphen replace",u),u=u.replace(d[h.COMPARATORTRIM],m),a("comparator trim",u),u=u.replace(d[h.TILDETRIM],R),a("tilde trim",u),u=u.replace(d[h.CARETTRIM],y),a("caret trim",u);let g=u.split(" ").map(H=>T(H,this.options)).join(" ").split(/\s+/).map(H=>X(H,this.options));E&&(g=g.filter(H=>(a("loose invalid filter",H,this.options),!!H.match(d[h.COMPARATORLOOSE])))),a("range list",g);const c=new Map,w=g.map(H=>new s(H,this.options));for(const H of w){if(B(H))return[H];c.set(H.value,H)}c.size>1&&c.has("")&&c.delete("");const U=[...c.values()];return n.set(p,U),U}intersects(u,f){if(!(u instanceof t))throw new TypeError("a Range is required");return this.set.some(p=>M(p,f)&&u.set.some(v=>M(v,f)&&p.every(E=>v.every(k=>E.intersects(k,f)))))}test(u){if(!u)return!1;if(typeof u=="string")try{u=new l(u,this.options)}catch{return!1}for(let f=0;fo.value==="<0.0.0-0",O=o=>o.value==="",M=(o,u)=>{let f=!0;const p=o.slice();let v=p.pop();for(;f&&p.length;)f=p.every(E=>v.intersects(E,u)),v=p.pop();return f},T=(o,u)=>(a("comp",o,u),o=F(o,u),a("caret",o),o=D(o,u),a("tildes",o),o=te(o,u),a("xrange",o),o=z(o,u),a("stars",o),o),N=o=>!o||o.toLowerCase()==="x"||o==="*",D=(o,u)=>o.trim().split(/\s+/).map(f=>L(f,u)).join(" "),L=(o,u)=>{const f=u.loose?d[h.TILDELOOSE]:d[h.TILDE];return o.replace(f,(p,v,E,k,g)=>{a("tilde",o,p,v,E,k,g);let c;return N(v)?c="":N(E)?c=`>=${v}.0.0 <${+v+1}.0.0-0`:N(k)?c=`>=${v}.${E}.0 <${v}.${+E+1}.0-0`:g?(a("replaceTilde pr",g),c=`>=${v}.${E}.${k}-${g} <${v}.${+E+1}.0-0`):c=`>=${v}.${E}.${k} <${v}.${+E+1}.0-0`,a("tilde return",c),c})},F=(o,u)=>o.trim().split(/\s+/).map(f=>W(f,u)).join(" "),W=(o,u)=>{a("caret",o,u);const f=u.loose?d[h.CARETLOOSE]:d[h.CARET],p=u.includePrerelease?"-0":"";return o.replace(f,(v,E,k,g,c)=>{a("caret",o,v,E,k,g,c);let w;return N(E)?w="":N(k)?w=`>=${E}.0.0${p} <${+E+1}.0.0-0`:N(g)?E==="0"?w=`>=${E}.${k}.0${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.0${p} <${+E+1}.0.0-0`:c?(a("replaceCaret pr",c),E==="0"?k==="0"?w=`>=${E}.${k}.${g}-${c} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}-${c} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g}-${c} <${+E+1}.0.0-0`):(a("no pr"),E==="0"?k==="0"?w=`>=${E}.${k}.${g}${p} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g} <${+E+1}.0.0-0`),a("caret return",w),w})},te=(o,u)=>(a("replaceXRanges",o,u),o.split(/\s+/).map(f=>Z(f,u)).join(" ")),Z=(o,u)=>{o=o.trim();const f=u.loose?d[h.XRANGELOOSE]:d[h.XRANGE];return o.replace(f,(p,v,E,k,g,c)=>{a("xRange",o,p,v,E,k,g,c);const w=N(E),U=w||N(k),H=U||N(g),V=H;return v==="="&&V&&(v=""),c=u.includePrerelease?"-0":"",w?v===">"||v==="<"?p="<0.0.0-0":p="*":v&&V?(U&&(k=0),g=0,v===">"?(v=">=",U?(E=+E+1,k=0,g=0):(k=+k+1,g=0)):v==="<="&&(v="<",U?E=+E+1:k=+k+1),v==="<"&&(c="-0"),p=`${v+E}.${k}.${g}${c}`):U?p=`>=${E}.0.0${c} <${+E+1}.0.0-0`:H&&(p=`>=${E}.${k}.0${c} <${E}.${+k+1}.0-0`),a("xRange return",p),p})},z=(o,u)=>(a("replaceStars",o,u),o.trim().replace(d[h.STAR],"")),X=(o,u)=>(a("replaceGTE0",o,u),o.trim().replace(d[u.includePrerelease?h.GTE0PRE:h.GTE0],"")),ne=o=>(u,f,p,v,E,k,g,c,w,U,H,V)=>(N(p)?f="":N(v)?f=`>=${p}.0.0${o?"-0":""}`:N(E)?f=`>=${p}.${v}.0${o?"-0":""}`:k?f=`>=${f}`:f=`>=${f}${o?"-0":""}`,N(w)?c="":N(U)?c=`<${+w+1}.0.0-0`:N(H)?c=`<${w}.${+U+1}.0-0`:V?c=`<=${w}.${U}.${H}-${V}`:o?c=`<${w}.${U}.${+H+1}-0`:c=`<=${c}`,`${f} ${c}`.trim()),S=(o,u,f)=>{for(let p=0;p0){const v=o[p].semver;if(v.major===u.major&&v.minor===u.minor&&v.patch===u.patch)return!0}return!1}return!0};return Ms}var ks,Oa;function Vi(){if(Oa)return ks;Oa=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(m,R){if(R=r(R),m instanceof t){if(m.loose===!!R.loose)return m;m=m.value}m=m.trim().split(/\s+/).join(" "),a("comparator",m,R),this.options=R,this.loose=!!R.loose,this.parse(m),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(m){const R=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],y=m.match(R);if(!y)throw new TypeError(`Invalid comparator: ${m}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new l(y[2],this.options.loose):this.semver=e}toString(){return this.value}test(m){if(a("Comparator.test",m,this.options.loose),this.semver===e||m===e)return!0;if(typeof m=="string")try{m=new l(m,this.options)}catch{return!1}return s(m,this.operator,this.semver,this.options)}intersects(m,R){if(!(m instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(m.value,R).test(this.value):m.operator===""?m.value===""?!0:new d(this.value,R).test(m.semver):(R=r(R),R.includePrerelease&&(this.value==="<0.0.0-0"||m.value==="<0.0.0-0")||!R.includePrerelease&&(this.value.startsWith("<0.0.0")||m.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&m.operator.startsWith(">")||this.operator.startsWith("<")&&m.operator.startsWith("<")||this.semver.version===m.semver.version&&this.operator.includes("=")&&m.operator.includes("=")||s(this.semver,"<",m.semver,R)&&this.operator.startsWith(">")&&m.operator.startsWith("<")||s(this.semver,">",m.semver,R)&&this.operator.startsWith("<")&&m.operator.startsWith(">")))}}ks=t;const r=ho,{safeRe:n,t:i}=Pn,s=Ul,a=Ui,l=et,d=wt();return ks}const Yp=wt(),Xp=(e,t,r)=>{try{t=new Yp(t,r)}catch{return!1}return t.test(e)};var zi=Xp;const eg=wt(),tg=(e,t)=>new eg(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var rg=tg;const ng=et,ig=wt(),sg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new ig(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===-1)&&(n=a,i=new ng(n,r))}),n};var og=sg;const ag=et,cg=wt(),lg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new cg(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===1)&&(n=a,i=new ag(n,r))}),n};var ug=lg;const Cs=et,hg=wt(),Pa=Wi,dg=(e,t)=>{e=new hg(e,t);let r=new Cs("0.0.0");if(e.test(r)||(r=new Cs("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const l=new Cs(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Pa(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Pa(r,s))&&(r=s)}return r&&e.test(r)?r:null};var fg=dg;const pg=wt(),gg=(e,t)=>{try{return new pg(e,t).range||"*"}catch{return null}};var mg=gg;const vg=et,Wl=Vi(),{ANY:bg}=Wl,wg=wt(),_g=zi,$a=Wi,Ba=po,yg=mo,Eg=go,Sg=(e,t,r,n)=>{e=new vg(e,n),t=new wg(t,n);let i,s,a,l,d;switch(r){case">":i=$a,s=yg,a=Ba,l=">",d=">=";break;case"<":i=Ba,s=Eg,a=$a,l="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(_g(e,t,n))return!1;for(let h=0;h{C.semver===bg&&(C=new Wl(">=0.0.0")),R=R||C,y=y||C,i(C.semver,R.semver,n)?R=C:a(C.semver,y.semver,n)&&(y=C)}),R.operator===l||R.operator===d||(!y.operator||y.operator===l)&&s(e,y.semver))return!1;if(y.operator===d&&a(e,y.semver))return!1}return!0};var vo=Sg;const Rg=vo,Mg=(e,t,r)=>Rg(e,t,">",r);var kg=Mg;const Cg=vo,Ig=(e,t,r)=>Cg(e,t,"<",r);var xg=Ig;const Da=wt(),Ag=(e,t,r)=>(e=new Da(e,r),t=new Da(t,r),e.intersects(t,r));var Tg=Ag;const Ng=zi,Lg=bt;var Og=(e,t,r)=>{const n=[];let i=null,s=null;const a=e.sort((m,R)=>Lg(m,R,r));for(const m of a)Ng(m,t,r)?(s=m,i||(i=m)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const l=[];for(const[m,R]of n)m===R?l.push(m):!R&&m===a[0]?l.push("*"):R?m===a[0]?l.push(`<=${R}`):l.push(`${m} - ${R}`):l.push(`>=${m}`);const d=l.join(" || "),h=typeof t.raw=="string"?t.raw:String(t);return d.length{if(e===t)return!0;e=new Fa(e,r),t=new Fa(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const a=Bg(i,s,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},$g=[new bo(">=0.0.0-0")],ja=[new bo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Is){if(t.length===1&&t[0].semver===Is)return!0;r.includePrerelease?e=$g:e=ja}if(t.length===1&&t[0].semver===Is){if(r.includePrerelease)return!0;t=ja}const n=new Set;let i,s;for(const C of e)C.operator===">"||C.operator===">="?i=Ha(i,C,r):C.operator==="<"||C.operator==="<="?s=Ua(s,C,r):n.add(C.semver);if(n.size>1)return null;let a;if(i&&s){if(a=wo(i.semver,s.semver,r),a>0)return null;if(a===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const C of n){if(i&&!an(C,String(i),r)||s&&!an(C,String(s),r))return null;for(const x of t)if(!an(C,String(x),r))return!1;return!0}let l,d,h,m,R=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;R&&R.prerelease.length===1&&s.operator==="<"&&R.prerelease[0]===0&&(R=!1);for(const C of t){if(m=m||C.operator===">"||C.operator===">=",h=h||C.operator==="<"||C.operator==="<=",i){if(y&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===y.major&&C.semver.minor===y.minor&&C.semver.patch===y.patch&&(y=!1),C.operator===">"||C.operator===">="){if(l=Ha(i,C,r),l===C&&l!==i)return!1}else if(i.operator===">="&&!an(i.semver,String(C),r))return!1}if(s){if(R&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===R.major&&C.semver.minor===R.minor&&C.semver.patch===R.patch&&(R=!1),C.operator==="<"||C.operator==="<="){if(d=Ua(s,C,r),d===C&&d!==s)return!1}else if(s.operator==="<="&&!an(s.semver,String(C),r))return!1}if(!C.operator&&(s||i)&&a!==0)return!1}return!(i&&h&&!s&&a!==0||s&&m&&!i&&a!==0||y||R)},Ha=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Ua=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var Dg=Pg;const xs=Pn,Wa=Hi,Fg=et,Va=Fl,jg=sn,Hg=J1,Ug=K1,Wg=Y1,Vg=ep,zg=np,qg=op,Jg=lp,Gg=dp,Zg=bt,Kg=mp,Qg=wp,Yg=fo,Xg=Sp,em=kp,tm=Wi,rm=po,nm=jl,im=Hl,sm=go,om=mo,am=Ul,cm=Zp,lm=Vi(),um=wt(),hm=zi,dm=rg,fm=og,pm=ug,gm=fg,mm=mg,vm=vo,bm=kg,wm=xg,_m=Tg,ym=Og,Em=Dg;var Sm={parse:jg,valid:Hg,clean:Ug,inc:Wg,diff:Vg,major:zg,minor:qg,patch:Jg,prerelease:Gg,compare:Zg,rcompare:Kg,compareLoose:Qg,compareBuild:Yg,sort:Xg,rsort:em,gt:tm,lt:rm,eq:nm,neq:im,gte:sm,lte:om,cmp:am,coerce:cm,Comparator:lm,Range:um,satisfies:hm,toComparators:dm,maxSatisfying:fm,minSatisfying:pm,minVersion:gm,validRange:mm,outside:vm,gtr:bm,ltr:wm,intersects:_m,simplifyRange:ym,subset:Em,SemVer:Fg,re:xs.re,src:xs.src,tokens:xs.t,SEMVER_SPEC_VERSION:Wa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=Sm,r=br,n=Ke;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",R=>(0,t.valid)(R)===null?`Expected SemVer version, got "${R}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",R=>(0,t.validRange)(R)===null?`Expected SemVer range, got "${R}"`:!0);function i(R){return(0,r.is)(R,e.VersionStruct)}e.isValidSemVerVersion=i;function s(R){return(0,r.is)(R,e.VersionRangeStruct)}e.isValidSemVerRange=s;function a(R){(0,n.assertStruct)(R,e.VersionStruct)}e.assertIsSemVerVersion=a;function l(R){(0,n.assertStruct)(R,e.VersionRangeStruct)}e.assertIsSemVerRange=l;function d(R,y){return(0,t.gt)(R,y)}e.gtVersion=d;function h(R,y){return(0,t.gtr)(R,y)}e.gtRange=h;function m(R,y){return(0,t.satisfies)(R,y,{includePrerelease:!0})}e.satisfiesVersionRange=m})($l);(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ke,e),r(Ln,e),r(ae,e),r(Fi,e),r(Ct,e),r(Jr,e),r(xl,e),r(On,e),r(Al,e),r(Tl,e),r(Gr,e),r(Nl,e),r(It,e),r(Ll,e),r(Ol,e),r(Pl,e),r($l,e)})(ul);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ul;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")})(ll);var Vl=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.PollingBlockTracker=void 0;const Rm=Vl(ro),Mm=Vl(Xf),km=xn,za=ll,qa=(0,za.createModuleLogger)(za.projectLogger,"polling-block-tracker"),Cm=(0,Rm.default)(),Im=1e3;class xm extends km.BaseBlockTracker{constructor(t={}){var r;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(r=t.blockResetDuration)!==null&&r!==void 0?r:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*Im,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const r=Ja(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: ${(t=r.stack)!==null&&t!==void 0?t:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Ja(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:Cm(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),qa("Making request",t);const r=await(0,Mm.default)(n=>this._provider.sendAsync(t,n))();if(qa("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: ${r.error.message}`);return r.result}}Bi.PollingBlockTracker=xm;function Ja(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}var qi={},Am=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});qi.SubscribeBlockTracker=void 0;const Tm=Am(ro),Nm=xn,Lm=(0,Tm.default)();class Om extends Nm.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:Lm(),method:t,params:r,jsonrpc:"2.0"},(s,a)=>{s?i(s):n(a.result)})})}_handleSubData(t,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}qi.SubscribeBlockTracker=Om;(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Bi,e),r(qi,e)})(cl);var _o={},Ji={},$n={};Object.defineProperty($n,"__esModule",{value:!0});$n.getUniqueId=void 0;const zl=4294967295;let As=Math.floor(Math.random()*zl);function Pm(){return As=(As+1)%zl,As}$n.getUniqueId=Pm;Object.defineProperty(Ji,"__esModule",{value:!0});Ji.createIdRemapMiddleware=void 0;const $m=$n;function Bm(){return(e,t,r,n)=>{const i=e.id,s=$m.getUniqueId();e.id=s,t.id=s,r(a=>{e.id=i,t.id=i,a()})}}Ji.createIdRemapMiddleware=Bm;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.createAsyncMiddleware=void 0;function Dm(e){return async(t,r,n,i)=>{let s;const a=new Promise(m=>{s=m});let l=null,d=!1;const h=async()=>{d=!0,n(m=>{l=m,s()}),await a};try{await e(t,r,h),d?(await a,l(null)):i(null)}catch(m){l?l(m):i(m)}}}Gi.createAsyncMiddleware=Dm;var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.createScaffoldMiddleware=void 0;function Fm(e){return(t,r,n,i)=>{const s=e[t.method];return s===void 0?n():typeof s=="function"?s(t,r,n,i):(r.result=s,i())}}Zi.createScaffoldMiddleware=Fm;var Bn={},yo={};Object.defineProperty(yo,"__esModule",{value:!0});const jm=si;function Ga(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function Hm(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Ga(s,this,r);else{const a=s.length,l=Hm(s);for(let d=0;d"u"&&(n=Gl()),Hs(e,"",0,[],void 0,0,n);var i;try{ur.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var s=fr.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hr(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),fr.push([n,r,t,i])):ur.push([t,r,e]):(n[r]=e,fr.push([n,r,t]))}function Hs(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;lt?1:0}function Zl(e,t,r,n){typeof n>"u"&&(n=Gl());var i=Us(e,"",0,[],void 0,0,n)||e,s;try{ur.length===0?s=JSON.stringify(i,t,r):s=JSON.stringify(i,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var a=fr.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function Us(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;l0)for(var n=0;n=1e3&&e<=4999}function Gm(e,t){if(t!=="[Circular]")return t}var Eo={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.errorValues=Ft.errorCodes=void 0;Ft.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}};Ft.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Ft,r=Dt,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:a(n)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function a(y,C=i){if(Number.isInteger(y)){const x=y.toString();if(R(t.errorValues,x))return t.errorValues[x].message;if(h(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=a;function l(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||h(y))}e.isValidCode=l;function d(y,{fallbackError:C=s,shouldIncludeStack:x=!1}={}){var B,O;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const M={};if(y&&typeof y=="object"&&!Array.isArray(y)&&R(y,"code")&&l(y.code)){const N=y;M.code=N.code,N.message&&typeof N.message=="string"?(M.message=N.message,R(N,"data")&&(M.data=N.data)):(M.message=a(M.code),M.data={originalError:m(y)})}else{M.code=C.code;const N=(B=y)===null||B===void 0?void 0:B.message;M.message=N&&typeof N=="string"?N:C.message,M.data={originalError:m(y)}}const T=(O=y)===null||O===void 0?void 0:O.stack;return x&&y&&T&&typeof T=="string"&&(M.stack=T),M}e.serializeError=d;function h(y){return y>=-32099&&y<=-32e3}function m(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function R(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(Eo);var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ethErrors=void 0;const So=Dt,Yl=Eo,Qe=Ft;Ki.ethErrors={rpc:{parse:e=>lt(Qe.errorCodes.rpc.parse,e),invalidRequest:e=>lt(Qe.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lt(Qe.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lt(Qe.errorCodes.rpc.methodNotFound,e),internal:e=>lt(Qe.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return lt(t,e)},invalidInput:e=>lt(Qe.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lt(Qe.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lt(Qe.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lt(Qe.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lt(Qe.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lt(Qe.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cn(Qe.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cn(Qe.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cn(Qe.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cn(Qe.errorCodes.provider.disconnected,e),chainDisconnected:e=>cn(Qe.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new So.EthereumProviderError(t,r,n)}}};function lt(e,t){const[r,n]=Xl(t);return new So.EthereumRpcError(e,r||Yl.getMessageFromCode(e),n)}function cn(e,t){const[r,n]=Xl(t);return new So.EthereumProviderError(e,r||Yl.getMessageFromCode(e),n)}function Xl(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dt;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Eo;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ki;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Ft;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(ql);var Zm=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.JsonRpcEngine=void 0;const Km=Zm(yo),ut=ql;class At extends Km.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,n,i)=>{try{const[s,a,l]=await At._runAllMiddleware(t,r,this._middleware);return a?(await At._runReturnHandlers(l),i(s)):n(async d=>{try{await At._runReturnHandlers(l)}catch(h){return d(h)}return d()})}catch(s){return i(s)}}}async _handleBatch(t,r){try{const n=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(n,i)=>{r(i)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return r(a,{id:void 0,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return r(a,{id:t.id,jsonrpc:"2.0",error:a})}const n=Object.assign({},t),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(a){s=a}return s&&(delete i.result,i.error||(i.error=ut.serializeError(s))),r(s,i)}async _processRequest(t,r){const[n,i,s]=await At._runAllMiddleware(t,r,this._middleware);if(At._checkForCompletion(t,r,i),await At._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(t,r,n){const i=[];let s=null,a=!1;for(const l of n)if([s,a]=await At._runMiddleware(t,r,l,i),a)break;return[s,a,i.reverse()]}static _runMiddleware(t,r,n,i){return new Promise(s=>{const a=d=>{const h=d||r.error;h&&(r.error=ut.serializeError(h)),s([h,!0])},l=d=>{r.error?a(r.error):(d&&(typeof d!="function"&&a(new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof d}" for request: diff --git a/buddybook/assets/index-Ctx71FWU.js b/buddybook/assets/index-Ctx71FWU.js deleted file mode 100644 index 6c00c3c..0000000 --- a/buddybook/assets/index-Ctx71FWU.js +++ /dev/null @@ -1,2 +0,0 @@ -import{B as k,k as m,c as q,e as F,t as $,n as Ye,i as Ze,I as xe,s as B,a as et,b as G,d as tt,f as p,g as W}from"./index-BpI4vT-j.js";const nt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,st=/^(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)?$/;class it extends k{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class at extends k{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function ct(e){const{domain:t={},message:n,primaryType:s}=e,r={EIP712Domain:lt({domain:t}),...e.types};dt({domain:t,message:n,primaryType:s,types:r});const i=["0x1901"];return t&&i.push(rt({domain:t,types:r})),s!=="EIP712Domain"&&i.push(K({data:n,primaryType:s,types:r})),m(q(i))}function rt({domain:e,types:t}){return K({data:e,primaryType:"EIP712Domain",types:t})}function K({data:e,primaryType:t,types:n}){const s=X({data:e,primaryType:t,types:n});return m(s)}function X({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],r=[ot({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=z({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),r.push(l)}return F(s,r)}function ot({primaryType:e,types:t}){const n=$(ut({primaryType:e,types:t}));return m(n)}function ut({primaryType:e,types:t}){let n="";const s=Q({primaryType:e,types:t});s.delete(e);const r=[e,...Array.from(s).sort()];for(const i of r)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function Q({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),r=s==null?void 0:s[0];if(n.has(r)||t[r]===void 0)return n;n.add(r);for(const i of t[r])Q({primaryType:i.type,types:t},n);return n}function z({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},m(X({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},m(s)];if(n==="string")return[{type:"bytes32"},m($(s))];if(n.lastIndexOf("]")===n.length-1){const r=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>z({name:t,type:r,types:e,value:u}));return[{type:"bytes32"},m(F(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function dt(e){const{domain:t,message:n,primaryType:s,types:r}=e,i=(u,l)=>{for(const g of u){const{name:v,type:f}=g,h=l[v],N=f.match(st);if(N&&(typeof h=="number"||typeof h=="bigint")){const[M,S,L]=N;Ye(h,{signed:S==="int",size:Number.parseInt(L)/8})}if(f==="address"&&typeof h=="string"&&!Ze(h))throw new xe({address:h});const C=f.match(nt);if(C){const[M,S]=C;if(S&&B(h)!==Number.parseInt(S))throw new et({expectedSize:Number.parseInt(S),givenSize:B(h)})}const D=r[f];D&&(ft(f),i(D,h))}};if(r.EIP712Domain&&t&&i(r.EIP712Domain,t),s!=="EIP712Domain")if(r[s])i(r[s],n);else throw new it({primaryType:s,types:r})}function lt({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)}function ft(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new at({type:e})}const gt=`Ethereum Signed Message: -`;function ht(e){const t=typeof e=="string"?G(e):typeof e.raw=="string"?e.raw:tt(e.raw),n=G(`${gt}${B(t)}`);return q([n,t])}function Et(e,t){return m(ht(e),t)}const yt=()=>"9.1.0",_t=e=>e.toString(16).padStart(2,"0"),Tt=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,_t).join("")},vt=()=>typeof window<"u"?Tt(10):new Date().getTime().toString(36);class w{}w.makeRequest=(e,t)=>({id:vt(),method:e,params:t,env:{sdkVersion:yt()}});w.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t});w.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});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 It{constructor(t=null,n=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:r,source:i})=>{const u=!r,l=!this.isServer&&i===window.parent,g=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),v=typeof g=="number"&&g>=1;let f=!0;return Array.isArray(this.allowedOrigins)&&(f=this.allowedOrigins.find(h=>h.test(s))!==void 0),!u&&l&&v&&f},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:r}=s,i=this.callbacks.get(r);i&&(i(s),this.callbacks.delete(r))},this.send=(s,r)=>{const i=w.makeRequest(s,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((u,l)=>{this.callbacks.set(i.id,g=>{if(!g.success){l(new Error(g.error));return}u(g)})})},this.allowedOrigins=t,this.debugMode=n,this.isServer||window.addEventListener("message",this.onParentMessage)}}const J=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var At={},_={},T={},j=p&&p.__awaiter||function(e,t,n,s){function r(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function l(f){try{v(s.next(f))}catch(h){u(h)}}function g(f){try{v(s.throw(f))}catch(h){u(h)}}function v(f){f.done?i(f.value):r(f.value).then(l,g)}v((s=s.apply(e,t||[])).next())})};Object.defineProperty(T,"__esModule",{value:!0});T.getData=T.fetchData=T.stringifyQuery=T.insertParams=void 0;const mt=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function St(e,t,n){return e.replace(new RegExp(`\\{${t}\\}`,"g"),n)}function Ot(e,t){return t?Object.keys(t).reduce((n,s)=>St(n,s,String(t[s])),e):e}T.insertParams=Ot;function pt(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach(s=>{e[s]!=null&&t.append(s,String(e[s]))});const n=t.toString();return n?`?${n}`:""}T.stringifyQuery=pt;function Y(e){return j(this,void 0,void 0,function*(){let t;try{t=yield e.json()}catch{t={}}if(!e.ok){const n=mt(t)?`CGW error - ${t.code}: ${t.message}`:`CGW error - status ${e.statusText}`;throw new Error(n)}return t})}function bt(e,t,n,s,r){return j(this,void 0,void 0,function*(){const i=Object.assign({"Content-Type":"application/json"},s),u={method:t??"POST",headers:i};r&&(u.credentials=r),n!=null&&(u.body=typeof n=="string"?n:JSON.stringify(n));const l=yield fetch(e,u);return Y(l)})}T.fetchData=bt;function Nt(e,t,n){return j(this,void 0,void 0,function*(){const s={method:"GET"};t&&(s.headers=Object.assign(Object.assign({},t),{"Content-Type":"application/json"})),n&&(s.credentials=n);const r=yield fetch(e,s);return Y(r)})}T.getData=Nt;Object.defineProperty(_,"__esModule",{value:!0});_.getEndpoint=_.deleteEndpoint=_.putEndpoint=_.postEndpoint=void 0;const O=T;function P(e,t,n,s){const r=(0,O.insertParams)(t,n),i=(0,O.stringifyQuery)(s);return`${e}${r}${i}`}function Ct(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"POST",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.postEndpoint=Ct;function Dt(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"PUT",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.putEndpoint=Dt;function wt(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"DELETE",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.deleteEndpoint=wt;function Pt(e,t,n,s){if(s)return(0,O.getData)(s,void 0,n==null?void 0:n.credentials);const r=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.getData)(r,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.getEndpoint=Pt;var R={};Object.defineProperty(R,"__esModule",{value:!0});R.DEFAULT_BASE_URL=void 0;R.DEFAULT_BASE_URL="https://safe-client.safe.global";var Z={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(t){t.UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(Z);var x={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(t){t.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(t){t.TWITTER="TWITTER",t.GITHUB="GITHUB",t.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(x);var ee={};(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(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(t){t.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",t.ADD_OWNER="ADD_OWNER",t.REMOVE_OWNER="REMOVE_OWNER",t.SWAP_OWNER="SWAP_OWNER",t.CHANGE_THRESHOLD="CHANGE_THRESHOLD",t.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",t.ENABLE_MODULE="ENABLE_MODULE",t.DISABLE_MODULE="DISABLE_MODULE",t.SET_GUARD="SET_GUARD",t.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(t){t.TRANSFER="Transfer",t.SETTINGS_CHANGE="SettingsChange",t.CUSTOM="Custom",t.CREATION="Creation",t.SWAP_ORDER="SwapOrder",t.TWAP_ORDER="TwapOrder",t.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(t){t.NONE="None",t.HAS_NEXT="HasNext",t.END="End"}(e.ConflictType||(e.ConflictType={})),function(t){t.TRANSACTION="TRANSACTION",t.LABEL="LABEL",t.CONFLICT_HEADER="CONFLICT_HEADER",t.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(t){t.MULTISIG="MULTISIG",t.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(t){t.AUTO="AUTO",t.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(t){t.AT_MINING_TIME="AT_MINING_TIME",t.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(t){t.Queued="Queued",t.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(ee);var te={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.FIXED_1559="FIXED1559",t.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",t.TX_SIMULATION="TX_SIMULATION",t.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(te);var ne={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ne);var se={};Object.defineProperty(se,"__esModule",{value:!0});var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(t){t.COW_SWAP_ORDER="COW_SWAP_ORDER",t.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(t){t.DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(t){t.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",t.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(ae);var ce={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(t){t.ANDROID="ANDROID",t.IOS="IOS",t.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(ce);var re={};Object.defineProperty(re,"__esModule",{value:!0});(function(e){var t=p&&p.__createBinding||(Object.create?function(a,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(a,d,A)}:function(a,c,o,d){d===void 0&&(d=o),a[d]=c[o]}),n=p&&p.__exportStar||function(a,c){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(c,o)&&t(c,a,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 s=_,r=R;n(Z,e),n(x,e),n(ee,e),n(te,e),n(ne,e),n(se,e),n(ie,e),n(ae,e),n(ce,e),n(re,e);let i=r.DEFAULT_BASE_URL;const u=a=>{i=a};e.setBaseUrl=u;function l(a,c){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:c})}e.relayTransaction=l;function g(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:c}})}e.getRelayCount=g;function v(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:c}})}e.getSafeInfo=v;function f(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:c},query:o},d)}e.getIncomingTransfers=f;function h(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getModuleTransactions=h;function N(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getMultisigTransactions=N;function C(a,c,o="usd",d={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:c,currency:o},query:d})}e.getBalances=C;function D(){return(0,s.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=D;function M(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:c}})}e.getOwnedSafes=M;function S(a){return(0,s.getEndpoint)(i,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=S;function L(a,c,o={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o})}e.getCollectibles=L;function de(a,c,o={},d){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o},d)}e.getCollectiblesPage=de;function le(a,c,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionHistory=le;function fe(a,c,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionQueue=fe;function ge(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:c}})}e.getTransactionDetails=ge;function he(a,c,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:c},body:{signature:o}})}e.deleteTransaction=he;function Ee(a,c,o){return(0,s.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:c},body:o})}e.postSafeGasEstimation=Ee;function ye(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:c}})}e.getNonces=ye;function _e(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:c},body:o})}e.proposeTransaction=_e;function Te(a,c,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:c},body:{data:o,to:d}})}e.getConfirmationView=Te;function ve(a){return(0,s.getEndpoint)(i,"/v1/chains",{query:a})}e.getChainsConfig=ve;function Ie(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=Ie;function Ae(a,c={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:c})}e.getSafeApps=Ae;function me(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=me;function Se(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:c,to:o}})}e.getDecodedData=Se;function Oe(a,c,o){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},query:{}},o)}e.getSafeMessages=Oe;function pe(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:c}})}e.getSafeMessage=pe;function be(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},body:o})}e.proposeSafeMessage=be;function Ne(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:c},body:o})}e.confirmSafeMessage=Ne;function Ce(a,c={}){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:c})}e.getDelegates=Ce;function De(a){return(0,s.postEndpoint)(i,"/v1/register/notifications",{body:a})}e.registerDevice=De;function we(a,c,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:c,uuid:o}})}e.unregisterSafe=we;function Pe(a,c){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:c}})}e.unregisterDevice=Pe;function Re(a,c,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:c},body:o,headers:d})}e.registerEmail=Re;function Me(a,c,o,d,A){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},body:d,headers:A})}e.changeEmail=Me;function Le(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:c,signer:o},body:""})}e.resendEmailVerificationCode=Le;function Be(a,c,o,d){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:c,signer:o},body:d})}e.verifyEmail=Be;function He(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.getRegisteredEmail=He;function Ue(a,c,o,d){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.deleteRegisteredEmail=Ue;function je(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:c},body:o})}e.registerRecoveryModule=je;function Ge(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=Ge;function We(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=We;function Ve(a,c){return(0,s.getEndpoint)(i,"/v1/safes",{query:Object.assign(Object.assign({},c),{safes:a.join(",")})})}e.getSafeOverviews=Ve;function ke(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:c}})}e.getContract=ke;function qe(){return(0,s.getEndpoint)(i,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=qe;function Fe(a){return(0,s.postEndpoint)(i,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Fe;function $e(a){return(0,s.postEndpoint)(i,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=$e;function Ke(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Ke;function Xe(a){return(0,s.deleteEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=Xe;function Qe(){return(0,s.getEndpoint)(i,"/v1/accounts/data-types")}e.getAccountDataTypes=Qe;function ze(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=ze;function Je(a,c){return(0,s.putEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},body:c,credentials:"include"})}e.putAccountDataSettings=Je})(At);class Rt{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(E.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const n={message:t};return(await this.communicator.send(E.signMessage,n)).data}async signTypedMessage(t){if(!J(t))throw new Error("Invalid typed data");return(await this.communicator.send(E.signTypedMessage,{typedData:t})).data}async send({txs:t,params:n}){if(!t||!t.length)throw new Error("No transactions were passed");const s={txs:t,params:n};return(await this.communicator.send(E.sendTransactions,s)).data}}const y={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 Mt{constructor(t){this.communicator=t,this.call=this.buildRequest({call:y.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:y.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:y.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:y.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:y.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:y.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:y.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:y.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:y.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:y.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:y.eth_gasPrice}),this.getEstimateGas=n=>this.buildRequest({call:y.eth_estimateGas})([n]),this.setSafeSettings=this.buildRequest({call:y.safe_setSettings})}buildRequest(t){const{call:n,formatters:s}=t;return async r=>{s&&Array.isArray(r)&&s.forEach((l,g)=>{l&&(r[g]=l(r[g]))});const i={call:n,params:r||[]};return(await this.communicator.send(E.rpcCall,i)).data}}}const Lt="0x1626ba7e",Bt="0x20c13b0b",U=4001;class b extends Error{constructor(t,n,s){super(t),this.code=n,this.data=s,Object.setPrototypeOf(this,b.prototype)}}class oe{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(E.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new b("Permissions request is invalid",U);try{return(await this.communicator.send(E.wallet_requestPermissions,t)).data}catch{throw new b("Permissions rejected",U)}}isPermissionRequestValid(t){return t.every(n=>typeof n=="object"?Object.keys(n).every(s=>!!Object.values(H).includes(s)):!1)}}const V=(e,t)=>t.some(n=>n.parentCapability===e),Ht=()=>(e,t,n)=>{const s=n.value;return n.value=async function(){const r=new oe(this.communicator);let i=await r.getPermissions();if(V(t,i)||(i=await r.requestPermissions([{[t]:{}}])),!V(t,i))throw new b("Permissions rejected",U);return s.apply(this)},n};var Ut=function(e,t,n,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(i=(r<3?u(i):r>3?u(t,n,i):u(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};class ue{constructor(t){this.communicator=t}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:t="usd"}={}){return(await this.communicator.send(E.getSafeBalances,{currency:t})).data}async check1271Signature(t,n="0x"){const s=await this.getInfo(),r=W({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:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,i)).data.slice(0,10).toLowerCase()===Lt}catch{return!1}}async check1271SignatureBytes(t,n="0x"){const s=await this.getInfo(),r=W({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:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,i)).data.slice(0,10).toLowerCase()===Bt}catch{return!1}}calculateMessageHash(t){return Et(t)}calculateTypedMessageHash(t){const n=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let s=t.primaryType;if(!s){const r=Object.values(t.types),i=Object.keys(t.types).filter(u=>r.every(l=>l.every(({type:g})=>g.replace("[","").replace("]","")!==u)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");s=i[0]}return ct({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:s})}async getOffChainSignature(t){return(await this.communicator.send(E.getOffChainSignature,t)).data}async isMessageSigned(t,n="0x"){let s;if(typeof t=="string"&&(s=async()=>{const r=this.calculateMessageHash(t);return await this.isMessageHashSigned(r,n)}),J(t)&&(s=async()=>{const r=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(r,n)}),s)return await s();throw new Error("Invalid message type")}async isMessageHashSigned(t,n="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of s)if(await r(t,n))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}}Ut([Ht()],ue.prototype,"requestAddressBook",null);class Gt{constructor(t={}){const{allowedDomains:n=null,debug:s=!1}=t;this.communicator=new It(n,s),this.eth=new Mt(this.communicator),this.txs=new Rt(this.communicator),this.safe=new ue(this.communicator),this.wallet=new oe(this.communicator)}}export{w as MessageFormatter,E as Methods,y as RPC_CALLS,H as RestrictedMethods,Gt as default,yt as getSDKVersion,J as isObjectEIP712TypedData}; diff --git a/buddybook/assets/index-CHNnLDtA.js b/buddybook/assets/index-DWNoNvLC.js similarity index 99% rename from buddybook/assets/index-CHNnLDtA.js rename to buddybook/assets/index-DWNoNvLC.js index ec89fa8..fcaa424 100644 --- a/buddybook/assets/index-CHNnLDtA.js +++ b/buddybook/assets/index-DWNoNvLC.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-Dt2-TQyK.js";import{C as Wo}from"./index-BpI4vT-j.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-Do02Tqa-.js";import{C as Wo}from"./index-tpwTCyHS.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-Dt2-TQyK.js b/buddybook/assets/index-Do02Tqa-.js similarity index 98% rename from buddybook/assets/index-Dt2-TQyK.js rename to buddybook/assets/index-Do02Tqa-.js index 446cb82..652e92d 100644 --- a/buddybook/assets/index-Dt2-TQyK.js +++ b/buddybook/assets/index-Do02Tqa-.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CHNnLDtA.js","assets/index-BpI4vT-j.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-BpI4vT-j.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,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-CHNnLDtA.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-DWNoNvLC.js","assets/index-tpwTCyHS.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-tpwTCyHS.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,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-DWNoNvLC.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-Drc-C73D.js b/buddybook/assets/index-Drc-C73D.js new file mode 100644 index 0000000..5eb2bc2 --- /dev/null +++ b/buddybook/assets/index-Drc-C73D.js @@ -0,0 +1 @@ +import{g as v,a as S}from"./index-tpwTCyHS.js";import{e as C}from"./index-s1Uh1I2b.js";import{e as H}from"./events-DTVtRakk.js";function y(r,n){for(var i=0;ie[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var x={},p={};const I=v(C);var f={};Object.defineProperty(f,"__esModule",{value:!0});f.numberToHex=f.getLowerCase=void 0;function E(r){return r&&r.toLowerCase()}f.getLowerCase=E;function A(r){return`0x${r.toString(16)}`}f.numberToHex=A;Object.defineProperty(p,"__esModule",{value:!0});p.SafeAppProvider=void 0;const l=I,N=H,o=f;class P extends N.EventEmitter{constructor(n,i){super(),this.submittedTxs=new Map,this.safe=n,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(n){var d,u,w,T;const{method:i,params:e=[]}=n;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return(0,o.numberToHex)(this.chainId);case"personal_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(s);return("signature"in a?a.signature:void 0)||"0x"}case"eth_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(t);return("signature"in a?a.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[s,t]=e,a=typeof t=="string"?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase())throw new Error("The address is invalid");const h=await this.sdk.txs.signTypedMessage(a);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sendTransaction":const c={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof c.gas=="string"&&c.gas.startsWith("0x")&&(c.gas=parseInt(c.gas,16));const m=await this.sdk.txs.send({txs:[c],params:{safeTxGas:c.gas}});return this.submittedTxs.set(m.safeTxHash,{from:this.safe.safeAddress,hash:m.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:c.data,value:c.value,to:c.to,blockHash:null,blockNumber:null,transactionIndex:null}),m.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,o.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 g=e[0];try{g=(await this.sdk.txs.getBySafeTxHash(g)).txHash||g}catch{}return this.submittedTxs.has(g)?this.submittedTxs.get(g):this.sdk.eth.getTransactionByHash([g]).then(s=>(s&&(s.hash=e[0]),s));case"eth_getTransactionReceipt":{let s=e[0];try{s=(await this.sdk.txs.getBySafeTxHash(s)).txHash||s}catch{}return this.sdk.eth.getTransactionReceipt([s]).then(t=>(t&&(t.transactionHash=e[0]),t))}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]]);case"wallet_sendCalls":{if(e[0].from!==this.safe.safeAddress)throw Error("Invalid from address");const s=e[0].calls.map((a,h)=>{if(a.chainId!==(0,o.numberToHex)(this.chainId))throw new Error(`Invalid call #${h}: Safe is not on chain ${a.chainId}`);if(!a.to)throw new Error(`Invalid call #${h}: missing "to" field`);return{to:a.to,data:a.data??"0x",value:a.value??(0,o.numberToHex)(0)}}),{safeTxHash:t}=await this.sdk.txs.send({txs:s});return t}case"wallet_getCallsStatus":{const s={[l.TransactionStatus.AWAITING_CONFIRMATIONS]:"PENDING",[l.TransactionStatus.AWAITING_EXECUTION]:"PENDING",[l.TransactionStatus.CANCELLED]:"CONFIRMED",[l.TransactionStatus.FAILED]:"CONFIRMED",[l.TransactionStatus.SUCCESS]:"CONFIRMED"},t=await this.sdk.txs.getBySafeTxHash(e[0]).catch(()=>null);if(!(t!=null&&t.txHash))throw new Error("Transaction not found");const a=await this.sdk.eth.getTransactionReceipt([t.txHash]).catch(()=>null);if(!a)throw new Error("Transaction receipt not found");const h=((u=(d=t.txData)==null?void 0:d.dataDecoded)==null?void 0:u.method)!=="multiSend"?1:((T=(w=t.txData.dataDecoded.parameters)==null?void 0:w[0].valueDecoded)==null?void 0:T.length)??1,_=Number(a.blockNumber),b=Number(a.gasUsed),k=Array(h).fill({success:(0,o.numberToHex)(t.txStatus===l.TransactionStatus.SUCCESS?1:0),blockHash:a.blockHash,blockNumber:(0,o.numberToHex)(_),blockTimestamp:(0,o.numberToHex)(t.executedAt??0),gasUsed:(0,o.numberToHex)(b),transactionHash:t.txHash,logs:a.logs});return{status:s[t.txStatus],receipts:k}}case"wallet_showCallsStatus":throw new Error(`"${n.method}" not supported`);case"wallet_getCapabilities":return{[(0,o.numberToHex)(this.chainId)]:{atomicBatch:{supported:!0}}};default:throw Error(`"${n.method}" not implemented`)}}send(n,i){n||i("Undefined request"),this.request(n).then(e=>i(null,{jsonrpc:"2.0",id:n.id,result:e})).catch(e=>i(e,null))}}p.SafeAppProvider=P;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.SafeAppProvider=void 0;var n=p;Object.defineProperty(r,"SafeAppProvider",{enumerable:!0,get:function(){return n.SafeAppProvider}})})(x);const L=S(x),j=y({__proto__:null,default:L},[x]);export{j as i}; diff --git a/buddybook/assets/index-DskNhwDJ.js b/buddybook/assets/index-DskNhwDJ.js deleted file mode 100644 index 5d82304..0000000 --- a/buddybook/assets/index-DskNhwDJ.js +++ /dev/null @@ -1 +0,0 @@ -import{h as p}from"./index-BpI4vT-j.js";import{e as _}from"./events-DyQEop7s.js";function m(n,a){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 w(n){return n&&n.toLowerCase()}f.getLowerCase=w;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const k=_,u=f;class y extends k.EventEmitter{constructor(a,i){super(),this.submittedTxs=new Map,this.safe=a,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(a){const{method:i,params:e=[]}=a;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,r]=e;if(this.safe.safeAddress.toLowerCase()!==r.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,r]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!r.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(r);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,r]=e,h=typeof r=="string"?JSON.parse(r):r;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(r=>(r&&(r.transactionHash=e[0]),r))}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(`"${a.method}" not implemented`)}}send(a,i){a||i("Undefined request"),this.request(a).then(e=>i(null,{jsonrpc:"2.0",id:a.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=y;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var a=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return a.SafeAppProvider}})})(l);const x=p(l),C=m({__proto__:null,default:x},[l]);export{C as i}; diff --git a/buddybook/assets/index-s1Uh1I2b.js b/buddybook/assets/index-s1Uh1I2b.js new file mode 100644 index 0000000..6d2bac6 --- /dev/null +++ b/buddybook/assets/index-s1Uh1I2b.js @@ -0,0 +1,2 @@ +import{B as G,s as xe,k as A,c as $,e as K,t as X,n as et,i as tt,I as nt,b as j,d as st,f as V,h as it,j as p,l as q}from"./index-tpwTCyHS.js";const at=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rt=/^(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)?$/;class ct extends G{constructor({domain:t}){super(`Invalid domain "${xe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class ot extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class ut extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function dt(e){const{domain:t={},message:n,primaryType:s}=e,c={EIP712Domain:Et({domain:t}),...e.types};ht({domain:t,message:n,primaryType:s,types:c});const i=["0x1901"];return t&&i.push(lt({domain:t,types:c})),s!=="EIP712Domain"&&i.push(Q({data:n,primaryType:s,types:c})),A($(i))}function lt({domain:e,types:t}){return Q({data:e,primaryType:"EIP712Domain",types:t})}function Q({data:e,primaryType:t,types:n}){const s=z({data:e,primaryType:t,types:n});return A(s)}function z({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],c=[ft({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=Y({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),c.push(l)}return K(s,c)}function ft({primaryType:e,types:t}){const n=X(gt({primaryType:e,types:t}));return A(n)}function gt({primaryType:e,types:t}){let n="";const s=J({primaryType:e,types:t});s.delete(e);const c=[e,...Array.from(s).sort()];for(const i of c)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function J({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),c=s==null?void 0:s[0];if(n.has(c)||t[c]===void 0)return n;n.add(c);for(const i of t[c])J({primaryType:i.type,types:t},n);return n}function Y({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},A(z({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},A(s)];if(n==="string")return[{type:"bytes32"},A(X(s))];if(n.lastIndexOf("]")===n.length-1){const c=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>Y({name:t,type:c,types:e,value:u}));return[{type:"bytes32"},A(K(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function ht(e){const{domain:t,message:n,primaryType:s,types:c}=e,i=(u,l)=>{for(const h of u){const{name:v,type:f}=h,E=l[v],D=f.match(rt);if(D&&(typeof E=="number"||typeof E=="bigint")){const[B,S,H]=D;et(E,{signed:S==="int",size:Number.parseInt(H)/8})}if(f==="address"&&typeof E=="string"&&!tt(E))throw new nt({address:E});const w=f.match(at);if(w){const[B,S]=w;if(S&&j(E)!==Number.parseInt(S))throw new st({expectedSize:Number.parseInt(S),givenSize:j(E)})}const P=c[f];P&&(yt(f),i(P,E))}};if(c.EIP712Domain&&t){if(typeof t!="object")throw new ct({domain:t});i(c.EIP712Domain,t)}if(s!=="EIP712Domain")if(c[s])i(c[s],n);else throw new ot({primaryType:s,types:c})}function Et({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)}function yt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new ut({type:e})}const _t=`Ethereum Signed Message: +`;function Tt(e){const t=typeof e=="string"?V(e):typeof e.raw=="string"?e.raw:it(e.raw),n=V(`${_t}${j(t)}`);return $([n,t])}function vt(e,t){return A(Tt(e),t)}const Z=()=>"9.1.0",It=e=>e.toString(16).padStart(2,"0"),mt=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,It).join("")},At=()=>typeof window<"u"?mt(10):new Date().getTime().toString(36);class C{}C.makeRequest=(e,t)=>({id:At(),method:e,params:t,env:{sdkVersion:Z()}});C.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t});C.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var g;(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"})(g||(g={}));var R;(function(e){e.requestAddressBook="requestAddressBook"})(R||(R={}));class St{constructor(t=null,n=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:c,source:i})=>{const u=!c,l=!this.isServer&&i===window.parent,h=typeof c.version<"u"&&parseInt(c.version.split(".")[0]),v=typeof h=="number"&&h>=1;let f=!0;return Array.isArray(this.allowedOrigins)&&(f=this.allowedOrigins.find(E=>E.test(s))!==void 0),!u&&l&&v&&f},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:c}=s,i=this.callbacks.get(c);i&&(i(s),this.callbacks.delete(c))},this.send=(s,c)=>{const i=C.makeRequest(s,c);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((u,l)=>{this.callbacks.set(i.id,h=>{if(!h.success){l(new Error(h.error));return}u(h)})})},this.allowedOrigins=t,this.debugMode=n,this.isServer||window.addEventListener("message",this.onParentMessage)}}const W=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var b={},_={},T={},k=p&&p.__awaiter||function(e,t,n,s){function c(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function l(f){try{v(s.next(f))}catch(E){u(E)}}function h(f){try{v(s.throw(f))}catch(E){u(E)}}function v(f){f.done?i(f.value):c(f.value).then(l,h)}v((s=s.apply(e,t||[])).next())})};Object.defineProperty(T,"__esModule",{value:!0});T.getData=T.fetchData=T.stringifyQuery=T.insertParams=void 0;const Ot=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function pt(e,t,n){return e.replace(new RegExp(`\\{${t}\\}`,"g"),n)}function bt(e,t){return t?Object.keys(t).reduce((n,s)=>pt(n,s,String(t[s])),e):e}T.insertParams=bt;function Nt(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach(s=>{e[s]!=null&&t.append(s,String(e[s]))});const n=t.toString();return n?`?${n}`:""}T.stringifyQuery=Nt;function x(e){return k(this,void 0,void 0,function*(){let t;try{t=yield e.json()}catch{t={}}if(!e.ok){const n=Ot(t)?`CGW error - ${t.code}: ${t.message}`:`CGW error - status ${e.statusText}`;throw new Error(n)}return t})}function Ct(e,t,n,s,c){return k(this,void 0,void 0,function*(){const i=Object.assign({"Content-Type":"application/json"},s),u={method:t??"POST",headers:i};c&&(u.credentials=c),n!=null&&(u.body=typeof n=="string"?n:JSON.stringify(n));const l=yield fetch(e,u);return x(l)})}T.fetchData=Ct;function Dt(e,t,n){return k(this,void 0,void 0,function*(){const s={method:"GET"};t&&(s.headers=Object.assign(Object.assign({},t),{"Content-Type":"application/json"})),n&&(s.credentials=n);const c=yield fetch(e,s);return x(c)})}T.getData=Dt;Object.defineProperty(_,"__esModule",{value:!0});_.getEndpoint=_.deleteEndpoint=_.putEndpoint=_.postEndpoint=void 0;const O=T;function M(e,t,n,s){const c=(0,O.insertParams)(t,n),i=(0,O.stringifyQuery)(s);return`${e}${c}${i}`}function wt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"POST",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.postEndpoint=wt;function Pt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"PUT",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.putEndpoint=Pt;function Rt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"DELETE",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.deleteEndpoint=Rt;function Mt(e,t,n,s){if(s)return(0,O.getData)(s,void 0,n==null?void 0:n.credentials);const c=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.getData)(c,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.getEndpoint=Mt;var L={};Object.defineProperty(L,"__esModule",{value:!0});L.DEFAULT_BASE_URL=void 0;L.DEFAULT_BASE_URL="https://safe-client.safe.global";var ee={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(t){t.UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(ee);var te={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(t){t.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(t){t.TWITTER="TWITTER",t.GITHUB="GITHUB",t.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(te);var ne={};(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(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(t){t.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",t.ADD_OWNER="ADD_OWNER",t.REMOVE_OWNER="REMOVE_OWNER",t.SWAP_OWNER="SWAP_OWNER",t.CHANGE_THRESHOLD="CHANGE_THRESHOLD",t.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",t.ENABLE_MODULE="ENABLE_MODULE",t.DISABLE_MODULE="DISABLE_MODULE",t.SET_GUARD="SET_GUARD",t.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(t){t.TRANSFER="Transfer",t.SETTINGS_CHANGE="SettingsChange",t.CUSTOM="Custom",t.CREATION="Creation",t.SWAP_ORDER="SwapOrder",t.TWAP_ORDER="TwapOrder",t.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(t){t.NONE="None",t.HAS_NEXT="HasNext",t.END="End"}(e.ConflictType||(e.ConflictType={})),function(t){t.TRANSACTION="TRANSACTION",t.LABEL="LABEL",t.CONFLICT_HEADER="CONFLICT_HEADER",t.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(t){t.MULTISIG="MULTISIG",t.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(t){t.AUTO="AUTO",t.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(t){t.AT_MINING_TIME="AT_MINING_TIME",t.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(t){t.Queued="Queued",t.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(ne);var se={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.FIXED_1559="FIXED1559",t.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",t.TX_SIMULATION="TX_SIMULATION",t.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(se);var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ie);var ae={};Object.defineProperty(ae,"__esModule",{value:!0});var re={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(t){t.COW_SWAP_ORDER="COW_SWAP_ORDER",t.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(re);var ce={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(t){t.DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(t){t.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",t.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(ce);var oe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(t){t.ANDROID="ANDROID",t.IOS="IOS",t.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(oe);var ue={};Object.defineProperty(ue,"__esModule",{value:!0});(function(e){var t=p&&p.__createBinding||(Object.create?function(a,r,o,d){d===void 0&&(d=o);var m=Object.getOwnPropertyDescriptor(r,o);(!m||("get"in m?!r.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return r[o]}}),Object.defineProperty(a,d,m)}:function(a,r,o,d){d===void 0&&(d=o),a[d]=r[o]}),n=p&&p.__exportStar||function(a,r){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,a,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 s=_,c=L;n(ee,e),n(te,e),n(ne,e),n(se,e),n(ie,e),n(ae,e),n(re,e),n(ce,e),n(oe,e),n(ue,e);let i=c.DEFAULT_BASE_URL;const u=a=>{i=a};e.setBaseUrl=u;function l(a,r){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:r})}e.relayTransaction=l;function h(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:r}})}e.getRelayCount=h;function v(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:r}})}e.getSafeInfo=v;function f(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:r},query:o},d)}e.getIncomingTransfers=f;function E(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:r},query:o},d)}e.getModuleTransactions=E;function D(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:r},query:o},d)}e.getMultisigTransactions=D;function w(a,r,o="usd",d={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:r,currency:o},query:d})}e.getBalances=w;function P(){return(0,s.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=P;function B(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:r}})}e.getOwnedSafes=B;function S(a){return(0,s.getEndpoint)(i,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=S;function H(a,r,o={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:r},query:o})}e.getCollectibles=H;function fe(a,r,o={},d){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:r},query:o},d)}e.getCollectiblesPage=fe;function ge(a,r,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:r},query:o},d)}e.getTransactionHistory=ge;function he(a,r,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:r},query:o},d)}e.getTransactionQueue=he;function Ee(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:r}})}e.getTransactionDetails=Ee;function ye(a,r,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:r},body:{signature:o}})}e.deleteTransaction=ye;function _e(a,r,o){return(0,s.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:r},body:o})}e.postSafeGasEstimation=_e;function Te(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:r}})}e.getNonces=Te;function ve(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:r},body:o})}e.proposeTransaction=ve;function Ie(a,r,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:r},body:{data:o,to:d}})}e.getConfirmationView=Ie;function me(a){return(0,s.getEndpoint)(i,"/v1/chains",{query:a})}e.getChainsConfig=me;function Ae(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=Ae;function Se(a,r={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:r})}e.getSafeApps=Se;function Oe(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=Oe;function pe(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:r,to:o}})}e.getDecodedData=pe;function be(a,r,o){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:r},query:{}},o)}e.getSafeMessages=be;function Ne(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:r}})}e.getSafeMessage=Ne;function Ce(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:r},body:o})}e.proposeSafeMessage=Ce;function De(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:r},body:o})}e.confirmSafeMessage=De;function we(a,r={}){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:r})}e.getDelegates=we;function Pe(a){return(0,s.postEndpoint)(i,"/v1/register/notifications",{body:a})}e.registerDevice=Pe;function Re(a,r,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:r,uuid:o}})}e.unregisterSafe=Re;function Me(a,r){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:r}})}e.unregisterDevice=Me;function Le(a,r,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:r},body:o,headers:d})}e.registerEmail=Le;function Be(a,r,o,d,m){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},body:d,headers:m})}e.changeEmail=Be;function He(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:r,signer:o},body:""})}e.resendEmailVerificationCode=He;function je(a,r,o,d){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:r,signer:o},body:d})}e.verifyEmail=je;function Ue(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},headers:d})}e.getRegisteredEmail=Ue;function Ge(a,r,o,d){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},headers:d})}e.deleteRegisteredEmail=Ge;function We(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:r},body:o})}e.registerRecoveryModule=We;function ke(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=ke;function Ve(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=Ve;function qe(a,r){return(0,s.getEndpoint)(i,"/v1/safes",{query:Object.assign(Object.assign({},r),{safes:a.join(",")})})}e.getSafeOverviews=qe;function Fe(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:r}})}e.getContract=Fe;function $e(){return(0,s.getEndpoint)(i,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=$e;function Ke(a){return(0,s.postEndpoint)(i,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Ke;function Xe(a){return(0,s.postEndpoint)(i,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=Xe;function Qe(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Qe;function ze(a){return(0,s.deleteEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=ze;function Je(){return(0,s.getEndpoint)(i,"/v1/accounts/data-types")}e.getAccountDataTypes=Je;function Ye(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=Ye;function Ze(a,r){return(0,s.putEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},body:r,credentials:"include"})}e.putAccountDataSettings=Ze})(b);class Lt{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(g.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const n={message:t};return(await this.communicator.send(g.signMessage,n)).data}async signTypedMessage(t){if(!W(t))throw new Error("Invalid typed data");return(await this.communicator.send(g.signTypedMessage,{typedData:t})).data}async send({txs:t,params:n}){if(!t||!t.length)throw new Error("No transactions were passed");const s={txs:t,params:n};return(await this.communicator.send(g.sendTransactions,s)).data}}const y={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 Bt{constructor(t){this.communicator=t,this.call=this.buildRequest({call:y.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:y.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:y.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:y.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:y.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:y.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:y.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:y.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:y.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:y.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:y.eth_gasPrice}),this.getEstimateGas=n=>this.buildRequest({call:y.eth_estimateGas})([n]),this.setSafeSettings=this.buildRequest({call:y.safe_setSettings})}buildRequest(t){const{call:n,formatters:s}=t;return async c=>{s&&Array.isArray(c)&&s.forEach((l,h)=>{l&&(c[h]=l(c[h]))});const i={call:n,params:c||[]};return(await this.communicator.send(g.rpcCall,i)).data}}}const Ht="0x1626ba7e",jt="0x20c13b0b",U=4001;class N extends Error{constructor(t,n,s){super(t),this.code=n,this.data=s,Object.setPrototypeOf(this,N.prototype)}}class de{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(g.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new N("Permissions request is invalid",U);try{return(await this.communicator.send(g.wallet_requestPermissions,t)).data}catch{throw new N("Permissions rejected",U)}}isPermissionRequestValid(t){return t.every(n=>typeof n=="object"?Object.keys(n).every(s=>!!Object.values(R).includes(s)):!1)}}const F=(e,t)=>t.some(n=>n.parentCapability===e),Ut=()=>(e,t,n)=>{const s=n.value;return n.value=async function(){const c=new de(this.communicator);let i=await c.getPermissions();if(F(t,i)||(i=await c.requestPermissions([{[t]:{}}])),!F(t,i))throw new N("Permissions rejected",U);return s.apply(this)},n};var Gt=function(e,t,n,s){var c=arguments.length,i=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(i=(c<3?u(i):c>3?u(t,n,i):u(t,n))||i);return c>3&&i&&Object.defineProperty(t,n,i),i};class le{constructor(t){this.communicator=t}async getChainInfo(){return(await this.communicator.send(g.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(g.getSafeInfo,void 0)).data}async experimental_getBalances({currency:t="usd"}={}){return(await this.communicator.send(g.getSafeBalances,{currency:t})).data}async check1271Signature(t,n="0x"){const s=await this.getInfo(),c=q({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:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()===Ht}catch{return!1}}async check1271SignatureBytes(t,n="0x"){const s=await this.getInfo(),c=q({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:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()===jt}catch{return!1}}calculateMessageHash(t){return vt(t)}calculateTypedMessageHash(t){const n=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let s=t.primaryType;if(!s){const c=Object.values(t.types),i=Object.keys(t.types).filter(u=>c.every(l=>l.every(({type:h})=>h.replace("[","").replace("]","")!==u)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");s=i[0]}return dt({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:s})}async getOffChainSignature(t){return(await this.communicator.send(g.getOffChainSignature,t)).data}async isMessageSigned(t,n="0x"){let s;if(typeof t=="string"&&(s=async()=>{const c=this.calculateMessageHash(t);return await this.isMessageHashSigned(c,n)}),W(t)&&(s=async()=>{const c=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(c,n)}),s)return await s();throw new Error("Invalid message type")}async isMessageHashSigned(t,n="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const c of s)if(await c(t,n))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(g.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(g.requestAddressBook,void 0)).data}}Gt([Ut()],le.prototype,"requestAddressBook",null);class Wt{constructor(t={}){const{allowedDomains:n=null,debug:s=!1}=t;this.communicator=new St(n,s),this.eth=new Bt(this.communicator),this.txs=new Lt(this.communicator),this.safe=new le(this.communicator),this.wallet=new de(this.communicator)}}const Vt=Object.freeze(Object.defineProperty({__proto__:null,MessageFormatter:C,get Methods(){return g},Operation:b.Operation,RPC_CALLS:y,get RestrictedMethods(){return R},TokenType:b.TokenType,TransactionStatus:b.TransactionStatus,TransferDirection:b.TransferDirection,default:Wt,getSDKVersion:Z,isObjectEIP712TypedData:W},Symbol.toStringTag,{value:"Module"}));export{Vt as e}; diff --git a/buddybook/assets/index-BpI4vT-j.js b/buddybook/assets/index-tpwTCyHS.js similarity index 70% rename from buddybook/assets/index-BpI4vT-j.js rename to buddybook/assets/index-tpwTCyHS.js index cb30e76..6bf4808 100644 --- a/buddybook/assets/index-BpI4vT-j.js +++ b/buddybook/assets/index-tpwTCyHS.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BhnqxX7Q.js","assets/hooks.module-D0gf0yJl.js","assets/index-BE2r4h4L.js","assets/inherits_browser-B8fZ3Rhe.js","assets/events-DyQEop7s.js","assets/index-DskNhwDJ.js","assets/index.es-BwINMB1n.js"])))=>i.map(i=>d[i]); -var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et in o?nu(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt;var Ct=(o,et,tt)=>ru(o,typeof et!="symbol"?et+"":et,tt),is=(o,et,tt)=>et.has(o)||Bs("Cannot "+tt);var Mt=(o,et,tt)=>(is(o,et,"read from private field"),tt?tt.call(o):et.get(o)),fn=(o,et,tt)=>et.has(o)?Bs("Cannot add the same private member more than once"):et instanceof WeakSet?et.add(o):et.set(o,tt),un=(o,et,tt,nt)=>(is(o,et,"write to private field"),nt?nt.call(o,tt):et.set(o,tt),tt),gn=(o,et,tt)=>(is(o,et,"access private method"),tt);var br=(o,et,tt,nt)=>({set _(rt){un(o,et,rt,tt)},get _(){return Mt(o,et,nt)}});function _mergeNamespaces(o,et){for(var tt=0;ttnt[rt]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const et=document.createElement("link").relList;if(et&&et.supports&&et.supports("modulepreload"))return;for(const rt of document.querySelectorAll('link[rel="modulepreload"]'))nt(rt);new MutationObserver(rt=>{for(const ot of rt)if(ot.type==="childList")for(const it of ot.addedNodes)it.tagName==="LINK"&&it.rel==="modulepreload"&&nt(it)}).observe(document,{childList:!0,subtree:!0});function tt(rt){const ot={};return rt.integrity&&(ot.integrity=rt.integrity),rt.referrerPolicy&&(ot.referrerPolicy=rt.referrerPolicy),rt.crossOrigin==="use-credentials"?ot.credentials="include":rt.crossOrigin==="anonymous"?ot.credentials="omit":ot.credentials="same-origin",ot}function nt(rt){if(rt.ep)return;rt.ep=!0;const ot=tt(rt);fetch(rt.href,ot)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var et=o.default;if(typeof et=="function"){var tt=function nt(){return this instanceof nt?Reflect.construct(et,arguments,this.constructor):et.apply(this,arguments)};tt.prototype=et.prototype}else tt={};return Object.defineProperty(tt,"__esModule",{value:!0}),Object.keys(o).forEach(function(nt){var rt=Object.getOwnPropertyDescriptor(o,nt);Object.defineProperty(tt,nt,rt.get?rt:{enumerable:!0,get:function(){return o[nt]}})}),tt}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yzjEDxfO.js","assets/hooks.module-D0gf0yJl.js","assets/index-CTvXdnRL.js","assets/inherits_browser-c-WsrrNw.js","assets/events-DTVtRakk.js","assets/index-Drc-C73D.js","assets/index-s1Uh1I2b.js","assets/index.es-D5UVwycq.js"])))=>i.map(i=>d[i]); +var au=Object.defineProperty;var Us=o=>{throw TypeError(o)};var cu=(o,et,tt)=>et in o?au(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt;var Ct=(o,et,tt)=>cu(o,typeof et!="symbol"?et+"":et,tt),is=(o,et,tt)=>et.has(o)||Us("Cannot "+tt);var jt=(o,et,tt)=>(is(o,et,"read from private field"),tt?tt.call(o):et.get(o)),pn=(o,et,tt)=>et.has(o)?Us("Cannot add the same private member more than once"):et instanceof WeakSet?et.add(o):et.set(o,tt),un=(o,et,tt,nt)=>(is(o,et,"write to private field"),nt?nt.call(o,tt):et.set(o,tt),tt),gn=(o,et,tt)=>(is(o,et,"access private method"),tt);var br=(o,et,tt,nt)=>({set _(rt){un(o,et,rt,tt)},get _(){return jt(o,et,nt)}});function _mergeNamespaces(o,et){for(var tt=0;ttnt[rt]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const et=document.createElement("link").relList;if(et&&et.supports&&et.supports("modulepreload"))return;for(const rt of document.querySelectorAll('link[rel="modulepreload"]'))nt(rt);new MutationObserver(rt=>{for(const ot of rt)if(ot.type==="childList")for(const it of ot.addedNodes)it.tagName==="LINK"&&it.rel==="modulepreload"&&nt(it)}).observe(document,{childList:!0,subtree:!0});function tt(rt){const ot={};return rt.integrity&&(ot.integrity=rt.integrity),rt.referrerPolicy&&(ot.referrerPolicy=rt.referrerPolicy),rt.crossOrigin==="use-credentials"?ot.credentials="include":rt.crossOrigin==="anonymous"?ot.credentials="omit":ot.credentials="same-origin",ot}function nt(rt){if(rt.ep)return;rt.ep=!0;const ot=tt(rt);fetch(rt.href,ot)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var et=o.default;if(typeof et=="function"){var tt=function nt(){return this instanceof nt?Reflect.construct(et,arguments,this.constructor):et.apply(this,arguments)};tt.prototype=et.prototype}else tt={};return Object.defineProperty(tt,"__esModule",{value:!0}),Object.keys(o).forEach(function(nt){var rt=Object.getOwnPropertyDescriptor(o,nt);Object.defineProperty(tt,nt,rt.get?rt:{enumerable:!0,get:function(){return o[nt]}})}),tt}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js * @@ -15,12 +15,12 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var f$2=reactExports,k$4=Symbol.for("react.element"),l$3=Symbol.for("react.fragment"),m$6=Object.prototype.hasOwnProperty,n$4=f$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$5={key:!0,ref:!0,__self:!0,__source:!0};function q$5(o,et,tt){var nt,rt={},ot=null,it=null;tt!==void 0&&(ot=""+tt),et.key!==void 0&&(ot=""+et.key),et.ref!==void 0&&(it=et.ref);for(nt in et)m$6.call(et,nt)&&!p$5.hasOwnProperty(nt)&&(rt[nt]=et[nt]);if(o&&o.defaultProps)for(nt in et=o.defaultProps,et)rt[nt]===void 0&&(rt[nt]=et[nt]);return{$$typeof:k$4,type:o,key:ot,ref:it,props:rt,_owner:n$4.current}}reactJsxRuntime_production_min.Fragment=l$3;reactJsxRuntime_production_min.jsx=q$5;reactJsxRuntime_production_min.jsxs=q$5;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,buffer$2={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code$2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$1=0,len=code$2.length;i$10)throw new Error("Invalid string. Length must be a multiple of 4");var tt=o.indexOf("=");tt===-1&&(tt=et);var nt=tt===et?0:4-tt%4;return[tt,nt]}function byteLength(o){var et=getLens(o),tt=et[0],nt=et[1];return(tt+nt)*3/4-nt}function _byteLength(o,et,tt){return(et+tt)*3/4-tt}function toByteArray(o){var et,tt=getLens(o),nt=tt[0],rt=tt[1],ot=new Arr(_byteLength(o,nt,rt)),it=0,st=rt>0?nt-4:nt,at;for(at=0;at>16&255,ot[it++]=et>>8&255,ot[it++]=et&255;return rt===2&&(et=revLookup[o.charCodeAt(at)]<<2|revLookup[o.charCodeAt(at+1)]>>4,ot[it++]=et&255),rt===1&&(et=revLookup[o.charCodeAt(at)]<<10|revLookup[o.charCodeAt(at+1)]<<4|revLookup[o.charCodeAt(at+2)]>>2,ot[it++]=et>>8&255,ot[it++]=et&255),ot}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[o&63]}function encodeChunk(o,et,tt){for(var nt,rt=[],ot=et;otst?st:it+ot));return nt===1?(et=o[tt-1],rt.push(lookup[et>>2]+lookup[et<<4&63]+"==")):nt===2&&(et=(o[tt-2]<<8)+o[tt-1],rt.push(lookup[et>>10]+lookup[et>>4&63]+lookup[et<<2&63]+"=")),rt.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(o,et,tt,nt,rt){var ot,it,st=rt*8-nt-1,at=(1<>1,lt=-7,dt=tt?rt-1:0,ht=tt?-1:1,pt=o[et+dt];for(dt+=ht,ot=pt&(1<<-lt)-1,pt>>=-lt,lt+=st;lt>0;ot=ot*256+o[et+dt],dt+=ht,lt-=8);for(it=ot&(1<<-lt)-1,ot>>=-lt,lt+=nt;lt>0;it=it*256+o[et+dt],dt+=ht,lt-=8);if(ot===0)ot=1-ct;else{if(ot===at)return it?NaN:(pt?-1:1)*(1/0);it=it+Math.pow(2,nt),ot=ot-ct}return(pt?-1:1)*it*Math.pow(2,ot-nt)};ieee754.write=function(o,et,tt,nt,rt,ot){var it,st,at,ct=ot*8-rt-1,lt=(1<>1,ht=rt===23?Math.pow(2,-24)-Math.pow(2,-77):0,pt=nt?0:ot-1,mt=nt?1:-1,ft=et<0||et===0&&1/et<0?1:0;for(et=Math.abs(et),isNaN(et)||et===1/0?(st=isNaN(et)?1:0,it=lt):(it=Math.floor(Math.log(et)/Math.LN2),et*(at=Math.pow(2,-it))<1&&(it--,at*=2),it+dt>=1?et+=ht/at:et+=ht*Math.pow(2,1-dt),et*at>=2&&(it++,at/=2),it+dt>=lt?(st=0,it=lt):it+dt>=1?(st=(et*at-1)*Math.pow(2,rt),it=it+dt):(st=et*Math.pow(2,dt-1)*Math.pow(2,rt),it=0));rt>=8;o[tt+pt]=st&255,pt+=mt,st/=256,rt-=8);for(it=it<0;o[tt+pt]=it&255,pt+=mt,it/=256,ct-=8);o[tt+pt-mt]|=ft*128};/*! + */var f$2=reactExports,k$4=Symbol.for("react.element"),l$3=Symbol.for("react.fragment"),m$6=Object.prototype.hasOwnProperty,n$4=f$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$5={key:!0,ref:!0,__self:!0,__source:!0};function q$5(o,et,tt){var nt,rt={},ot=null,it=null;tt!==void 0&&(ot=""+tt),et.key!==void 0&&(ot=""+et.key),et.ref!==void 0&&(it=et.ref);for(nt in et)m$6.call(et,nt)&&!p$5.hasOwnProperty(nt)&&(rt[nt]=et[nt]);if(o&&o.defaultProps)for(nt in et=o.defaultProps,et)rt[nt]===void 0&&(rt[nt]=et[nt]);return{$$typeof:k$4,type:o,key:ot,ref:it,props:rt,_owner:n$4.current}}reactJsxRuntime_production_min.Fragment=l$3;reactJsxRuntime_production_min.jsx=q$5;reactJsxRuntime_production_min.jsxs=q$5;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,buffer$2={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code$2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$1=0,len=code$2.length;i$10)throw new Error("Invalid string. Length must be a multiple of 4");var tt=o.indexOf("=");tt===-1&&(tt=et);var nt=tt===et?0:4-tt%4;return[tt,nt]}function byteLength(o){var et=getLens(o),tt=et[0],nt=et[1];return(tt+nt)*3/4-nt}function _byteLength(o,et,tt){return(et+tt)*3/4-tt}function toByteArray(o){var et,tt=getLens(o),nt=tt[0],rt=tt[1],ot=new Arr(_byteLength(o,nt,rt)),it=0,st=rt>0?nt-4:nt,at;for(at=0;at>16&255,ot[it++]=et>>8&255,ot[it++]=et&255;return rt===2&&(et=revLookup[o.charCodeAt(at)]<<2|revLookup[o.charCodeAt(at+1)]>>4,ot[it++]=et&255),rt===1&&(et=revLookup[o.charCodeAt(at)]<<10|revLookup[o.charCodeAt(at+1)]<<4|revLookup[o.charCodeAt(at+2)]>>2,ot[it++]=et>>8&255,ot[it++]=et&255),ot}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[o&63]}function encodeChunk(o,et,tt){for(var nt,rt=[],ot=et;otst?st:it+ot));return nt===1?(et=o[tt-1],rt.push(lookup[et>>2]+lookup[et<<4&63]+"==")):nt===2&&(et=(o[tt-2]<<8)+o[tt-1],rt.push(lookup[et>>10]+lookup[et>>4&63]+lookup[et<<2&63]+"=")),rt.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(o,et,tt,nt,rt){var ot,it,st=rt*8-nt-1,at=(1<>1,lt=-7,dt=tt?rt-1:0,ht=tt?-1:1,ft=o[et+dt];for(dt+=ht,ot=ft&(1<<-lt)-1,ft>>=-lt,lt+=st;lt>0;ot=ot*256+o[et+dt],dt+=ht,lt-=8);for(it=ot&(1<<-lt)-1,ot>>=-lt,lt+=nt;lt>0;it=it*256+o[et+dt],dt+=ht,lt-=8);if(ot===0)ot=1-ct;else{if(ot===at)return it?NaN:(ft?-1:1)*(1/0);it=it+Math.pow(2,nt),ot=ot-ct}return(ft?-1:1)*it*Math.pow(2,ot-nt)};ieee754.write=function(o,et,tt,nt,rt,ot){var it,st,at,ct=ot*8-rt-1,lt=(1<>1,ht=rt===23?Math.pow(2,-24)-Math.pow(2,-77):0,ft=nt?0:ot-1,mt=nt?1:-1,pt=et<0||et===0&&1/et<0?1:0;for(et=Math.abs(et),isNaN(et)||et===1/0?(st=isNaN(et)?1:0,it=lt):(it=Math.floor(Math.log(et)/Math.LN2),et*(at=Math.pow(2,-it))<1&&(it--,at*=2),it+dt>=1?et+=ht/at:et+=ht*Math.pow(2,1-dt),et*at>=2&&(it++,at/=2),it+dt>=lt?(st=0,it=lt):it+dt>=1?(st=(et*at-1)*Math.pow(2,rt),it=it+dt):(st=et*Math.pow(2,dt-1)*Math.pow(2,rt),it=0));rt>=8;o[tt+ft]=st&255,ft+=mt,st/=256,rt-=8);for(it=it<0;o[tt+ft]=it&255,ft+=mt,it/=256,ct-=8);o[tt+ft-mt]|=pt*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(o){const et=base64Js,tt=ieee754,nt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=st,o.SlowBuffer=xt,o.INSPECT_MAX_BYTES=50;const rt=2147483647;o.kMaxLength=rt,st.TYPED_ARRAY_SUPPORT=ot(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ot(){try{const Tt=new Uint8Array(1),St={foo:function(){return 42}};return Object.setPrototypeOf(St,Uint8Array.prototype),Object.setPrototypeOf(Tt,St),Tt.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function it(Tt){if(Tt>rt)throw new RangeError('The value "'+Tt+'" is invalid for option "size"');const St=new Uint8Array(Tt);return Object.setPrototypeOf(St,st.prototype),St}function st(Tt,St,At){if(typeof Tt=="number"){if(typeof St=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return dt(Tt)}return at(Tt,St,At)}st.poolSize=8192;function at(Tt,St,At){if(typeof Tt=="string")return ht(Tt,St);if(ArrayBuffer.isView(Tt))return mt(Tt);if(Tt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Tt);if(Tn(Tt,ArrayBuffer)||Tt&&Tn(Tt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Tn(Tt,SharedArrayBuffer)||Tt&&Tn(Tt.buffer,SharedArrayBuffer)))return ft(Tt,St,At);if(typeof Tt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $t=Tt.valueOf&&Tt.valueOf();if($t!=null&&$t!==Tt)return st.from($t,St,At);const Kt=yt(Tt);if(Kt)return Kt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Tt[Symbol.toPrimitive]=="function")return st.from(Tt[Symbol.toPrimitive]("string"),St,At);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Tt)}st.from=function(Tt,St,At){return at(Tt,St,At)},Object.setPrototypeOf(st.prototype,Uint8Array.prototype),Object.setPrototypeOf(st,Uint8Array);function ct(Tt){if(typeof Tt!="number")throw new TypeError('"size" argument must be of type number');if(Tt<0)throw new RangeError('The value "'+Tt+'" is invalid for option "size"')}function lt(Tt,St,At){return ct(Tt),Tt<=0?it(Tt):St!==void 0?typeof At=="string"?it(Tt).fill(St,At):it(Tt).fill(St):it(Tt)}st.alloc=function(Tt,St,At){return lt(Tt,St,At)};function dt(Tt){return ct(Tt),it(Tt<0?0:gt(Tt)|0)}st.allocUnsafe=function(Tt){return dt(Tt)},st.allocUnsafeSlow=function(Tt){return dt(Tt)};function ht(Tt,St){if((typeof St!="string"||St==="")&&(St="utf8"),!st.isEncoding(St))throw new TypeError("Unknown encoding: "+St);const At=vt(Tt,St)|0;let $t=it(At);const Kt=$t.write(Tt,St);return Kt!==At&&($t=$t.slice(0,Kt)),$t}function pt(Tt){const St=Tt.length<0?0:gt(Tt.length)|0,At=it(St);for(let $t=0;$t=rt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt.toString(16)+" bytes");return Tt|0}function xt(Tt){return+Tt!=Tt&&(Tt=0),st.alloc(+Tt)}st.isBuffer=function(St){return St!=null&&St._isBuffer===!0&&St!==st.prototype},st.compare=function(St,At){if(Tn(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),Tn(At,Uint8Array)&&(At=st.from(At,At.offset,At.byteLength)),!st.isBuffer(St)||!st.isBuffer(At))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(St===At)return 0;let $t=St.length,Kt=At.length;for(let rn=0,sn=Math.min($t,Kt);rnKt.length?(st.isBuffer(sn)||(sn=st.from(sn)),sn.copy(Kt,rn)):Uint8Array.prototype.set.call(Kt,sn,rn);else if(st.isBuffer(sn))sn.copy(Kt,rn);else throw new TypeError('"list" argument must be an Array of Buffers');rn+=sn.length}return Kt};function vt(Tt,St){if(st.isBuffer(Tt))return Tt.length;if(ArrayBuffer.isView(Tt)||Tn(Tt,ArrayBuffer))return Tt.byteLength;if(typeof Tt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Tt);const At=Tt.length,$t=arguments.length>2&&arguments[2]===!0;if(!$t&&At===0)return 0;let Kt=!1;for(;;)switch(St){case"ascii":case"latin1":case"binary":return At;case"utf8":case"utf-8":return ln(Tt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return At*2;case"hex":return At>>>1;case"base64":return mn(Tt).length;default:if(Kt)return $t?-1:ln(Tt).length;St=(""+St).toLowerCase(),Kt=!0}}st.byteLength=vt;function bt(Tt,St,At){let $t=!1;if((St===void 0||St<0)&&(St=0),St>this.length||((At===void 0||At>this.length)&&(At=this.length),At<=0)||(At>>>=0,St>>>=0,At<=St))return"";for(Tt||(Tt="utf8");;)switch(Tt){case"hex":return qt(this,St,At);case"utf8":case"utf-8":return zt(this,St,At);case"ascii":return Ht(this,St,At);case"latin1":case"binary":return Ut(this,St,At);case"base64":return Bt(this,St,At);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,St,At);default:if($t)throw new TypeError("Unknown encoding: "+Tt);Tt=(Tt+"").toLowerCase(),$t=!0}}st.prototype._isBuffer=!0;function Et(Tt,St,At){const $t=Tt[St];Tt[St]=Tt[At],Tt[At]=$t}st.prototype.swap16=function(){const St=this.length;if(St%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let At=0;AtAt&&(St+=" ... "),""},nt&&(st.prototype[nt]=st.prototype.inspect),st.prototype.compare=function(St,At,$t,Kt,rn){if(Tn(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),!st.isBuffer(St))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof St);if(At===void 0&&(At=0),$t===void 0&&($t=St?St.length:0),Kt===void 0&&(Kt=0),rn===void 0&&(rn=this.length),At<0||$t>St.length||Kt<0||rn>this.length)throw new RangeError("out of range index");if(Kt>=rn&&At>=$t)return 0;if(Kt>=rn)return-1;if(At>=$t)return 1;if(At>>>=0,$t>>>=0,Kt>>>=0,rn>>>=0,this===St)return 0;let sn=rn-Kt,xn=$t-At;const Rn=Math.min(sn,xn),vn=this.slice(Kt,rn),An=St.slice(At,$t);for(let bn=0;bn2147483647?At=2147483647:At<-2147483648&&(At=-2147483648),At=+At,Pn(At)&&(At=Kt?0:Tt.length-1),At<0&&(At=Tt.length+At),At>=Tt.length){if(Kt)return-1;At=Tt.length-1}else if(At<0)if(Kt)At=0;else return-1;if(typeof St=="string"&&(St=st.from(St,$t)),st.isBuffer(St))return St.length===0?-1:kt(Tt,St,At,$t,Kt);if(typeof St=="number")return St=St&255,typeof Uint8Array.prototype.indexOf=="function"?Kt?Uint8Array.prototype.indexOf.call(Tt,St,At):Uint8Array.prototype.lastIndexOf.call(Tt,St,At):kt(Tt,[St],At,$t,Kt);throw new TypeError("val must be string, number or Buffer")}function kt(Tt,St,At,$t,Kt){let rn=1,sn=Tt.length,xn=St.length;if($t!==void 0&&($t=String($t).toLowerCase(),$t==="ucs2"||$t==="ucs-2"||$t==="utf16le"||$t==="utf-16le")){if(Tt.length<2||St.length<2)return-1;rn=2,sn/=2,xn/=2,At/=2}function Rn(An,bn){return rn===1?An[bn]:An.readUInt16BE(bn*rn)}let vn;if(Kt){let An=-1;for(vn=At;vnsn&&(At=sn-xn),vn=At;vn>=0;vn--){let An=!0;for(let bn=0;bnKt&&($t=Kt)):$t=Kt;const rn=St.length;$t>rn/2&&($t=rn/2);let sn;for(sn=0;sn<$t;++sn){const xn=parseInt(St.substr(sn*2,2),16);if(Pn(xn))return sn;Tt[At+sn]=xn}return sn}function Rt(Tt,St,At,$t){return wn(ln(St,Tt.length-At),Tt,At,$t)}function Pt(Tt,St,At,$t){return wn(pn(St),Tt,At,$t)}function jt(Tt,St,At,$t){return wn(mn(St),Tt,At,$t)}function Ot(Tt,St,At,$t){return wn(kn(St,Tt.length-At),Tt,At,$t)}st.prototype.write=function(St,At,$t,Kt){if(At===void 0)Kt="utf8",$t=this.length,At=0;else if($t===void 0&&typeof At=="string")Kt=At,$t=this.length,At=0;else if(isFinite(At))At=At>>>0,isFinite($t)?($t=$t>>>0,Kt===void 0&&(Kt="utf8")):(Kt=$t,$t=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const rn=this.length-At;if(($t===void 0||$t>rn)&&($t=rn),St.length>0&&($t<0||At<0)||At>this.length)throw new RangeError("Attempt to write outside buffer bounds");Kt||(Kt="utf8");let sn=!1;for(;;)switch(Kt){case"hex":return It(this,St,At,$t);case"utf8":case"utf-8":return Rt(this,St,At,$t);case"ascii":case"latin1":case"binary":return Pt(this,St,At,$t);case"base64":return jt(this,St,At,$t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,St,At,$t);default:if(sn)throw new TypeError("Unknown encoding: "+Kt);Kt=(""+Kt).toLowerCase(),sn=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bt(Tt,St,At){return St===0&&At===Tt.length?et.fromByteArray(Tt):et.fromByteArray(Tt.slice(St,At))}function zt(Tt,St,At){At=Math.min(Tt.length,At);const $t=[];let Kt=St;for(;Kt239?4:rn>223?3:rn>191?2:1;if(Kt+xn<=At){let Rn,vn,An,bn;switch(xn){case 1:rn<128&&(sn=rn);break;case 2:Rn=Tt[Kt+1],(Rn&192)===128&&(bn=(rn&31)<<6|Rn&63,bn>127&&(sn=bn));break;case 3:Rn=Tt[Kt+1],vn=Tt[Kt+2],(Rn&192)===128&&(vn&192)===128&&(bn=(rn&15)<<12|(Rn&63)<<6|vn&63,bn>2047&&(bn<55296||bn>57343)&&(sn=bn));break;case 4:Rn=Tt[Kt+1],vn=Tt[Kt+2],An=Tt[Kt+3],(Rn&192)===128&&(vn&192)===128&&(An&192)===128&&(bn=(rn&15)<<18|(Rn&63)<<12|(vn&63)<<6|An&63,bn>65535&&bn<1114112&&(sn=bn))}}sn===null?(sn=65533,xn=1):sn>65535&&(sn-=65536,$t.push(sn>>>10&1023|55296),sn=56320|sn&1023),$t.push(sn),Kt+=xn}return Yt($t)}const Ft=4096;function Yt(Tt){const St=Tt.length;if(St<=Ft)return String.fromCharCode.apply(String,Tt);let At="",$t=0;for(;$t$t)&&(At=$t);let Kt="";for(let rn=St;rn$t&&(St=$t),At<0?(At+=$t,At<0&&(At=0)):At>$t&&(At=$t),AtAt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(St,At,$t){St=St>>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St+--At],rn=1;for(;At>0&&(rn*=256);)Kt+=this[St+--At]*rn;return Kt},st.prototype.readUint8=st.prototype.readUInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]|this[St+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]<<8|this[St+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),(this[St]|this[St+1]<<8|this[St+2]<<16)+this[St+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]*16777216+(this[St+1]<<16|this[St+2]<<8|this[St+3])},st.prototype.readBigUInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=At+this[++St]*2**8+this[++St]*2**16+this[++St]*2**24,rn=this[++St]+this[++St]*2**8+this[++St]*2**16+$t*2**24;return BigInt(Kt)+(BigInt(rn)<>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=At*2**24+this[++St]*2**16+this[++St]*2**8+this[++St],rn=this[++St]*2**24+this[++St]*2**16+this[++St]*2**8+$t;return(BigInt(Kt)<>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn=rn&&(Kt-=Math.pow(2,8*At)),Kt},st.prototype.readIntBE=function(St,At,$t){St=St>>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=At,rn=1,sn=this[St+--Kt];for(;Kt>0&&(rn*=256);)sn+=this[St+--Kt]*rn;return rn*=128,sn>=rn&&(sn-=Math.pow(2,8*At)),sn},st.prototype.readInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]&128?(255-this[St]+1)*-1:this[St]},st.prototype.readInt16LE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const $t=this[St]|this[St+1]<<8;return $t&32768?$t|4294901760:$t},st.prototype.readInt16BE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const $t=this[St+1]|this[St]<<8;return $t&32768?$t|4294901760:$t},st.prototype.readInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]|this[St+1]<<8|this[St+2]<<16|this[St+3]<<24},st.prototype.readInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]<<24|this[St+1]<<16|this[St+2]<<8|this[St+3]},st.prototype.readBigInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=this[St+4]+this[St+5]*2**8+this[St+6]*2**16+($t<<24);return(BigInt(Kt)<>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=(At<<24)+this[++St]*2**16+this[++St]*2**8+this[++St];return(BigInt(Kt)<>>0,At||Zt(St,4,this.length),tt.read(this,St,!0,23,4)},st.prototype.readFloatBE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),tt.read(this,St,!1,23,4)},st.prototype.readDoubleLE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!0,52,8)},st.prototype.readDoubleBE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!1,52,8)};function Qt(Tt,St,At,$t,Kt,rn){if(!st.isBuffer(Tt))throw new TypeError('"buffer" argument must be a Buffer instance');if(St>Kt||StTt.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,$t=$t>>>0,!Kt){const xn=Math.pow(2,8*$t)-1;Qt(this,St,At,$t,xn,0)}let rn=1,sn=0;for(this[At]=St&255;++sn<$t&&(rn*=256);)this[At+sn]=St/rn&255;return At+$t},st.prototype.writeUintBE=st.prototype.writeUIntBE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,$t=$t>>>0,!Kt){const xn=Math.pow(2,8*$t)-1;Qt(this,St,At,$t,xn,0)}let rn=$t-1,sn=1;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)this[At+rn]=St/sn&255;return At+$t},st.prototype.writeUint8=st.prototype.writeUInt8=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,1,255,0),this[At]=St&255,At+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,65535,0),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,65535,0),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,4294967295,0),this[At+3]=St>>>24,this[At+2]=St>>>16,this[At+1]=St>>>8,this[At]=St&255,At+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,4294967295,0),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4};function Nt(Tt,St,At,$t,Kt){Dt(St,$t,Kt,Tt,At,7);let rn=Number(St&BigInt(4294967295));Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,At}function Gt(Tt,St,At,$t,Kt){Dt(St,$t,Kt,Tt,At,7);let rn=Number(St&BigInt(4294967295));Tt[At+7]=rn,rn=rn>>8,Tt[At+6]=rn,rn=rn>>8,Tt[At+5]=rn,rn=rn>>8,Tt[At+4]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return Tt[At+3]=sn,sn=sn>>8,Tt[At+2]=sn,sn=sn>>8,Tt[At+1]=sn,sn=sn>>8,Tt[At]=sn,At+8}st.prototype.writeBigUInt64LE=En(function(St,At=0){return Nt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=En(function(St,At=0){return Gt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*$t-1);Qt(this,St,At,$t,Rn-1,-Rn)}let rn=0,sn=1,xn=0;for(this[At]=St&255;++rn<$t&&(sn*=256);)St<0&&xn===0&&this[At+rn-1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+$t},st.prototype.writeIntBE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*$t-1);Qt(this,St,At,$t,Rn-1,-Rn)}let rn=$t-1,sn=1,xn=0;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)St<0&&xn===0&&this[At+rn+1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+$t},st.prototype.writeInt8=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,1,127,-128),St<0&&(St=255+St+1),this[At]=St&255,At+1},st.prototype.writeInt16LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,32767,-32768),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeInt16BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,32767,-32768),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeInt32LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,2147483647,-2147483648),this[At]=St&255,this[At+1]=St>>>8,this[At+2]=St>>>16,this[At+3]=St>>>24,At+4},st.prototype.writeInt32BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,2147483647,-2147483648),St<0&&(St=4294967295+St+1),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4},st.prototype.writeBigInt64LE=En(function(St,At=0){return Nt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=En(function(St,At=0){return Gt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nn(Tt,St,At,$t,Kt,rn){if(At+$t>Tt.length)throw new RangeError("Index out of range");if(At<0)throw new RangeError("Index out of range")}function Wt(Tt,St,At,$t,Kt){return St=+St,At=At>>>0,Kt||nn(Tt,St,At,4),tt.write(Tt,St,At,$t,23,4),At+4}st.prototype.writeFloatLE=function(St,At,$t){return Wt(this,St,At,!0,$t)},st.prototype.writeFloatBE=function(St,At,$t){return Wt(this,St,At,!1,$t)};function hn(Tt,St,At,$t,Kt){return St=+St,At=At>>>0,Kt||nn(Tt,St,At,8),tt.write(Tt,St,At,$t,52,8),At+8}st.prototype.writeDoubleLE=function(St,At,$t){return hn(this,St,At,!0,$t)},st.prototype.writeDoubleBE=function(St,At,$t){return hn(this,St,At,!1,$t)},st.prototype.copy=function(St,At,$t,Kt){if(!st.isBuffer(St))throw new TypeError("argument should be a Buffer");if($t||($t=0),!Kt&&Kt!==0&&(Kt=this.length),At>=St.length&&(At=St.length),At||(At=0),Kt>0&&Kt<$t&&(Kt=$t),Kt===$t||St.length===0||this.length===0)return 0;if(At<0)throw new RangeError("targetStart out of bounds");if($t<0||$t>=this.length)throw new RangeError("Index out of range");if(Kt<0)throw new RangeError("sourceEnd out of bounds");Kt>this.length&&(Kt=this.length),St.length-At>>0,$t=$t===void 0?this.length:$t>>>0,St||(St=0);let rn;if(typeof St=="number")for(rn=At;rn<$t;++rn)this[rn]=St;else{const sn=st.isBuffer(St)?St:st.from(St,Kt),xn=sn.length;if(xn===0)throw new TypeError('The value "'+St+'" is invalid for argument "value"');for(rn=0;rn<$t-At;++rn)this[rn+At]=sn[rn%xn]}return this};const Xt={};function Jt(Tt,St,At){Xt[Tt]=class extends At{constructor(){super(),Object.defineProperty(this,"message",{value:St.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Tt}]`,this.stack,delete this.name}get code(){return Tt}set code(Kt){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Kt,writable:!0})}toString(){return`${this.name} [${Tt}]: ${this.message}`}}}Jt("ERR_BUFFER_OUT_OF_BOUNDS",function(Tt){return Tt?`${Tt} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Jt("ERR_INVALID_ARG_TYPE",function(Tt,St){return`The "${Tt}" argument must be of type number. Received type ${typeof St}`},TypeError),Jt("ERR_OUT_OF_RANGE",function(Tt,St,At){let $t=`The value of "${Tt}" is out of range.`,Kt=At;return Number.isInteger(At)&&Math.abs(At)>2**32?Kt=tn(String(At)):typeof At=="bigint"&&(Kt=String(At),(At>BigInt(2)**BigInt(32)||At<-(BigInt(2)**BigInt(32)))&&(Kt=tn(Kt)),Kt+="n"),$t+=` It must be ${St}. Received ${Kt}`,$t},RangeError);function tn(Tt){let St="",At=Tt.length;const $t=Tt[0]==="-"?1:0;for(;At>=$t+4;At-=3)St=`_${Tt.slice(At-3,At)}${St}`;return`${Tt.slice(0,At)}${St}`}function _t(Tt,St,At){Vt(St,"offset"),(Tt[St]===void 0||Tt[St+At]===void 0)&&en(St,Tt.length-(At+1))}function Dt(Tt,St,At,$t,Kt,rn){if(Tt>At||Tt= 0${sn} and < 2${sn} ** ${(rn+1)*8}${sn}`:xn=`>= -(2${sn} ** ${(rn+1)*8-1}${sn}) and < 2 ** ${(rn+1)*8-1}${sn}`,new Xt.ERR_OUT_OF_RANGE("value",xn,Tt)}_t($t,Kt,rn)}function Vt(Tt,St){if(typeof Tt!="number")throw new Xt.ERR_INVALID_ARG_TYPE(St,"number",Tt)}function en(Tt,St,At){throw Math.floor(Tt)!==Tt?(Vt(Tt,At),new Xt.ERR_OUT_OF_RANGE("offset","an integer",Tt)):St<0?new Xt.ERR_BUFFER_OUT_OF_BOUNDS:new Xt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${St}`,Tt)}const an=/[^+/0-9A-Za-z-_]/g;function dn(Tt){if(Tt=Tt.split("=")[0],Tt=Tt.trim().replace(an,""),Tt.length<2)return"";for(;Tt.length%4!==0;)Tt=Tt+"=";return Tt}function ln(Tt,St){St=St||1/0;let At;const $t=Tt.length;let Kt=null;const rn=[];for(let sn=0;sn<$t;++sn){if(At=Tt.charCodeAt(sn),At>55295&&At<57344){if(!Kt){if(At>56319){(St-=3)>-1&&rn.push(239,191,189);continue}else if(sn+1===$t){(St-=3)>-1&&rn.push(239,191,189);continue}Kt=At;continue}if(At<56320){(St-=3)>-1&&rn.push(239,191,189),Kt=At;continue}At=(Kt-55296<<10|At-56320)+65536}else Kt&&(St-=3)>-1&&rn.push(239,191,189);if(Kt=null,At<128){if((St-=1)<0)break;rn.push(At)}else if(At<2048){if((St-=2)<0)break;rn.push(At>>6|192,At&63|128)}else if(At<65536){if((St-=3)<0)break;rn.push(At>>12|224,At>>6&63|128,At&63|128)}else if(At<1114112){if((St-=4)<0)break;rn.push(At>>18|240,At>>12&63|128,At>>6&63|128,At&63|128)}else throw new Error("Invalid code point")}return rn}function pn(Tt){const St=[];for(let At=0;At>8,Kt=At%256,rn.push(Kt),rn.push($t);return rn}function mn(Tt){return et.toByteArray(dn(Tt))}function wn(Tt,St,At,$t){let Kt;for(Kt=0;Kt<$t&&!(Kt+At>=St.length||Kt>=Tt.length);++Kt)St[Kt+At]=Tt[Kt];return Kt}function Tn(Tt,St){return Tt instanceof St||Tt!=null&&Tt.constructor!=null&&Tt.constructor.name!=null&&Tt.constructor.name===St.name}function Pn(Tt){return Tt!==Tt}const yn=function(){const Tt="0123456789abcdef",St=new Array(256);for(let At=0;At<16;++At){const $t=At*16;for(let Kt=0;Kt<16;++Kt)St[$t+Kt]=Tt[At]+Tt[Kt]}return St}();function En(Tt){return typeof BigInt>"u"?on:Tt}function on(){throw new Error("BigInt not supported")}})(buffer$2);var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** + */(function(o){const et=base64Js,tt=ieee754,nt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=st,o.SlowBuffer=xt,o.INSPECT_MAX_BYTES=50;const rt=2147483647;o.kMaxLength=rt,st.TYPED_ARRAY_SUPPORT=ot(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ot(){try{const _t=new Uint8Array(1),St={foo:function(){return 42}};return Object.setPrototypeOf(St,Uint8Array.prototype),Object.setPrototypeOf(_t,St),_t.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function it(_t){if(_t>rt)throw new RangeError('The value "'+_t+'" is invalid for option "size"');const St=new Uint8Array(_t);return Object.setPrototypeOf(St,st.prototype),St}function st(_t,St,At){if(typeof _t=="number"){if(typeof St=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return dt(_t)}return at(_t,St,At)}st.poolSize=8192;function at(_t,St,At){if(typeof _t=="string")return ht(_t,St);if(ArrayBuffer.isView(_t))return mt(_t);if(_t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _t);if(_n(_t,ArrayBuffer)||_t&&_n(_t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_n(_t,SharedArrayBuffer)||_t&&_n(_t.buffer,SharedArrayBuffer)))return pt(_t,St,At);if(typeof _t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Ot=_t.valueOf&&_t.valueOf();if(Ot!=null&&Ot!==_t)return st.from(Ot,St,At);const Kt=yt(_t);if(Kt)return Kt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _t[Symbol.toPrimitive]=="function")return st.from(_t[Symbol.toPrimitive]("string"),St,At);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _t)}st.from=function(_t,St,At){return at(_t,St,At)},Object.setPrototypeOf(st.prototype,Uint8Array.prototype),Object.setPrototypeOf(st,Uint8Array);function ct(_t){if(typeof _t!="number")throw new TypeError('"size" argument must be of type number');if(_t<0)throw new RangeError('The value "'+_t+'" is invalid for option "size"')}function lt(_t,St,At){return ct(_t),_t<=0?it(_t):St!==void 0?typeof At=="string"?it(_t).fill(St,At):it(_t).fill(St):it(_t)}st.alloc=function(_t,St,At){return lt(_t,St,At)};function dt(_t){return ct(_t),it(_t<0?0:gt(_t)|0)}st.allocUnsafe=function(_t){return dt(_t)},st.allocUnsafeSlow=function(_t){return dt(_t)};function ht(_t,St){if((typeof St!="string"||St==="")&&(St="utf8"),!st.isEncoding(St))throw new TypeError("Unknown encoding: "+St);const At=vt(_t,St)|0;let Ot=it(At);const Kt=Ot.write(_t,St);return Kt!==At&&(Ot=Ot.slice(0,Kt)),Ot}function ft(_t){const St=_t.length<0?0:gt(_t.length)|0,At=it(St);for(let Ot=0;Ot=rt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt.toString(16)+" bytes");return _t|0}function xt(_t){return+_t!=_t&&(_t=0),st.alloc(+_t)}st.isBuffer=function(St){return St!=null&&St._isBuffer===!0&&St!==st.prototype},st.compare=function(St,At){if(_n(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),_n(At,Uint8Array)&&(At=st.from(At,At.offset,At.byteLength)),!st.isBuffer(St)||!st.isBuffer(At))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(St===At)return 0;let Ot=St.length,Kt=At.length;for(let rn=0,sn=Math.min(Ot,Kt);rnKt.length?(st.isBuffer(sn)||(sn=st.from(sn)),sn.copy(Kt,rn)):Uint8Array.prototype.set.call(Kt,sn,rn);else if(st.isBuffer(sn))sn.copy(Kt,rn);else throw new TypeError('"list" argument must be an Array of Buffers');rn+=sn.length}return Kt};function vt(_t,St){if(st.isBuffer(_t))return _t.length;if(ArrayBuffer.isView(_t)||_n(_t,ArrayBuffer))return _t.byteLength;if(typeof _t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _t);const At=_t.length,Ot=arguments.length>2&&arguments[2]===!0;if(!Ot&&At===0)return 0;let Kt=!1;for(;;)switch(St){case"ascii":case"latin1":case"binary":return At;case"utf8":case"utf-8":return ln(_t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return At*2;case"hex":return At>>>1;case"base64":return mn(_t).length;default:if(Kt)return Ot?-1:ln(_t).length;St=(""+St).toLowerCase(),Kt=!0}}st.byteLength=vt;function bt(_t,St,At){let Ot=!1;if((St===void 0||St<0)&&(St=0),St>this.length||((At===void 0||At>this.length)&&(At=this.length),At<=0)||(At>>>=0,St>>>=0,At<=St))return"";for(_t||(_t="utf8");;)switch(_t){case"hex":return qt(this,St,At);case"utf8":case"utf-8":return zt(this,St,At);case"ascii":return Ht(this,St,At);case"latin1":case"binary":return Ut(this,St,At);case"base64":return Bt(this,St,At);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,St,At);default:if(Ot)throw new TypeError("Unknown encoding: "+_t);_t=(_t+"").toLowerCase(),Ot=!0}}st.prototype._isBuffer=!0;function Et(_t,St,At){const Ot=_t[St];_t[St]=_t[At],_t[At]=Ot}st.prototype.swap16=function(){const St=this.length;if(St%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let At=0;AtAt&&(St+=" ... "),""},nt&&(st.prototype[nt]=st.prototype.inspect),st.prototype.compare=function(St,At,Ot,Kt,rn){if(_n(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),!st.isBuffer(St))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof St);if(At===void 0&&(At=0),Ot===void 0&&(Ot=St?St.length:0),Kt===void 0&&(Kt=0),rn===void 0&&(rn=this.length),At<0||Ot>St.length||Kt<0||rn>this.length)throw new RangeError("out of range index");if(Kt>=rn&&At>=Ot)return 0;if(Kt>=rn)return-1;if(At>=Ot)return 1;if(At>>>=0,Ot>>>=0,Kt>>>=0,rn>>>=0,this===St)return 0;let sn=rn-Kt,xn=Ot-At;const Rn=Math.min(sn,xn),vn=this.slice(Kt,rn),An=St.slice(At,Ot);for(let bn=0;bn2147483647?At=2147483647:At<-2147483648&&(At=-2147483648),At=+At,$n(At)&&(At=Kt?0:_t.length-1),At<0&&(At=_t.length+At),At>=_t.length){if(Kt)return-1;At=_t.length-1}else if(At<0)if(Kt)At=0;else return-1;if(typeof St=="string"&&(St=st.from(St,Ot)),st.isBuffer(St))return St.length===0?-1:kt(_t,St,At,Ot,Kt);if(typeof St=="number")return St=St&255,typeof Uint8Array.prototype.indexOf=="function"?Kt?Uint8Array.prototype.indexOf.call(_t,St,At):Uint8Array.prototype.lastIndexOf.call(_t,St,At):kt(_t,[St],At,Ot,Kt);throw new TypeError("val must be string, number or Buffer")}function kt(_t,St,At,Ot,Kt){let rn=1,sn=_t.length,xn=St.length;if(Ot!==void 0&&(Ot=String(Ot).toLowerCase(),Ot==="ucs2"||Ot==="ucs-2"||Ot==="utf16le"||Ot==="utf-16le")){if(_t.length<2||St.length<2)return-1;rn=2,sn/=2,xn/=2,At/=2}function Rn(An,bn){return rn===1?An[bn]:An.readUInt16BE(bn*rn)}let vn;if(Kt){let An=-1;for(vn=At;vnsn&&(At=sn-xn),vn=At;vn>=0;vn--){let An=!0;for(let bn=0;bnKt&&(Ot=Kt)):Ot=Kt;const rn=St.length;Ot>rn/2&&(Ot=rn/2);let sn;for(sn=0;sn>>0,isFinite(Ot)?(Ot=Ot>>>0,Kt===void 0&&(Kt="utf8")):(Kt=Ot,Ot=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const rn=this.length-At;if((Ot===void 0||Ot>rn)&&(Ot=rn),St.length>0&&(Ot<0||At<0)||At>this.length)throw new RangeError("Attempt to write outside buffer bounds");Kt||(Kt="utf8");let sn=!1;for(;;)switch(Kt){case"hex":return It(this,St,At,Ot);case"utf8":case"utf-8":return Rt(this,St,At,Ot);case"ascii":case"latin1":case"binary":return $t(this,St,At,Ot);case"base64":return Nt(this,St,At,Ot);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,St,At,Ot);default:if(sn)throw new TypeError("Unknown encoding: "+Kt);Kt=(""+Kt).toLowerCase(),sn=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bt(_t,St,At){return St===0&&At===_t.length?et.fromByteArray(_t):et.fromByteArray(_t.slice(St,At))}function zt(_t,St,At){At=Math.min(_t.length,At);const Ot=[];let Kt=St;for(;Kt239?4:rn>223?3:rn>191?2:1;if(Kt+xn<=At){let Rn,vn,An,bn;switch(xn){case 1:rn<128&&(sn=rn);break;case 2:Rn=_t[Kt+1],(Rn&192)===128&&(bn=(rn&31)<<6|Rn&63,bn>127&&(sn=bn));break;case 3:Rn=_t[Kt+1],vn=_t[Kt+2],(Rn&192)===128&&(vn&192)===128&&(bn=(rn&15)<<12|(Rn&63)<<6|vn&63,bn>2047&&(bn<55296||bn>57343)&&(sn=bn));break;case 4:Rn=_t[Kt+1],vn=_t[Kt+2],An=_t[Kt+3],(Rn&192)===128&&(vn&192)===128&&(An&192)===128&&(bn=(rn&15)<<18|(Rn&63)<<12|(vn&63)<<6|An&63,bn>65535&&bn<1114112&&(sn=bn))}}sn===null?(sn=65533,xn=1):sn>65535&&(sn-=65536,Ot.push(sn>>>10&1023|55296),sn=56320|sn&1023),Ot.push(sn),Kt+=xn}return Yt(Ot)}const Ft=4096;function Yt(_t){const St=_t.length;if(St<=Ft)return String.fromCharCode.apply(String,_t);let At="",Ot=0;for(;OtOt)&&(At=Ot);let Kt="";for(let rn=St;rnOt&&(St=Ot),At<0?(At+=Ot,At<0&&(At=0)):At>Ot&&(At=Ot),AtAt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(St,At,Ot){St=St>>>0,At=At>>>0,Ot||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn>>0,At=At>>>0,Ot||Zt(St,At,this.length);let Kt=this[St+--At],rn=1;for(;At>0&&(rn*=256);)Kt+=this[St+--At]*rn;return Kt},st.prototype.readUint8=st.prototype.readUInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]|this[St+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]<<8|this[St+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),(this[St]|this[St+1]<<8|this[St+2]<<16)+this[St+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]*16777216+(this[St+1]<<16|this[St+2]<<8|this[St+3])},st.prototype.readBigUInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],Ot=this[St+7];(At===void 0||Ot===void 0)&&en(St,this.length-8);const Kt=At+this[++St]*2**8+this[++St]*2**16+this[++St]*2**24,rn=this[++St]+this[++St]*2**8+this[++St]*2**16+Ot*2**24;return BigInt(Kt)+(BigInt(rn)<>>0,Vt(St,"offset");const At=this[St],Ot=this[St+7];(At===void 0||Ot===void 0)&&en(St,this.length-8);const Kt=At*2**24+this[++St]*2**16+this[++St]*2**8+this[++St],rn=this[++St]*2**24+this[++St]*2**16+this[++St]*2**8+Ot;return(BigInt(Kt)<>>0,At=At>>>0,Ot||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn=rn&&(Kt-=Math.pow(2,8*At)),Kt},st.prototype.readIntBE=function(St,At,Ot){St=St>>>0,At=At>>>0,Ot||Zt(St,At,this.length);let Kt=At,rn=1,sn=this[St+--Kt];for(;Kt>0&&(rn*=256);)sn+=this[St+--Kt]*rn;return rn*=128,sn>=rn&&(sn-=Math.pow(2,8*At)),sn},st.prototype.readInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]&128?(255-this[St]+1)*-1:this[St]},st.prototype.readInt16LE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const Ot=this[St]|this[St+1]<<8;return Ot&32768?Ot|4294901760:Ot},st.prototype.readInt16BE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const Ot=this[St+1]|this[St]<<8;return Ot&32768?Ot|4294901760:Ot},st.prototype.readInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]|this[St+1]<<8|this[St+2]<<16|this[St+3]<<24},st.prototype.readInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]<<24|this[St+1]<<16|this[St+2]<<8|this[St+3]},st.prototype.readBigInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],Ot=this[St+7];(At===void 0||Ot===void 0)&&en(St,this.length-8);const Kt=this[St+4]+this[St+5]*2**8+this[St+6]*2**16+(Ot<<24);return(BigInt(Kt)<>>0,Vt(St,"offset");const At=this[St],Ot=this[St+7];(At===void 0||Ot===void 0)&&en(St,this.length-8);const Kt=(At<<24)+this[++St]*2**16+this[++St]*2**8+this[++St];return(BigInt(Kt)<>>0,At||Zt(St,4,this.length),tt.read(this,St,!0,23,4)},st.prototype.readFloatBE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),tt.read(this,St,!1,23,4)},st.prototype.readDoubleLE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!0,52,8)},st.prototype.readDoubleBE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!1,52,8)};function Qt(_t,St,At,Ot,Kt,rn){if(!st.isBuffer(_t))throw new TypeError('"buffer" argument must be a Buffer instance');if(St>Kt||St_t.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(St,At,Ot,Kt){if(St=+St,At=At>>>0,Ot=Ot>>>0,!Kt){const xn=Math.pow(2,8*Ot)-1;Qt(this,St,At,Ot,xn,0)}let rn=1,sn=0;for(this[At]=St&255;++sn>>0,Ot=Ot>>>0,!Kt){const xn=Math.pow(2,8*Ot)-1;Qt(this,St,At,Ot,xn,0)}let rn=Ot-1,sn=1;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)this[At+rn]=St/sn&255;return At+Ot},st.prototype.writeUint8=st.prototype.writeUInt8=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,1,255,0),this[At]=St&255,At+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,2,65535,0),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,2,65535,0),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,4,4294967295,0),this[At+3]=St>>>24,this[At+2]=St>>>16,this[At+1]=St>>>8,this[At]=St&255,At+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,4,4294967295,0),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4};function Lt(_t,St,At,Ot,Kt){Dt(St,Ot,Kt,_t,At,7);let rn=Number(St&BigInt(4294967295));_t[At++]=rn,rn=rn>>8,_t[At++]=rn,rn=rn>>8,_t[At++]=rn,rn=rn>>8,_t[At++]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return _t[At++]=sn,sn=sn>>8,_t[At++]=sn,sn=sn>>8,_t[At++]=sn,sn=sn>>8,_t[At++]=sn,At}function Gt(_t,St,At,Ot,Kt){Dt(St,Ot,Kt,_t,At,7);let rn=Number(St&BigInt(4294967295));_t[At+7]=rn,rn=rn>>8,_t[At+6]=rn,rn=rn>>8,_t[At+5]=rn,rn=rn>>8,_t[At+4]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return _t[At+3]=sn,sn=sn>>8,_t[At+2]=sn,sn=sn>>8,_t[At+1]=sn,sn=sn>>8,_t[At]=sn,At+8}st.prototype.writeBigUInt64LE=En(function(St,At=0){return Lt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=En(function(St,At=0){return Gt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(St,At,Ot,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*Ot-1);Qt(this,St,At,Ot,Rn-1,-Rn)}let rn=0,sn=1,xn=0;for(this[At]=St&255;++rn>0)-xn&255;return At+Ot},st.prototype.writeIntBE=function(St,At,Ot,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*Ot-1);Qt(this,St,At,Ot,Rn-1,-Rn)}let rn=Ot-1,sn=1,xn=0;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)St<0&&xn===0&&this[At+rn+1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+Ot},st.prototype.writeInt8=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,1,127,-128),St<0&&(St=255+St+1),this[At]=St&255,At+1},st.prototype.writeInt16LE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,2,32767,-32768),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeInt16BE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,2,32767,-32768),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeInt32LE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,4,2147483647,-2147483648),this[At]=St&255,this[At+1]=St>>>8,this[At+2]=St>>>16,this[At+3]=St>>>24,At+4},st.prototype.writeInt32BE=function(St,At,Ot){return St=+St,At=At>>>0,Ot||Qt(this,St,At,4,2147483647,-2147483648),St<0&&(St=4294967295+St+1),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4},st.prototype.writeBigInt64LE=En(function(St,At=0){return Lt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=En(function(St,At=0){return Gt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nn(_t,St,At,Ot,Kt,rn){if(At+Ot>_t.length)throw new RangeError("Index out of range");if(At<0)throw new RangeError("Index out of range")}function Wt(_t,St,At,Ot,Kt){return St=+St,At=At>>>0,Kt||nn(_t,St,At,4),tt.write(_t,St,At,Ot,23,4),At+4}st.prototype.writeFloatLE=function(St,At,Ot){return Wt(this,St,At,!0,Ot)},st.prototype.writeFloatBE=function(St,At,Ot){return Wt(this,St,At,!1,Ot)};function hn(_t,St,At,Ot,Kt){return St=+St,At=At>>>0,Kt||nn(_t,St,At,8),tt.write(_t,St,At,Ot,52,8),At+8}st.prototype.writeDoubleLE=function(St,At,Ot){return hn(this,St,At,!0,Ot)},st.prototype.writeDoubleBE=function(St,At,Ot){return hn(this,St,At,!1,Ot)},st.prototype.copy=function(St,At,Ot,Kt){if(!st.isBuffer(St))throw new TypeError("argument should be a Buffer");if(Ot||(Ot=0),!Kt&&Kt!==0&&(Kt=this.length),At>=St.length&&(At=St.length),At||(At=0),Kt>0&&Kt=this.length)throw new RangeError("Index out of range");if(Kt<0)throw new RangeError("sourceEnd out of bounds");Kt>this.length&&(Kt=this.length),St.length-At>>0,Ot=Ot===void 0?this.length:Ot>>>0,St||(St=0);let rn;if(typeof St=="number")for(rn=At;rn2**32?Kt=tn(String(At)):typeof At=="bigint"&&(Kt=String(At),(At>BigInt(2)**BigInt(32)||At<-(BigInt(2)**BigInt(32)))&&(Kt=tn(Kt)),Kt+="n"),Ot+=` It must be ${St}. Received ${Kt}`,Ot},RangeError);function tn(_t){let St="",At=_t.length;const Ot=_t[0]==="-"?1:0;for(;At>=Ot+4;At-=3)St=`_${_t.slice(At-3,At)}${St}`;return`${_t.slice(0,At)}${St}`}function Tt(_t,St,At){Vt(St,"offset"),(_t[St]===void 0||_t[St+At]===void 0)&&en(St,_t.length-(At+1))}function Dt(_t,St,At,Ot,Kt,rn){if(_t>At||_t= 0${sn} and < 2${sn} ** ${(rn+1)*8}${sn}`:xn=`>= -(2${sn} ** ${(rn+1)*8-1}${sn}) and < 2 ** ${(rn+1)*8-1}${sn}`,new Xt.ERR_OUT_OF_RANGE("value",xn,_t)}Tt(Ot,Kt,rn)}function Vt(_t,St){if(typeof _t!="number")throw new Xt.ERR_INVALID_ARG_TYPE(St,"number",_t)}function en(_t,St,At){throw Math.floor(_t)!==_t?(Vt(_t,At),new Xt.ERR_OUT_OF_RANGE("offset","an integer",_t)):St<0?new Xt.ERR_BUFFER_OUT_OF_BOUNDS:new Xt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${St}`,_t)}const an=/[^+/0-9A-Za-z-_]/g;function dn(_t){if(_t=_t.split("=")[0],_t=_t.trim().replace(an,""),_t.length<2)return"";for(;_t.length%4!==0;)_t=_t+"=";return _t}function ln(_t,St){St=St||1/0;let At;const Ot=_t.length;let Kt=null;const rn=[];for(let sn=0;sn55295&&At<57344){if(!Kt){if(At>56319){(St-=3)>-1&&rn.push(239,191,189);continue}else if(sn+1===Ot){(St-=3)>-1&&rn.push(239,191,189);continue}Kt=At;continue}if(At<56320){(St-=3)>-1&&rn.push(239,191,189),Kt=At;continue}At=(Kt-55296<<10|At-56320)+65536}else Kt&&(St-=3)>-1&&rn.push(239,191,189);if(Kt=null,At<128){if((St-=1)<0)break;rn.push(At)}else if(At<2048){if((St-=2)<0)break;rn.push(At>>6|192,At&63|128)}else if(At<65536){if((St-=3)<0)break;rn.push(At>>12|224,At>>6&63|128,At&63|128)}else if(At<1114112){if((St-=4)<0)break;rn.push(At>>18|240,At>>12&63|128,At>>6&63|128,At&63|128)}else throw new Error("Invalid code point")}return rn}function fn(_t){const St=[];for(let At=0;At<_t.length;++At)St.push(_t.charCodeAt(At)&255);return St}function kn(_t,St){let At,Ot,Kt;const rn=[];for(let sn=0;sn<_t.length&&!((St-=2)<0);++sn)At=_t.charCodeAt(sn),Ot=At>>8,Kt=At%256,rn.push(Kt),rn.push(Ot);return rn}function mn(_t){return et.toByteArray(dn(_t))}function wn(_t,St,At,Ot){let Kt;for(Kt=0;Kt=St.length||Kt>=_t.length);++Kt)St[Kt+At]=_t[Kt];return Kt}function _n(_t,St){return _t instanceof St||_t!=null&&_t.constructor!=null&&_t.constructor.name!=null&&_t.constructor.name===St.name}function $n(_t){return _t!==_t}const yn=function(){const _t="0123456789abcdef",St=new Array(256);for(let At=0;At<16;++At){const Ot=At*16;for(let Kt=0;Kt<16;++Kt)St[Ot+Kt]=_t[At]+_t[Kt]}return St}();function En(_t){return typeof BigInt>"u"?on:_t}function on(){throw new Error("BigInt not supported")}})(buffer$2);var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** * @license React * scheduler.production.min.js * @@ -28,7 +28,7 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(o){function et(Ut,qt){var Lt=Ut.length;Ut.push(qt);e:for(;0>>1,Qt=Ut[Zt];if(0>>1;Ztrt(nn,Lt))Wtrt(hn,nn)?(Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt):(Ut[Zt]=nn,Ut[Gt]=Lt,Zt=Gt);else if(Wtrt(hn,Lt))Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt;else break e}}return qt}function rt(Ut,qt){var Lt=Ut.sortIndex-qt.sortIndex;return Lt!==0?Lt:Ut.id-qt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var ot=performance;o.unstable_now=function(){return ot.now()}}else{var it=Date,st=it.now();o.unstable_now=function(){return it.now()-st}}var at=[],ct=[],lt=1,dt=null,ht=3,pt=!1,mt=!1,ft=!1,yt=typeof setTimeout=="function"?setTimeout:null,gt=typeof clearTimeout=="function"?clearTimeout:null,xt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function vt(Ut){for(var qt=tt(ct);qt!==null;){if(qt.callback===null)nt(ct);else if(qt.startTime<=Ut)nt(ct),qt.sortIndex=qt.expirationTime,et(at,qt);else break;qt=tt(ct)}}function bt(Ut){if(ft=!1,vt(Ut),!mt)if(tt(at)!==null)mt=!0,Yt(Et);else{var qt=tt(ct);qt!==null&&Ht(bt,qt.startTime-Ut)}}function Et(Ut,qt){mt=!1,ft&&(ft=!1,gt(It),It=-1),pt=!0;var Lt=ht;try{for(vt(qt),dt=tt(at);dt!==null&&(!(dt.expirationTime>qt)||Ut&&!jt());){var Zt=dt.callback;if(typeof Zt=="function"){dt.callback=null,ht=dt.priorityLevel;var Qt=Zt(dt.expirationTime<=qt);qt=o.unstable_now(),typeof Qt=="function"?dt.callback=Qt:dt===tt(at)&&nt(at),vt(qt)}else nt(at);dt=tt(at)}if(dt!==null)var Nt=!0;else{var Gt=tt(ct);Gt!==null&&Ht(bt,Gt.startTime-qt),Nt=!1}return Nt}finally{dt=null,ht=Lt,pt=!1}}var wt=!1,kt=null,It=-1,Rt=5,Pt=-1;function jt(){return!(o.unstable_now()-PtUt||125Zt?(Ut.sortIndex=Lt,et(ct,Ut),tt(at)===null&&Ut===tt(ct)&&(ft?(gt(It),It=-1):ft=!0,Ht(bt,Lt-Zt))):(Ut.sortIndex=Qt,et(at,Ut),mt||pt||(mt=!0,Yt(Et))),Ut},o.unstable_shouldYield=jt,o.unstable_wrapCallback=function(Ut){var qt=ht;return function(){var Lt=ht;ht=qt;try{return Ut.apply(this,arguments)}finally{ht=Lt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + */(function(o){function et(Ut,qt){var Pt=Ut.length;Ut.push(qt);e:for(;0>>1,Qt=Ut[Zt];if(0>>1;Ztrt(nn,Pt))Wtrt(hn,nn)?(Ut[Zt]=hn,Ut[Wt]=Pt,Zt=Wt):(Ut[Zt]=nn,Ut[Gt]=Pt,Zt=Gt);else if(Wtrt(hn,Pt))Ut[Zt]=hn,Ut[Wt]=Pt,Zt=Wt;else break e}}return qt}function rt(Ut,qt){var Pt=Ut.sortIndex-qt.sortIndex;return Pt!==0?Pt:Ut.id-qt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var ot=performance;o.unstable_now=function(){return ot.now()}}else{var it=Date,st=it.now();o.unstable_now=function(){return it.now()-st}}var at=[],ct=[],lt=1,dt=null,ht=3,ft=!1,mt=!1,pt=!1,yt=typeof setTimeout=="function"?setTimeout:null,gt=typeof clearTimeout=="function"?clearTimeout:null,xt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function vt(Ut){for(var qt=tt(ct);qt!==null;){if(qt.callback===null)nt(ct);else if(qt.startTime<=Ut)nt(ct),qt.sortIndex=qt.expirationTime,et(at,qt);else break;qt=tt(ct)}}function bt(Ut){if(pt=!1,vt(Ut),!mt)if(tt(at)!==null)mt=!0,Yt(Et);else{var qt=tt(ct);qt!==null&&Ht(bt,qt.startTime-Ut)}}function Et(Ut,qt){mt=!1,pt&&(pt=!1,gt(It),It=-1),ft=!0;var Pt=ht;try{for(vt(qt),dt=tt(at);dt!==null&&(!(dt.expirationTime>qt)||Ut&&!Nt());){var Zt=dt.callback;if(typeof Zt=="function"){dt.callback=null,ht=dt.priorityLevel;var Qt=Zt(dt.expirationTime<=qt);qt=o.unstable_now(),typeof Qt=="function"?dt.callback=Qt:dt===tt(at)&&nt(at),vt(qt)}else nt(at);dt=tt(at)}if(dt!==null)var Lt=!0;else{var Gt=tt(ct);Gt!==null&&Ht(bt,Gt.startTime-qt),Lt=!1}return Lt}finally{dt=null,ht=Pt,ft=!1}}var wt=!1,kt=null,It=-1,Rt=5,$t=-1;function Nt(){return!(o.unstable_now()-$tUt||125Zt?(Ut.sortIndex=Pt,et(ct,Ut),tt(at)===null&&Ut===tt(ct)&&(pt?(gt(It),It=-1):pt=!0,Ht(bt,Pt-Zt))):(Ut.sortIndex=Qt,et(at,Ut),mt||ft||(mt=!0,Yt(Et))),Ut},o.unstable_shouldYield=Nt,o.unstable_wrapCallback=function(Ut){var qt=ht;return function(){var Pt=ht;ht=qt;try{return Ut.apply(this,arguments)}finally{ht=Pt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** * @license React * react-dom.production.min.js * @@ -40,10 +40,10 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et `+La+o}var Na=!1;function Oa(o,et){if(!o||Na)return"";Na=!0;var tt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(et)if(et=function(){throw Error()},Object.defineProperty(et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(et,[])}catch(ct){var nt=ct}Reflect.construct(o,[],et)}else{try{et.call()}catch(ct){nt=ct}o.call(et.prototype)}else{try{throw Error()}catch(ct){nt=ct}o()}}catch(ct){if(ct&&nt&&typeof ct.stack=="string"){for(var rt=ct.stack.split(` `),ot=nt.stack.split(` `),it=rt.length-1,st=ot.length-1;1<=it&&0<=st&&rt[it]!==ot[st];)st--;for(;1<=it&&0<=st;it--,st--)if(rt[it]!==ot[st]){if(it!==1||st!==1)do if(it--,st--,0>st||rt[it]!==ot[st]){var at=` -`+rt[it].replace(" at new "," at ");return o.displayName&&at.includes("")&&(at=at.replace("",o.displayName)),at}while(1<=it&&0<=st);break}}}finally{Na=!1,Error.prepareStackTrace=tt}return(o=o?o.displayName||o.name:"")?Ma(o):""}function Pa(o){switch(o.tag){case 5:return Ma(o.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return o=Oa(o.type,!1),o;case 11:return o=Oa(o.type.render,!1),o;case 1:return o=Oa(o.type,!0),o;default:return""}}function Qa(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){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 o=="object")switch(o.$$typeof){case Ca:return(o.displayName||"Context")+".Consumer";case Ba:return(o._context.displayName||"Context")+".Provider";case Da:var et=o.render;return o=o.displayName,o||(o=et.displayName||et.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ga:return et=o.displayName||null,et!==null?et:Qa(o.type)||"Memo";case Ha:et=o._payload,o=o._init;try{return Qa(o(et))}catch{}}return null}function Ra(o){var et=o.type;switch(o.tag){case 24:return"Cache";case 9:return(et.displayName||"Context")+".Consumer";case 10:return(et._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=et.render,o=o.displayName||o.name||"",et.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return et;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(et);case 8:return et===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 et=="function")return et.displayName||et.name||null;if(typeof et=="string")return et}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ta(o){var et=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(et==="checkbox"||et==="radio")}function Ua(o){var et=Ta(o)?"checked":"value",tt=Object.getOwnPropertyDescriptor(o.constructor.prototype,et),nt=""+o[et];if(!o.hasOwnProperty(et)&&typeof tt<"u"&&typeof tt.get=="function"&&typeof tt.set=="function"){var rt=tt.get,ot=tt.set;return Object.defineProperty(o,et,{configurable:!0,get:function(){return rt.call(this)},set:function(it){nt=""+it,ot.call(this,it)}}),Object.defineProperty(o,et,{enumerable:tt.enumerable}),{getValue:function(){return nt},setValue:function(it){nt=""+it},stopTracking:function(){o._valueTracker=null,delete o[et]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var et=o._valueTracker;if(!et)return!0;var tt=et.getValue(),nt="";return o&&(nt=Ta(o)?o.checked?"true":"false":o.value),o=nt,o!==tt?(et.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,et){var tt=et.checked;return A$1({},et,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:tt??o._wrapperState.initialChecked})}function Za(o,et){var tt=et.defaultValue==null?"":et.defaultValue,nt=et.checked!=null?et.checked:et.defaultChecked;tt=Sa(et.value!=null?et.value:tt),o._wrapperState={initialChecked:nt,initialValue:tt,controlled:et.type==="checkbox"||et.type==="radio"?et.checked!=null:et.value!=null}}function ab(o,et){et=et.checked,et!=null&&ta(o,"checked",et,!1)}function bb(o,et){ab(o,et);var tt=Sa(et.value),nt=et.type;if(tt!=null)nt==="number"?(tt===0&&o.value===""||o.value!=tt)&&(o.value=""+tt):o.value!==""+tt&&(o.value=""+tt);else if(nt==="submit"||nt==="reset"){o.removeAttribute("value");return}et.hasOwnProperty("value")?cb$1(o,et.type,tt):et.hasOwnProperty("defaultValue")&&cb$1(o,et.type,Sa(et.defaultValue)),et.checked==null&&et.defaultChecked!=null&&(o.defaultChecked=!!et.defaultChecked)}function db(o,et,tt){if(et.hasOwnProperty("value")||et.hasOwnProperty("defaultValue")){var nt=et.type;if(!(nt!=="submit"&&nt!=="reset"||et.value!==void 0&&et.value!==null))return;et=""+o._wrapperState.initialValue,tt||et===o.value||(o.value=et),o.defaultValue=et}tt=o.name,tt!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,tt!==""&&(o.name=tt)}function cb$1(o,et,tt){(et!=="number"||Xa(o.ownerDocument)!==o)&&(tt==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+tt&&(o.defaultValue=""+tt))}var eb=Array.isArray;function fb(o,et,tt,nt){if(o=o.options,et){et={};for(var rt=0;rt"+et.valueOf().toString()+"",et=mb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;et.firstChild;)o.appendChild(et.firstChild)}});function ob(o,et){if(et){var tt=o.firstChild;if(tt&&tt===o.lastChild&&tt.nodeType===3){tt.nodeValue=et;return}}o.textContent=et}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(o){qb.forEach(function(et){et=et+o.charAt(0).toUpperCase()+o.substring(1),pb[et]=pb[o]})});function rb(o,et,tt){return et==null||typeof et=="boolean"||et===""?"":tt||typeof et!="number"||et===0||pb.hasOwnProperty(o)&&pb[o]?(""+et).trim():et+"px"}function sb(o,et){o=o.style;for(var tt in et)if(et.hasOwnProperty(tt)){var nt=tt.indexOf("--")===0,rt=rb(tt,et[tt],nt);tt==="float"&&(tt="cssFloat"),nt?o.setProperty(tt,rt):o[tt]=rt}}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(o,et){if(et){if(tb[o]&&(et.children!=null||et.dangerouslySetInnerHTML!=null))throw Error(p$4(137,o));if(et.dangerouslySetInnerHTML!=null){if(et.children!=null)throw Error(p$4(60));if(typeof et.dangerouslySetInnerHTML!="object"||!("__html"in et.dangerouslySetInnerHTML))throw Error(p$4(61))}if(et.style!=null&&typeof et.style!="object")throw Error(p$4(62))}}function vb(o,et){if(o.indexOf("-")===-1)return typeof et.is=="string";switch(o){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(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(p$4(280));var et=o.stateNode;et&&(et=Db(et),yb(o.stateNode,o.type,et))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,et=Ab;if(Ab=zb=null,Bb(o),et)for(o=0;o>>=0,o===0?32:31-(pc(o)/qc|0)|0}var rc=64,sc=4194304;function tc(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function uc(o,et){var tt=o.pendingLanes;if(tt===0)return 0;var nt=0,rt=o.suspendedLanes,ot=o.pingedLanes,it=tt&268435455;if(it!==0){var st=it&~rt;st!==0?nt=tc(st):(ot&=it,ot!==0&&(nt=tc(ot)))}else it=tt&~rt,it!==0?nt=tc(it):ot!==0&&(nt=tc(ot));if(nt===0)return 0;if(et!==0&&et!==nt&&!(et&rt)&&(rt=nt&-nt,ot=et&-et,rt>=ot||rt===16&&(ot&4194240)!==0))return et;if(nt&4&&(nt|=tt&16),et=o.entangledLanes,et!==0)for(o=o.entanglements,et&=nt;0tt;tt++)et.push(o);return et}function Ac(o,et,tt){o.pendingLanes|=et,et!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,et=31-oc(et),o[et]=tt}function Bc(o,et){var tt=o.pendingLanes&~et;o.pendingLanes=et,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=et,o.mutableReadLanes&=et,o.entangledLanes&=et,et=o.entanglements;var nt=o.eventTimes;for(o=o.expirationTimes;0=be$1),ee$1=" ",fe$1=!1;function ge$1(o,et){switch(o){case"keyup":return $d.indexOf(et.keyCode)!==-1;case"keydown":return et.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie$1=!1;function je$1(o,et){switch(o){case"compositionend":return he$1(et);case"keypress":return et.which!==32?null:(fe$1=!0,ee$1);case"textInput":return o=et.data,o===ee$1&&fe$1?null:o;default:return null}}function ke$1(o,et){if(ie$1)return o==="compositionend"||!ae$1&&ge$1(o,et)?(o=nd(),md=ld=kd=null,ie$1=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(et.ctrlKey||et.altKey||et.metaKey)||et.ctrlKey&&et.altKey){if(et.char&&1=et)return{node:tt,offset:et-o};o=nt}e:{for(;tt;){if(tt.nextSibling){tt=tt.nextSibling;break e}tt=tt.parentNode}tt=void 0}tt=Je(tt)}}function Le$1(o,et){return o&&et?o===et?!0:o&&o.nodeType===3?!1:et&&et.nodeType===3?Le$1(o,et.parentNode):"contains"in o?o.contains(et):o.compareDocumentPosition?!!(o.compareDocumentPosition(et)&16):!1:!1}function Me$1(){for(var o=window,et=Xa();et instanceof o.HTMLIFrameElement;){try{var tt=typeof et.contentWindow.location.href=="string"}catch{tt=!1}if(tt)o=et.contentWindow;else break;et=Xa(o.document)}return et}function Ne$1(o){var et=o&&o.nodeName&&o.nodeName.toLowerCase();return et&&(et==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||et==="textarea"||o.contentEditable==="true")}function Oe$1(o){var et=Me$1(),tt=o.focusedElem,nt=o.selectionRange;if(et!==tt&&tt&&tt.ownerDocument&&Le$1(tt.ownerDocument.documentElement,tt)){if(nt!==null&&Ne$1(tt)){if(et=nt.start,o=nt.end,o===void 0&&(o=et),"selectionStart"in tt)tt.selectionStart=et,tt.selectionEnd=Math.min(o,tt.value.length);else if(o=(et=tt.ownerDocument||document)&&et.defaultView||window,o.getSelection){o=o.getSelection();var rt=tt.textContent.length,ot=Math.min(nt.start,rt);nt=nt.end===void 0?ot:Math.min(nt.end,rt),!o.extend&&ot>nt&&(rt=nt,nt=ot,ot=rt),rt=Ke(tt,ot);var it=Ke(tt,nt);rt&&it&&(o.rangeCount!==1||o.anchorNode!==rt.node||o.anchorOffset!==rt.offset||o.focusNode!==it.node||o.focusOffset!==it.offset)&&(et=et.createRange(),et.setStart(rt.node,rt.offset),o.removeAllRanges(),ot>nt?(o.addRange(et),o.extend(it.node,it.offset)):(et.setEnd(it.node,it.offset),o.addRange(et)))}}for(et=[],o=tt;o=o.parentNode;)o.nodeType===1&&et.push({element:o,left:o.scrollLeft,top:o.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(o,et,tt){var nt=tt.window===tt?tt.document:tt.nodeType===9?tt:tt.ownerDocument;Te$1||Qe==null||Qe!==Xa(nt)||(nt=Qe,"selectionStart"in nt&&Ne$1(nt)?nt={start:nt.selectionStart,end:nt.selectionEnd}:(nt=(nt.ownerDocument&&nt.ownerDocument.defaultView||window).getSelection(),nt={anchorNode:nt.anchorNode,anchorOffset:nt.anchorOffset,focusNode:nt.focusNode,focusOffset:nt.focusOffset}),Se$1&&Ie(Se$1,nt)||(Se$1=nt,nt=oe$1(Re$1,"onSelect"),0Tf||(o.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(o,et){Tf++,Sf[Tf]=o.current,o.current=et}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(o,et){var tt=o.type.contextTypes;if(!tt)return Vf;var nt=o.stateNode;if(nt&&nt.__reactInternalMemoizedUnmaskedChildContext===et)return nt.__reactInternalMemoizedMaskedChildContext;var rt={},ot;for(ot in tt)rt[ot]=et[ot];return nt&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=et,o.__reactInternalMemoizedMaskedChildContext=rt),rt}function Zf(o){return o=o.childContextTypes,o!=null}function $f(){E$1(Wf),E$1(H$1)}function ag(o,et,tt){if(H$1.current!==Vf)throw Error(p$4(168));G$1(H$1,et),G$1(Wf,tt)}function bg(o,et,tt){var nt=o.stateNode;if(et=et.childContextTypes,typeof nt.getChildContext!="function")return tt;nt=nt.getChildContext();for(var rt in nt)if(!(rt in et))throw Error(p$4(108,Ra(o)||"Unknown",rt));return A$1({},tt,nt)}function cg(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G$1(H$1,o),G$1(Wf,Wf.current),!0}function dg(o,et,tt){var nt=o.stateNode;if(!nt)throw Error(p$4(169));tt?(o=bg(o,et,Xf),nt.__reactInternalMemoizedMergedChildContext=o,E$1(Wf),E$1(H$1),G$1(H$1,o)):E$1(Wf),G$1(Wf,tt)}var eg=null,fg=!1,gg=!1;function hg(o){eg===null?eg=[o]:eg.push(o)}function ig(o){fg=!0,hg(o)}function jg(){if(!gg&&eg!==null){gg=!0;var o=0,et=C$1;try{var tt=eg;for(C$1=1;o>=it,rt-=it,rg=1<<32-oc(et)+rt|tt<It?(Rt=kt,kt=null):Rt=kt.sibling;var Pt=ht(gt,kt,vt[It],bt);if(Pt===null){kt===null&&(kt=Rt);break}o&&kt&&Pt.alternate===null&&et(gt,kt),xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt,kt=Rt}if(It===vt.length)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;ItIt?(Rt=kt,kt=null):Rt=kt.sibling;var jt=ht(gt,kt,Pt.value,bt);if(jt===null){kt===null&&(kt=Rt);break}o&&kt&&jt.alternate===null&&et(gt,kt),xt=ot(jt,xt,It),wt===null?Et=jt:wt.sibling=jt,wt=jt,kt=Rt}if(Pt.done)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;!Pt.done;It++,Pt=vt.next())Pt=dt(gt,Pt.value,bt),Pt!==null&&(xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return I$1&&tg(gt,It),Et}for(kt=nt(gt,kt);!Pt.done;It++,Pt=vt.next())Pt=pt(kt,gt,It,Pt.value,bt),Pt!==null&&(o&&Pt.alternate!==null&&kt.delete(Pt.key===null?It:Pt.key),xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return o&&kt.forEach(function(Ot){return et(gt,Ot)}),I$1&&tg(gt,It),Et}function yt(gt,xt,vt,bt){if(typeof vt=="object"&&vt!==null&&vt.type===ya&&vt.key===null&&(vt=vt.props.children),typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case va:e:{for(var Et=vt.key,wt=xt;wt!==null;){if(wt.key===Et){if(Et=vt.type,Et===ya){if(wt.tag===7){tt(gt,wt.sibling),xt=rt(wt,vt.props.children),xt.return=gt,gt=xt;break e}}else if(wt.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===Ha&&Ng(Et)===wt.type){tt(gt,wt.sibling),xt=rt(wt,vt.props),xt.ref=Lg(gt,wt,vt),xt.return=gt,gt=xt;break e}tt(gt,wt);break}else et(gt,wt);wt=wt.sibling}vt.type===ya?(xt=Tg(vt.props.children,gt.mode,bt,vt.key),xt.return=gt,gt=xt):(bt=Rg(vt.type,vt.key,vt.props,null,gt.mode,bt),bt.ref=Lg(gt,xt,vt),bt.return=gt,gt=bt)}return it(gt);case wa:e:{for(wt=vt.key;xt!==null;){if(xt.key===wt)if(xt.tag===4&&xt.stateNode.containerInfo===vt.containerInfo&&xt.stateNode.implementation===vt.implementation){tt(gt,xt.sibling),xt=rt(xt,vt.children||[]),xt.return=gt,gt=xt;break e}else{tt(gt,xt);break}else et(gt,xt);xt=xt.sibling}xt=Sg(vt,gt.mode,bt),xt.return=gt,gt=xt}return it(gt);case Ha:return wt=vt._init,yt(gt,xt,wt(vt._payload),bt)}if(eb(vt))return mt(gt,xt,vt,bt);if(Ka(vt))return ft(gt,xt,vt,bt);Mg(gt,vt)}return typeof vt=="string"&&vt!==""||typeof vt=="number"?(vt=""+vt,xt!==null&&xt.tag===6?(tt(gt,xt.sibling),xt=rt(xt,vt),xt.return=gt,gt=xt):(tt(gt,xt),xt=Qg(vt,gt.mode,bt),xt.return=gt,gt=xt),it(gt)):tt(gt,xt)}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(o){var et=Wg.current;E$1(Wg),o._currentValue=et}function bh(o,et,tt){for(;o!==null;){var nt=o.alternate;if((o.childLanes&et)!==et?(o.childLanes|=et,nt!==null&&(nt.childLanes|=et)):nt!==null&&(nt.childLanes&et)!==et&&(nt.childLanes|=et),o===tt)break;o=o.return}}function ch(o,et){Xg=o,Zg=Yg=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&et&&(dh=!0),o.firstContext=null)}function eh(o){var et=o._currentValue;if(Zg!==o)if(o={context:o,memoizedValue:et,next:null},Yg===null){if(Xg===null)throw Error(p$4(308));Yg=o,Xg.dependencies={lanes:0,firstContext:o}}else Yg=Yg.next=o;return et}var fh=null;function gh(o){fh===null?fh=[o]:fh.push(o)}function hh(o,et,tt,nt){var rt=et.interleaved;return rt===null?(tt.next=tt,gh(et)):(tt.next=rt.next,rt.next=tt),et.interleaved=tt,ih(o,nt)}function ih(o,et){o.lanes|=et;var tt=o.alternate;for(tt!==null&&(tt.lanes|=et),tt=o,o=o.return;o!==null;)o.childLanes|=et,tt=o.alternate,tt!==null&&(tt.childLanes|=et),tt=o,o=o.return;return tt.tag===3?tt.stateNode:null}var jh=!1;function kh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(o,et){o=o.updateQueue,et.updateQueue===o&&(et.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function mh(o,et){return{eventTime:o,lane:et,tag:0,payload:null,callback:null,next:null}}function nh(o,et,tt){var nt=o.updateQueue;if(nt===null)return null;if(nt=nt.shared,K$1&2){var rt=nt.pending;return rt===null?et.next=et:(et.next=rt.next,rt.next=et),nt.pending=et,ih(o,tt)}return rt=nt.interleaved,rt===null?(et.next=et,gh(nt)):(et.next=rt.next,rt.next=et),nt.interleaved=et,ih(o,tt)}function oh(o,et,tt){if(et=et.updateQueue,et!==null&&(et=et.shared,(tt&4194240)!==0)){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}function ph(o,et){var tt=o.updateQueue,nt=o.alternate;if(nt!==null&&(nt=nt.updateQueue,tt===nt)){var rt=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?rt=ot=it:ot=ot.next=it,tt=tt.next}while(tt!==null);ot===null?rt=ot=et:ot=ot.next=et}else rt=ot=et;tt={baseState:nt.baseState,firstBaseUpdate:rt,lastBaseUpdate:ot,shared:nt.shared,effects:nt.effects},o.updateQueue=tt;return}o=tt.lastBaseUpdate,o===null?tt.firstBaseUpdate=et:o.next=et,tt.lastBaseUpdate=et}function qh(o,et,tt,nt){var rt=o.updateQueue;jh=!1;var ot=rt.firstBaseUpdate,it=rt.lastBaseUpdate,st=rt.shared.pending;if(st!==null){rt.shared.pending=null;var at=st,ct=at.next;at.next=null,it===null?ot=ct:it.next=ct,it=at;var lt=o.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=rt.baseState;it=0,lt=ct=at=null,st=ot;do{var ht=st.lane,pt=st.eventTime;if((nt&ht)===ht){lt!==null&&(lt=lt.next={eventTime:pt,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var mt=o,ft=st;switch(ht=et,pt=tt,ft.tag){case 1:if(mt=ft.payload,typeof mt=="function"){dt=mt.call(pt,dt,ht);break e}dt=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=ft.payload,ht=typeof mt=="function"?mt.call(pt,dt,ht):mt,ht==null)break e;dt=A$1({},dt,ht);break e;case 2:jh=!0}}st.callback!==null&&st.lane!==0&&(o.flags|=64,ht=rt.effects,ht===null?rt.effects=[st]:ht.push(st))}else pt={eventTime:pt,lane:ht,tag:st.tag,payload:st.payload,callback:st.callback,next:null},lt===null?(ct=lt=pt,at=dt):lt=lt.next=pt,it|=ht;if(st=st.next,st===null){if(st=rt.shared.pending,st===null)break;ht=st,st=ht.next,ht.next=null,rt.lastBaseUpdate=ht,rt.shared.pending=null}}while(!0);if(lt===null&&(at=dt),rt.baseState=at,rt.firstBaseUpdate=ct,rt.lastBaseUpdate=lt,et=rt.shared.interleaved,et!==null){rt=et;do it|=rt.lane,rt=rt.next;while(rt!==et)}else ot===null&&(rt.shared.lanes=0);rh|=it,o.lanes=it,o.memoizedState=dt}}function sh(o,et,tt){if(o=et.effects,et.effects=null,o!==null)for(et=0;ettt?tt:4,o(!0);var nt=Gh.transition;Gh.transition={};try{o(!1),et()}finally{C$1=tt,Gh.transition=nt}}function wi(){return Uh().memoizedState}function xi(o,et,tt){var nt=yi(o);if(tt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null},zi(o))Ai(et,tt);else if(tt=hh(o,et,tt,nt),tt!==null){var rt=R();gi(tt,o,nt,rt),Bi(tt,et,nt)}}function ii(o,et,tt){var nt=yi(o),rt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null};if(zi(o))Ai(et,rt);else{var ot=o.alternate;if(o.lanes===0&&(ot===null||ot.lanes===0)&&(ot=et.lastRenderedReducer,ot!==null))try{var it=et.lastRenderedState,st=ot(it,tt);if(rt.hasEagerState=!0,rt.eagerState=st,He(st,it)){var at=et.interleaved;at===null?(rt.next=rt,gh(et)):(rt.next=at.next,at.next=rt),et.interleaved=rt;return}}catch{}finally{}tt=hh(o,et,rt,nt),tt!==null&&(rt=R(),gi(tt,o,nt,rt),Bi(tt,et,nt))}}function zi(o){var et=o.alternate;return o===M$1||et!==null&&et===M$1}function Ai(o,et){Jh=Ih=!0;var tt=o.pending;tt===null?et.next=et:(et.next=tt.next,tt.next=et),o.pending=et}function Bi(o,et,tt){if(tt&4194240){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,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(o,et){return Th().memoizedState=[o,et===void 0?null:et],o},useContext:eh,useEffect:mi,useImperativeHandle:function(o,et,tt){return tt=tt!=null?tt.concat([o]):null,ki(4194308,4,pi.bind(null,et,o),tt)},useLayoutEffect:function(o,et){return ki(4194308,4,o,et)},useInsertionEffect:function(o,et){return ki(4,2,o,et)},useMemo:function(o,et){var tt=Th();return et=et===void 0?null:et,o=o(),tt.memoizedState=[o,et],o},useReducer:function(o,et,tt){var nt=Th();return et=tt!==void 0?tt(et):et,nt.memoizedState=nt.baseState=et,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:et},nt.queue=o,o=o.dispatch=xi.bind(null,M$1,o),[nt.memoizedState,o]},useRef:function(o){var et=Th();return o={current:o},et.memoizedState=o},useState:hi,useDebugValue:ri,useDeferredValue:function(o){return Th().memoizedState=o},useTransition:function(){var o=hi(!1),et=o[0];return o=vi.bind(null,o[1]),Th().memoizedState=o,[et,o]},useMutableSource:function(){},useSyncExternalStore:function(o,et,tt){var nt=M$1,rt=Th();if(I$1){if(tt===void 0)throw Error(p$4(407));tt=tt()}else{if(tt=et(),Q$1===null)throw Error(p$4(349));Hh&30||di(nt,et,tt)}rt.memoizedState=tt;var ot={value:tt,getSnapshot:et};return rt.queue=ot,mi(ai.bind(null,nt,ot,o),[o]),nt.flags|=2048,bi(9,ci.bind(null,nt,ot,tt,et),void 0,null),tt},useId:function(){var o=Th(),et=Q$1.identifierPrefix;if(I$1){var tt=sg,nt=rg;tt=(nt&~(1<<32-oc(nt)-1)).toString(32)+tt,et=":"+et+"R"+tt,tt=Kh++,0")&&(at=at.replace("",o.displayName)),at}while(1<=it&&0<=st);break}}}finally{Na=!1,Error.prepareStackTrace=tt}return(o=o?o.displayName||o.name:"")?Ma(o):""}function Pa(o){switch(o.tag){case 5:return Ma(o.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return o=Oa(o.type,!1),o;case 11:return o=Oa(o.type.render,!1),o;case 1:return o=Oa(o.type,!0),o;default:return""}}function Qa(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){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 o=="object")switch(o.$$typeof){case Ca:return(o.displayName||"Context")+".Consumer";case Ba:return(o._context.displayName||"Context")+".Provider";case Da:var et=o.render;return o=o.displayName,o||(o=et.displayName||et.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ga:return et=o.displayName||null,et!==null?et:Qa(o.type)||"Memo";case Ha:et=o._payload,o=o._init;try{return Qa(o(et))}catch{}}return null}function Ra(o){var et=o.type;switch(o.tag){case 24:return"Cache";case 9:return(et.displayName||"Context")+".Consumer";case 10:return(et._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=et.render,o=o.displayName||o.name||"",et.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return et;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(et);case 8:return et===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 et=="function")return et.displayName||et.name||null;if(typeof et=="string")return et}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ta(o){var et=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(et==="checkbox"||et==="radio")}function Ua(o){var et=Ta(o)?"checked":"value",tt=Object.getOwnPropertyDescriptor(o.constructor.prototype,et),nt=""+o[et];if(!o.hasOwnProperty(et)&&typeof tt<"u"&&typeof tt.get=="function"&&typeof tt.set=="function"){var rt=tt.get,ot=tt.set;return Object.defineProperty(o,et,{configurable:!0,get:function(){return rt.call(this)},set:function(it){nt=""+it,ot.call(this,it)}}),Object.defineProperty(o,et,{enumerable:tt.enumerable}),{getValue:function(){return nt},setValue:function(it){nt=""+it},stopTracking:function(){o._valueTracker=null,delete o[et]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var et=o._valueTracker;if(!et)return!0;var tt=et.getValue(),nt="";return o&&(nt=Ta(o)?o.checked?"true":"false":o.value),o=nt,o!==tt?(et.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,et){var tt=et.checked;return A$1({},et,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:tt??o._wrapperState.initialChecked})}function Za(o,et){var tt=et.defaultValue==null?"":et.defaultValue,nt=et.checked!=null?et.checked:et.defaultChecked;tt=Sa(et.value!=null?et.value:tt),o._wrapperState={initialChecked:nt,initialValue:tt,controlled:et.type==="checkbox"||et.type==="radio"?et.checked!=null:et.value!=null}}function ab(o,et){et=et.checked,et!=null&&ta(o,"checked",et,!1)}function bb(o,et){ab(o,et);var tt=Sa(et.value),nt=et.type;if(tt!=null)nt==="number"?(tt===0&&o.value===""||o.value!=tt)&&(o.value=""+tt):o.value!==""+tt&&(o.value=""+tt);else if(nt==="submit"||nt==="reset"){o.removeAttribute("value");return}et.hasOwnProperty("value")?cb$1(o,et.type,tt):et.hasOwnProperty("defaultValue")&&cb$1(o,et.type,Sa(et.defaultValue)),et.checked==null&&et.defaultChecked!=null&&(o.defaultChecked=!!et.defaultChecked)}function db(o,et,tt){if(et.hasOwnProperty("value")||et.hasOwnProperty("defaultValue")){var nt=et.type;if(!(nt!=="submit"&&nt!=="reset"||et.value!==void 0&&et.value!==null))return;et=""+o._wrapperState.initialValue,tt||et===o.value||(o.value=et),o.defaultValue=et}tt=o.name,tt!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,tt!==""&&(o.name=tt)}function cb$1(o,et,tt){(et!=="number"||Xa(o.ownerDocument)!==o)&&(tt==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+tt&&(o.defaultValue=""+tt))}var eb=Array.isArray;function fb(o,et,tt,nt){if(o=o.options,et){et={};for(var rt=0;rt"+et.valueOf().toString()+"",et=mb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;et.firstChild;)o.appendChild(et.firstChild)}});function ob(o,et){if(et){var tt=o.firstChild;if(tt&&tt===o.lastChild&&tt.nodeType===3){tt.nodeValue=et;return}}o.textContent=et}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(o){qb.forEach(function(et){et=et+o.charAt(0).toUpperCase()+o.substring(1),pb[et]=pb[o]})});function rb(o,et,tt){return et==null||typeof et=="boolean"||et===""?"":tt||typeof et!="number"||et===0||pb.hasOwnProperty(o)&&pb[o]?(""+et).trim():et+"px"}function sb(o,et){o=o.style;for(var tt in et)if(et.hasOwnProperty(tt)){var nt=tt.indexOf("--")===0,rt=rb(tt,et[tt],nt);tt==="float"&&(tt="cssFloat"),nt?o.setProperty(tt,rt):o[tt]=rt}}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(o,et){if(et){if(tb[o]&&(et.children!=null||et.dangerouslySetInnerHTML!=null))throw Error(p$4(137,o));if(et.dangerouslySetInnerHTML!=null){if(et.children!=null)throw Error(p$4(60));if(typeof et.dangerouslySetInnerHTML!="object"||!("__html"in et.dangerouslySetInnerHTML))throw Error(p$4(61))}if(et.style!=null&&typeof et.style!="object")throw Error(p$4(62))}}function vb(o,et){if(o.indexOf("-")===-1)return typeof et.is=="string";switch(o){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(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(p$4(280));var et=o.stateNode;et&&(et=Db(et),yb(o.stateNode,o.type,et))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,et=Ab;if(Ab=zb=null,Bb(o),et)for(o=0;o>>=0,o===0?32:31-(pc(o)/qc|0)|0}var rc=64,sc=4194304;function tc(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function uc(o,et){var tt=o.pendingLanes;if(tt===0)return 0;var nt=0,rt=o.suspendedLanes,ot=o.pingedLanes,it=tt&268435455;if(it!==0){var st=it&~rt;st!==0?nt=tc(st):(ot&=it,ot!==0&&(nt=tc(ot)))}else it=tt&~rt,it!==0?nt=tc(it):ot!==0&&(nt=tc(ot));if(nt===0)return 0;if(et!==0&&et!==nt&&!(et&rt)&&(rt=nt&-nt,ot=et&-et,rt>=ot||rt===16&&(ot&4194240)!==0))return et;if(nt&4&&(nt|=tt&16),et=o.entangledLanes,et!==0)for(o=o.entanglements,et&=nt;0tt;tt++)et.push(o);return et}function Ac(o,et,tt){o.pendingLanes|=et,et!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,et=31-oc(et),o[et]=tt}function Bc(o,et){var tt=o.pendingLanes&~et;o.pendingLanes=et,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=et,o.mutableReadLanes&=et,o.entangledLanes&=et,et=o.entanglements;var nt=o.eventTimes;for(o=o.expirationTimes;0=be$1),ee$1=" ",fe$1=!1;function ge$1(o,et){switch(o){case"keyup":return $d.indexOf(et.keyCode)!==-1;case"keydown":return et.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie$1=!1;function je$1(o,et){switch(o){case"compositionend":return he$1(et);case"keypress":return et.which!==32?null:(fe$1=!0,ee$1);case"textInput":return o=et.data,o===ee$1&&fe$1?null:o;default:return null}}function ke$1(o,et){if(ie$1)return o==="compositionend"||!ae$1&&ge$1(o,et)?(o=nd(),md=ld=kd=null,ie$1=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(et.ctrlKey||et.altKey||et.metaKey)||et.ctrlKey&&et.altKey){if(et.char&&1=et)return{node:tt,offset:et-o};o=nt}e:{for(;tt;){if(tt.nextSibling){tt=tt.nextSibling;break e}tt=tt.parentNode}tt=void 0}tt=Je(tt)}}function Le$1(o,et){return o&&et?o===et?!0:o&&o.nodeType===3?!1:et&&et.nodeType===3?Le$1(o,et.parentNode):"contains"in o?o.contains(et):o.compareDocumentPosition?!!(o.compareDocumentPosition(et)&16):!1:!1}function Me$1(){for(var o=window,et=Xa();et instanceof o.HTMLIFrameElement;){try{var tt=typeof et.contentWindow.location.href=="string"}catch{tt=!1}if(tt)o=et.contentWindow;else break;et=Xa(o.document)}return et}function Ne$1(o){var et=o&&o.nodeName&&o.nodeName.toLowerCase();return et&&(et==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||et==="textarea"||o.contentEditable==="true")}function Oe$1(o){var et=Me$1(),tt=o.focusedElem,nt=o.selectionRange;if(et!==tt&&tt&&tt.ownerDocument&&Le$1(tt.ownerDocument.documentElement,tt)){if(nt!==null&&Ne$1(tt)){if(et=nt.start,o=nt.end,o===void 0&&(o=et),"selectionStart"in tt)tt.selectionStart=et,tt.selectionEnd=Math.min(o,tt.value.length);else if(o=(et=tt.ownerDocument||document)&&et.defaultView||window,o.getSelection){o=o.getSelection();var rt=tt.textContent.length,ot=Math.min(nt.start,rt);nt=nt.end===void 0?ot:Math.min(nt.end,rt),!o.extend&&ot>nt&&(rt=nt,nt=ot,ot=rt),rt=Ke(tt,ot);var it=Ke(tt,nt);rt&&it&&(o.rangeCount!==1||o.anchorNode!==rt.node||o.anchorOffset!==rt.offset||o.focusNode!==it.node||o.focusOffset!==it.offset)&&(et=et.createRange(),et.setStart(rt.node,rt.offset),o.removeAllRanges(),ot>nt?(o.addRange(et),o.extend(it.node,it.offset)):(et.setEnd(it.node,it.offset),o.addRange(et)))}}for(et=[],o=tt;o=o.parentNode;)o.nodeType===1&&et.push({element:o,left:o.scrollLeft,top:o.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(o,et,tt){var nt=tt.window===tt?tt.document:tt.nodeType===9?tt:tt.ownerDocument;Te$1||Qe==null||Qe!==Xa(nt)||(nt=Qe,"selectionStart"in nt&&Ne$1(nt)?nt={start:nt.selectionStart,end:nt.selectionEnd}:(nt=(nt.ownerDocument&&nt.ownerDocument.defaultView||window).getSelection(),nt={anchorNode:nt.anchorNode,anchorOffset:nt.anchorOffset,focusNode:nt.focusNode,focusOffset:nt.focusOffset}),Se$1&&Ie(Se$1,nt)||(Se$1=nt,nt=oe$1(Re$1,"onSelect"),0Tf||(o.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(o,et){Tf++,Sf[Tf]=o.current,o.current=et}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(o,et){var tt=o.type.contextTypes;if(!tt)return Vf;var nt=o.stateNode;if(nt&&nt.__reactInternalMemoizedUnmaskedChildContext===et)return nt.__reactInternalMemoizedMaskedChildContext;var rt={},ot;for(ot in tt)rt[ot]=et[ot];return nt&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=et,o.__reactInternalMemoizedMaskedChildContext=rt),rt}function Zf(o){return o=o.childContextTypes,o!=null}function $f(){E$1(Wf),E$1(H$1)}function ag(o,et,tt){if(H$1.current!==Vf)throw Error(p$4(168));G$1(H$1,et),G$1(Wf,tt)}function bg(o,et,tt){var nt=o.stateNode;if(et=et.childContextTypes,typeof nt.getChildContext!="function")return tt;nt=nt.getChildContext();for(var rt in nt)if(!(rt in et))throw Error(p$4(108,Ra(o)||"Unknown",rt));return A$1({},tt,nt)}function cg(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G$1(H$1,o),G$1(Wf,Wf.current),!0}function dg(o,et,tt){var nt=o.stateNode;if(!nt)throw Error(p$4(169));tt?(o=bg(o,et,Xf),nt.__reactInternalMemoizedMergedChildContext=o,E$1(Wf),E$1(H$1),G$1(H$1,o)):E$1(Wf),G$1(Wf,tt)}var eg=null,fg=!1,gg=!1;function hg(o){eg===null?eg=[o]:eg.push(o)}function ig(o){fg=!0,hg(o)}function jg(){if(!gg&&eg!==null){gg=!0;var o=0,et=C$1;try{var tt=eg;for(C$1=1;o>=it,rt-=it,rg=1<<32-oc(et)+rt|tt<It?(Rt=kt,kt=null):Rt=kt.sibling;var $t=ht(gt,kt,vt[It],bt);if($t===null){kt===null&&(kt=Rt);break}o&&kt&&$t.alternate===null&&et(gt,kt),xt=ot($t,xt,It),wt===null?Et=$t:wt.sibling=$t,wt=$t,kt=Rt}if(It===vt.length)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;ItIt?(Rt=kt,kt=null):Rt=kt.sibling;var Nt=ht(gt,kt,$t.value,bt);if(Nt===null){kt===null&&(kt=Rt);break}o&&kt&&Nt.alternate===null&&et(gt,kt),xt=ot(Nt,xt,It),wt===null?Et=Nt:wt.sibling=Nt,wt=Nt,kt=Rt}if($t.done)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;!$t.done;It++,$t=vt.next())$t=dt(gt,$t.value,bt),$t!==null&&(xt=ot($t,xt,It),wt===null?Et=$t:wt.sibling=$t,wt=$t);return I$1&&tg(gt,It),Et}for(kt=nt(gt,kt);!$t.done;It++,$t=vt.next())$t=ft(kt,gt,It,$t.value,bt),$t!==null&&(o&&$t.alternate!==null&&kt.delete($t.key===null?It:$t.key),xt=ot($t,xt,It),wt===null?Et=$t:wt.sibling=$t,wt=$t);return o&&kt.forEach(function(Mt){return et(gt,Mt)}),I$1&&tg(gt,It),Et}function yt(gt,xt,vt,bt){if(typeof vt=="object"&&vt!==null&&vt.type===ya&&vt.key===null&&(vt=vt.props.children),typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case va:e:{for(var Et=vt.key,wt=xt;wt!==null;){if(wt.key===Et){if(Et=vt.type,Et===ya){if(wt.tag===7){tt(gt,wt.sibling),xt=rt(wt,vt.props.children),xt.return=gt,gt=xt;break e}}else if(wt.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===Ha&&Ng(Et)===wt.type){tt(gt,wt.sibling),xt=rt(wt,vt.props),xt.ref=Lg(gt,wt,vt),xt.return=gt,gt=xt;break e}tt(gt,wt);break}else et(gt,wt);wt=wt.sibling}vt.type===ya?(xt=Tg(vt.props.children,gt.mode,bt,vt.key),xt.return=gt,gt=xt):(bt=Rg(vt.type,vt.key,vt.props,null,gt.mode,bt),bt.ref=Lg(gt,xt,vt),bt.return=gt,gt=bt)}return it(gt);case wa:e:{for(wt=vt.key;xt!==null;){if(xt.key===wt)if(xt.tag===4&&xt.stateNode.containerInfo===vt.containerInfo&&xt.stateNode.implementation===vt.implementation){tt(gt,xt.sibling),xt=rt(xt,vt.children||[]),xt.return=gt,gt=xt;break e}else{tt(gt,xt);break}else et(gt,xt);xt=xt.sibling}xt=Sg(vt,gt.mode,bt),xt.return=gt,gt=xt}return it(gt);case Ha:return wt=vt._init,yt(gt,xt,wt(vt._payload),bt)}if(eb(vt))return mt(gt,xt,vt,bt);if(Ka(vt))return pt(gt,xt,vt,bt);Mg(gt,vt)}return typeof vt=="string"&&vt!==""||typeof vt=="number"?(vt=""+vt,xt!==null&&xt.tag===6?(tt(gt,xt.sibling),xt=rt(xt,vt),xt.return=gt,gt=xt):(tt(gt,xt),xt=Qg(vt,gt.mode,bt),xt.return=gt,gt=xt),it(gt)):tt(gt,xt)}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(o){var et=Wg.current;E$1(Wg),o._currentValue=et}function bh(o,et,tt){for(;o!==null;){var nt=o.alternate;if((o.childLanes&et)!==et?(o.childLanes|=et,nt!==null&&(nt.childLanes|=et)):nt!==null&&(nt.childLanes&et)!==et&&(nt.childLanes|=et),o===tt)break;o=o.return}}function ch(o,et){Xg=o,Zg=Yg=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&et&&(dh=!0),o.firstContext=null)}function eh(o){var et=o._currentValue;if(Zg!==o)if(o={context:o,memoizedValue:et,next:null},Yg===null){if(Xg===null)throw Error(p$4(308));Yg=o,Xg.dependencies={lanes:0,firstContext:o}}else Yg=Yg.next=o;return et}var fh=null;function gh(o){fh===null?fh=[o]:fh.push(o)}function hh(o,et,tt,nt){var rt=et.interleaved;return rt===null?(tt.next=tt,gh(et)):(tt.next=rt.next,rt.next=tt),et.interleaved=tt,ih(o,nt)}function ih(o,et){o.lanes|=et;var tt=o.alternate;for(tt!==null&&(tt.lanes|=et),tt=o,o=o.return;o!==null;)o.childLanes|=et,tt=o.alternate,tt!==null&&(tt.childLanes|=et),tt=o,o=o.return;return tt.tag===3?tt.stateNode:null}var jh=!1;function kh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(o,et){o=o.updateQueue,et.updateQueue===o&&(et.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function mh(o,et){return{eventTime:o,lane:et,tag:0,payload:null,callback:null,next:null}}function nh(o,et,tt){var nt=o.updateQueue;if(nt===null)return null;if(nt=nt.shared,K$1&2){var rt=nt.pending;return rt===null?et.next=et:(et.next=rt.next,rt.next=et),nt.pending=et,ih(o,tt)}return rt=nt.interleaved,rt===null?(et.next=et,gh(nt)):(et.next=rt.next,rt.next=et),nt.interleaved=et,ih(o,tt)}function oh(o,et,tt){if(et=et.updateQueue,et!==null&&(et=et.shared,(tt&4194240)!==0)){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}function ph(o,et){var tt=o.updateQueue,nt=o.alternate;if(nt!==null&&(nt=nt.updateQueue,tt===nt)){var rt=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?rt=ot=it:ot=ot.next=it,tt=tt.next}while(tt!==null);ot===null?rt=ot=et:ot=ot.next=et}else rt=ot=et;tt={baseState:nt.baseState,firstBaseUpdate:rt,lastBaseUpdate:ot,shared:nt.shared,effects:nt.effects},o.updateQueue=tt;return}o=tt.lastBaseUpdate,o===null?tt.firstBaseUpdate=et:o.next=et,tt.lastBaseUpdate=et}function qh(o,et,tt,nt){var rt=o.updateQueue;jh=!1;var ot=rt.firstBaseUpdate,it=rt.lastBaseUpdate,st=rt.shared.pending;if(st!==null){rt.shared.pending=null;var at=st,ct=at.next;at.next=null,it===null?ot=ct:it.next=ct,it=at;var lt=o.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=rt.baseState;it=0,lt=ct=at=null,st=ot;do{var ht=st.lane,ft=st.eventTime;if((nt&ht)===ht){lt!==null&&(lt=lt.next={eventTime:ft,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var mt=o,pt=st;switch(ht=et,ft=tt,pt.tag){case 1:if(mt=pt.payload,typeof mt=="function"){dt=mt.call(ft,dt,ht);break e}dt=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=pt.payload,ht=typeof mt=="function"?mt.call(ft,dt,ht):mt,ht==null)break e;dt=A$1({},dt,ht);break e;case 2:jh=!0}}st.callback!==null&&st.lane!==0&&(o.flags|=64,ht=rt.effects,ht===null?rt.effects=[st]:ht.push(st))}else ft={eventTime:ft,lane:ht,tag:st.tag,payload:st.payload,callback:st.callback,next:null},lt===null?(ct=lt=ft,at=dt):lt=lt.next=ft,it|=ht;if(st=st.next,st===null){if(st=rt.shared.pending,st===null)break;ht=st,st=ht.next,ht.next=null,rt.lastBaseUpdate=ht,rt.shared.pending=null}}while(!0);if(lt===null&&(at=dt),rt.baseState=at,rt.firstBaseUpdate=ct,rt.lastBaseUpdate=lt,et=rt.shared.interleaved,et!==null){rt=et;do it|=rt.lane,rt=rt.next;while(rt!==et)}else ot===null&&(rt.shared.lanes=0);rh|=it,o.lanes=it,o.memoizedState=dt}}function sh(o,et,tt){if(o=et.effects,et.effects=null,o!==null)for(et=0;ettt?tt:4,o(!0);var nt=Gh.transition;Gh.transition={};try{o(!1),et()}finally{C$1=tt,Gh.transition=nt}}function wi(){return Uh().memoizedState}function xi(o,et,tt){var nt=yi(o);if(tt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null},zi(o))Ai(et,tt);else if(tt=hh(o,et,tt,nt),tt!==null){var rt=R();gi(tt,o,nt,rt),Bi(tt,et,nt)}}function ii(o,et,tt){var nt=yi(o),rt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null};if(zi(o))Ai(et,rt);else{var ot=o.alternate;if(o.lanes===0&&(ot===null||ot.lanes===0)&&(ot=et.lastRenderedReducer,ot!==null))try{var it=et.lastRenderedState,st=ot(it,tt);if(rt.hasEagerState=!0,rt.eagerState=st,He(st,it)){var at=et.interleaved;at===null?(rt.next=rt,gh(et)):(rt.next=at.next,at.next=rt),et.interleaved=rt;return}}catch{}finally{}tt=hh(o,et,rt,nt),tt!==null&&(rt=R(),gi(tt,o,nt,rt),Bi(tt,et,nt))}}function zi(o){var et=o.alternate;return o===M$1||et!==null&&et===M$1}function Ai(o,et){Jh=Ih=!0;var tt=o.pending;tt===null?et.next=et:(et.next=tt.next,tt.next=et),o.pending=et}function Bi(o,et,tt){if(tt&4194240){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,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(o,et){return Th().memoizedState=[o,et===void 0?null:et],o},useContext:eh,useEffect:mi,useImperativeHandle:function(o,et,tt){return tt=tt!=null?tt.concat([o]):null,ki(4194308,4,pi.bind(null,et,o),tt)},useLayoutEffect:function(o,et){return ki(4194308,4,o,et)},useInsertionEffect:function(o,et){return ki(4,2,o,et)},useMemo:function(o,et){var tt=Th();return et=et===void 0?null:et,o=o(),tt.memoizedState=[o,et],o},useReducer:function(o,et,tt){var nt=Th();return et=tt!==void 0?tt(et):et,nt.memoizedState=nt.baseState=et,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:et},nt.queue=o,o=o.dispatch=xi.bind(null,M$1,o),[nt.memoizedState,o]},useRef:function(o){var et=Th();return o={current:o},et.memoizedState=o},useState:hi,useDebugValue:ri,useDeferredValue:function(o){return Th().memoizedState=o},useTransition:function(){var o=hi(!1),et=o[0];return o=vi.bind(null,o[1]),Th().memoizedState=o,[et,o]},useMutableSource:function(){},useSyncExternalStore:function(o,et,tt){var nt=M$1,rt=Th();if(I$1){if(tt===void 0)throw Error(p$4(407));tt=tt()}else{if(tt=et(),Q$1===null)throw Error(p$4(349));Hh&30||di(nt,et,tt)}rt.memoizedState=tt;var ot={value:tt,getSnapshot:et};return rt.queue=ot,mi(ai.bind(null,nt,ot,o),[o]),nt.flags|=2048,bi(9,ci.bind(null,nt,ot,tt,et),void 0,null),tt},useId:function(){var o=Th(),et=Q$1.identifierPrefix;if(I$1){var tt=sg,nt=rg;tt=(nt&~(1<<32-oc(nt)-1)).toString(32)+tt,et=":"+et+"R"+tt,tt=Kh++,0<\/script>",o=o.removeChild(o.firstChild)):typeof nt.is=="string"?o=it.createElement(tt,{is:nt.is}):(o=it.createElement(tt),tt==="select"&&(it=o,nt.multiple?it.multiple=!0:nt.size&&(it.size=nt.size))):o=it.createElementNS(o,tt),o[Of]=et,o[Pf]=nt,zj(o,et,!1,!1),et.stateNode=o;e:{switch(it=vb(tt,nt),tt){case"dialog":D$1("cancel",o),D$1("close",o),rt=nt;break;case"iframe":case"object":case"embed":D$1("load",o),rt=nt;break;case"video":case"audio":for(rt=0;rtGj&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304)}else{if(!nt)if(o=Ch(it),o!==null){if(et.flags|=128,nt=!0,tt=o.updateQueue,tt!==null&&(et.updateQueue=tt,et.flags|=4),Dj(ot,!0),ot.tail===null&&ot.tailMode==="hidden"&&!it.alternate&&!I$1)return S$1(et),null}else 2*B$1()-ot.renderingStartTime>Gj&&tt!==1073741824&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304);ot.isBackwards?(it.sibling=et.child,et.child=it):(tt=ot.last,tt!==null?tt.sibling=it:et.child=it,ot.last=it)}return ot.tail!==null?(et=ot.tail,ot.rendering=et,ot.tail=et.sibling,ot.renderingStartTime=B$1(),et.sibling=null,tt=L$1.current,G$1(L$1,nt?tt&1|2:tt&1),et):(S$1(et),null);case 22:case 23:return Hj(),nt=et.memoizedState!==null,o!==null&&o.memoizedState!==null!==nt&&(et.flags|=8192),nt&&et.mode&1?fj&1073741824&&(S$1(et),et.subtreeFlags&6&&(et.flags|=8192)):S$1(et),null;case 24:return null;case 25:return null}throw Error(p$4(156,et.tag))}function Ij(o,et){switch(wg(et),et.tag){case 1:return Zf(et.type)&&$f(),o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 3:return zh(),E$1(Wf),E$1(H$1),Eh(),o=et.flags,o&65536&&!(o&128)?(et.flags=o&-65537|128,et):null;case 5:return Bh(et),null;case 13:if(E$1(L$1),o=et.memoizedState,o!==null&&o.dehydrated!==null){if(et.alternate===null)throw Error(p$4(340));Ig()}return o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 19:return E$1(L$1),null;case 4:return zh(),null;case 10:return ah(et.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(o,et){var tt=o.ref;if(tt!==null)if(typeof tt=="function")try{tt(null)}catch(nt){W$1(o,et,nt)}else tt.current=null}function Mj(o,et,tt){try{tt()}catch(nt){W$1(o,et,nt)}}var Nj=!1;function Oj(o,et){if(Cf=dd,o=Me$1(),Ne$1(o)){if("selectionStart"in o)var tt={start:o.selectionStart,end:o.selectionEnd};else e:{tt=(tt=o.ownerDocument)&&tt.defaultView||window;var nt=tt.getSelection&&tt.getSelection();if(nt&&nt.rangeCount!==0){tt=nt.anchorNode;var rt=nt.anchorOffset,ot=nt.focusNode;nt=nt.focusOffset;try{tt.nodeType,ot.nodeType}catch{tt=null;break e}var it=0,st=-1,at=-1,ct=0,lt=0,dt=o,ht=null;t:for(;;){for(var pt;dt!==tt||rt!==0&&dt.nodeType!==3||(st=it+rt),dt!==ot||nt!==0&&dt.nodeType!==3||(at=it+nt),dt.nodeType===3&&(it+=dt.nodeValue.length),(pt=dt.firstChild)!==null;)ht=dt,dt=pt;for(;;){if(dt===o)break t;if(ht===tt&&++ct===rt&&(st=it),ht===ot&&++lt===nt&&(at=it),(pt=dt.nextSibling)!==null)break;dt=ht,ht=dt.parentNode}dt=pt}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:o,selectionRange:tt},dd=!1,V$2=et;V$2!==null;)if(et=V$2,o=et.child,(et.subtreeFlags&1028)!==0&&o!==null)o.return=et,V$2=o;else for(;V$2!==null;){et=V$2;try{var mt=et.alternate;if(et.flags&1024)switch(et.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var ft=mt.memoizedProps,yt=mt.memoizedState,gt=et.stateNode,xt=gt.getSnapshotBeforeUpdate(et.elementType===et.type?ft:Ci(et.type,ft),yt);gt.__reactInternalSnapshotBeforeUpdate=xt}break;case 3:var vt=et.stateNode.containerInfo;vt.nodeType===1?vt.textContent="":vt.nodeType===9&&vt.documentElement&&vt.removeChild(vt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$4(163))}}catch(bt){W$1(et,et.return,bt)}if(o=et.sibling,o!==null){o.return=et.return,V$2=o;break}V$2=et.return}return mt=Nj,Nj=!1,mt}function Pj(o,et,tt){var nt=et.updateQueue;if(nt=nt!==null?nt.lastEffect:null,nt!==null){var rt=nt=nt.next;do{if((rt.tag&o)===o){var ot=rt.destroy;rt.destroy=void 0,ot!==void 0&&Mj(et,tt,ot)}rt=rt.next}while(rt!==nt)}}function Qj(o,et){if(et=et.updateQueue,et=et!==null?et.lastEffect:null,et!==null){var tt=et=et.next;do{if((tt.tag&o)===o){var nt=tt.create;tt.destroy=nt()}tt=tt.next}while(tt!==et)}}function Rj(o){var et=o.ref;if(et!==null){var tt=o.stateNode;switch(o.tag){case 5:o=tt;break;default:o=tt}typeof et=="function"?et(o):et.current=o}}function Sj(o){var et=o.alternate;et!==null&&(o.alternate=null,Sj(et)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(et=o.stateNode,et!==null&&(delete et[Of],delete et[Pf],delete et[of],delete et[Qf],delete et[Rf])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Tj(o){return o.tag===5||o.tag===3||o.tag===4}function Uj(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Tj(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Vj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.nodeType===8?tt.parentNode.insertBefore(o,et):tt.insertBefore(o,et):(tt.nodeType===8?(et=tt.parentNode,et.insertBefore(o,tt)):(et=tt,et.appendChild(o)),tt=tt._reactRootContainer,tt!=null||et.onclick!==null||(et.onclick=Bf));else if(nt!==4&&(o=o.child,o!==null))for(Vj(o,et,tt),o=o.sibling;o!==null;)Vj(o,et,tt),o=o.sibling}function Wj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.insertBefore(o,et):tt.appendChild(o);else if(nt!==4&&(o=o.child,o!==null))for(Wj(o,et,tt),o=o.sibling;o!==null;)Wj(o,et,tt),o=o.sibling}var X$1=null,Xj=!1;function Yj(o,et,tt){for(tt=tt.child;tt!==null;)Zj(o,et,tt),tt=tt.sibling}function Zj(o,et,tt){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,tt)}catch{}switch(tt.tag){case 5:U$1||Lj(tt,et);case 6:var nt=X$1,rt=Xj;X$1=null,Yj(o,et,tt),X$1=nt,Xj=rt,X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?o.parentNode.removeChild(tt):o.removeChild(tt)):X$1.removeChild(tt.stateNode));break;case 18:X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?Kf(o.parentNode,tt):o.nodeType===1&&Kf(o,tt),bd(o)):Kf(X$1,tt.stateNode));break;case 4:nt=X$1,rt=Xj,X$1=tt.stateNode.containerInfo,Xj=!0,Yj(o,et,tt),X$1=nt,Xj=rt;break;case 0:case 11:case 14:case 15:if(!U$1&&(nt=tt.updateQueue,nt!==null&&(nt=nt.lastEffect,nt!==null))){rt=nt=nt.next;do{var ot=rt,it=ot.destroy;ot=ot.tag,it!==void 0&&(ot&2||ot&4)&&Mj(tt,et,it),rt=rt.next}while(rt!==nt)}Yj(o,et,tt);break;case 1:if(!U$1&&(Lj(tt,et),nt=tt.stateNode,typeof nt.componentWillUnmount=="function"))try{nt.props=tt.memoizedProps,nt.state=tt.memoizedState,nt.componentWillUnmount()}catch(st){W$1(tt,et,st)}Yj(o,et,tt);break;case 21:Yj(o,et,tt);break;case 22:tt.mode&1?(U$1=(nt=U$1)||tt.memoizedState!==null,Yj(o,et,tt),U$1=nt):Yj(o,et,tt);break;default:Yj(o,et,tt)}}function ak(o){var et=o.updateQueue;if(et!==null){o.updateQueue=null;var tt=o.stateNode;tt===null&&(tt=o.stateNode=new Kj),et.forEach(function(nt){var rt=bk.bind(null,o,nt);tt.has(nt)||(tt.add(nt),nt.then(rt,rt))})}}function ck(o,et){var tt=et.deletions;if(tt!==null)for(var nt=0;ntrt&&(rt=it),nt&=~ot}if(nt=rt,nt=B$1()-nt,nt=(120>nt?120:480>nt?480:1080>nt?1080:1920>nt?1920:3e3>nt?3e3:4320>nt?4320:1960*lk(nt/1960))-nt,10o?16:o,wk===null)var nt=!1;else{if(o=wk,wk=null,xk=0,K$1&6)throw Error(p$4(331));var rt=K$1;for(K$1|=4,V$2=o.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(o,0):rk|=tt),Dk(o,et)}function Yk(o,et){et===0&&(o.mode&1?(et=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):et=1);var tt=R();o=ih(o,et),o!==null&&(Ac(o,et,tt),Dk(o,tt))}function uj(o){var et=o.memoizedState,tt=0;et!==null&&(tt=et.retryLane),Yk(o,tt)}function bk(o,et){var tt=0;switch(o.tag){case 13:var nt=o.stateNode,rt=o.memoizedState;rt!==null&&(tt=rt.retryLane);break;case 19:nt=o.stateNode;break;default:throw Error(p$4(314))}nt!==null&&nt.delete(et),Yk(o,tt)}var Vk;Vk=function(o,et,tt){if(o!==null)if(o.memoizedProps!==et.pendingProps||Wf.current)dh=!0;else{if(!(o.lanes&tt)&&!(et.flags&128))return dh=!1,yj(o,et,tt);dh=!!(o.flags&131072)}else dh=!1,I$1&&et.flags&1048576&&ug(et,ng,et.index);switch(et.lanes=0,et.tag){case 2:var nt=et.type;ij(o,et),o=et.pendingProps;var rt=Yf(et,H$1.current);ch(et,tt),rt=Nh(null,et,nt,o,rt,tt);var ot=Sh();return et.flags|=1,typeof rt=="object"&&rt!==null&&typeof rt.render=="function"&&rt.$$typeof===void 0?(et.tag=1,et.memoizedState=null,et.updateQueue=null,Zf(nt)?(ot=!0,cg(et)):ot=!1,et.memoizedState=rt.state!==null&&rt.state!==void 0?rt.state:null,kh(et),rt.updater=Ei,et.stateNode=rt,rt._reactInternals=et,Ii(et,nt,o,tt),et=jj(null,et,nt,!0,ot,tt)):(et.tag=0,I$1&&ot&&vg(et),Xi(null,et,rt,tt),et=et.child),et;case 16:nt=et.elementType;e:{switch(ij(o,et),o=et.pendingProps,rt=nt._init,nt=rt(nt._payload),et.type=nt,rt=et.tag=Zk(nt),o=Ci(nt,o),rt){case 0:et=cj(null,et,nt,o,tt);break e;case 1:et=hj(null,et,nt,o,tt);break e;case 11:et=Yi(null,et,nt,o,tt);break e;case 14:et=$i(null,et,nt,Ci(nt.type,o),tt);break e}throw Error(p$4(306,nt,""))}return et;case 0:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),cj(o,et,nt,rt,tt);case 1:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),hj(o,et,nt,rt,tt);case 3:e:{if(kj(et),o===null)throw Error(p$4(387));nt=et.pendingProps,ot=et.memoizedState,rt=ot.element,lh(o,et),qh(et,nt,null,tt);var it=et.memoizedState;if(nt=it.element,ot.isDehydrated)if(ot={element:nt,isDehydrated:!1,cache:it.cache,pendingSuspenseBoundaries:it.pendingSuspenseBoundaries,transitions:it.transitions},et.updateQueue.baseState=ot,et.memoizedState=ot,et.flags&256){rt=Ji(Error(p$4(423)),et),et=lj(o,et,nt,tt,rt);break e}else if(nt!==rt){rt=Ji(Error(p$4(424)),et),et=lj(o,et,nt,tt,rt);break e}else for(yg=Lf(et.stateNode.containerInfo.firstChild),xg=et,I$1=!0,zg=null,tt=Vg(et,null,nt,tt),et.child=tt;tt;)tt.flags=tt.flags&-3|4096,tt=tt.sibling;else{if(Ig(),nt===rt){et=Zi(o,et,tt);break e}Xi(o,et,nt,tt)}et=et.child}return et;case 5:return Ah(et),o===null&&Eg(et),nt=et.type,rt=et.pendingProps,ot=o!==null?o.memoizedProps:null,it=rt.children,Ef(nt,rt)?it=null:ot!==null&&Ef(nt,ot)&&(et.flags|=32),gj(o,et),Xi(o,et,it,tt),et.child;case 6:return o===null&&Eg(et),null;case 13:return oj(o,et,tt);case 4:return yh(et,et.stateNode.containerInfo),nt=et.pendingProps,o===null?et.child=Ug(et,null,nt,tt):Xi(o,et,nt,tt),et.child;case 11:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),Yi(o,et,nt,rt,tt);case 7:return Xi(o,et,et.pendingProps,tt),et.child;case 8:return Xi(o,et,et.pendingProps.children,tt),et.child;case 12:return Xi(o,et,et.pendingProps.children,tt),et.child;case 10:e:{if(nt=et.type._context,rt=et.pendingProps,ot=et.memoizedProps,it=rt.value,G$1(Wg,nt._currentValue),nt._currentValue=it,ot!==null)if(He(ot.value,it)){if(ot.children===rt.children&&!Wf.current){et=Zi(o,et,tt);break e}}else for(ot=et.child,ot!==null&&(ot.return=et);ot!==null;){var st=ot.dependencies;if(st!==null){it=ot.child;for(var at=st.firstContext;at!==null;){if(at.context===nt){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,et),st.lanes|=tt;break}at=at.next}}else if(ot.tag===10)it=ot.type===et.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,et),it=ot.sibling}else it=ot.child;if(it!==null)it.return=ot;else for(it=ot;it!==null;){if(it===et){it=null;break}if(ot=it.sibling,ot!==null){ot.return=it.return,it=ot;break}it=it.return}ot=it}Xi(o,et,rt.children,tt),et=et.child}return et;case 9:return rt=et.type,nt=et.pendingProps.children,ch(et,tt),rt=eh(rt),nt=nt(rt),et.flags|=1,Xi(o,et,nt,tt),et.child;case 14:return nt=et.type,rt=Ci(nt,et.pendingProps),rt=Ci(nt.type,rt),$i(o,et,nt,rt,tt);case 15:return bj(o,et,et.type,et.pendingProps,tt);case 17:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),ij(o,et),et.tag=1,Zf(nt)?(o=!0,cg(et)):o=!1,ch(et,tt),Gi(et,nt,rt),Ii(et,nt,rt,tt),jj(null,et,nt,!0,o,tt);case 19:return xj(o,et,tt);case 22:return dj(o,et,tt)}throw Error(p$4(156,et.tag))};function Fk(o,et){return ac(o,et)}function $k(o,et,tt,nt){this.tag=o,this.key=tt,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=et,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=nt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(o,et,tt,nt){return new $k(o,et,tt,nt)}function aj(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Zk(o){if(typeof o=="function")return aj(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Da)return 11;if(o===Ga)return 14}return 2}function Pg(o,et){var tt=o.alternate;return tt===null?(tt=Bg(o.tag,et,o.key,o.mode),tt.elementType=o.elementType,tt.type=o.type,tt.stateNode=o.stateNode,tt.alternate=o,o.alternate=tt):(tt.pendingProps=et,tt.type=o.type,tt.flags=0,tt.subtreeFlags=0,tt.deletions=null),tt.flags=o.flags&14680064,tt.childLanes=o.childLanes,tt.lanes=o.lanes,tt.child=o.child,tt.memoizedProps=o.memoizedProps,tt.memoizedState=o.memoizedState,tt.updateQueue=o.updateQueue,et=o.dependencies,tt.dependencies=et===null?null:{lanes:et.lanes,firstContext:et.firstContext},tt.sibling=o.sibling,tt.index=o.index,tt.ref=o.ref,tt}function Rg(o,et,tt,nt,rt,ot){var it=2;if(nt=o,typeof o=="function")aj(o)&&(it=1);else if(typeof o=="string")it=5;else e:switch(o){case ya:return Tg(tt.children,rt,ot,et);case za:it=8,rt|=8;break;case Aa:return o=Bg(12,tt,et,rt|2),o.elementType=Aa,o.lanes=ot,o;case Ea:return o=Bg(13,tt,et,rt),o.elementType=Ea,o.lanes=ot,o;case Fa:return o=Bg(19,tt,et,rt),o.elementType=Fa,o.lanes=ot,o;case Ia:return pj(tt,rt,ot,et);default:if(typeof o=="object"&&o!==null)switch(o.$$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,nt=null;break e}throw Error(p$4(130,o==null?o:typeof o,""))}return et=Bg(it,tt,et,rt),et.elementType=o,et.type=nt,et.lanes=ot,et}function Tg(o,et,tt,nt){return o=Bg(7,o,nt,et),o.lanes=tt,o}function pj(o,et,tt,nt){return o=Bg(22,o,nt,et),o.elementType=Ia,o.lanes=tt,o.stateNode={isHidden:!1},o}function Qg(o,et,tt){return o=Bg(6,o,null,et),o.lanes=tt,o}function Sg(o,et,tt){return et=Bg(4,o.children!==null?o.children:[],o.key,et),et.lanes=tt,et.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},et}function al(o,et,tt,nt,rt){this.tag=et,this.containerInfo=o,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=nt,this.onRecoverableError=rt,this.mutableSourceEagerHydrationData=null}function bl(o,et,tt,nt,rt,ot,it,st,at){return o=new al(o,et,tt,st,at),et===1?(et=1,ot===!0&&(et|=8)):et=0,ot=Bg(3,null,null,et),o.current=ot,ot.stateNode=o,ot.memoizedState={element:nt,isDehydrated:tt,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(ot),o}function cl(o,et,tt){var nt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(o){console.error(o)}}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.44";let errorConfig={getDocsUrl:({docsBaseUrl:o,docsPath:et="",docsSlug:tt})=>et?`${o??"https://viem.sh"}${et}${tt?`#${tt}`:""}`:void 0,version:`viem@${version$8}`},BaseError$3=class Ss extends Error{constructor(et,tt={}){var st;const nt=(()=>{var at;return tt.cause instanceof Ss?tt.cause.details:(at=tt.cause)!=null&&at.message?tt.cause.message:tt.details})(),rt=tt.cause instanceof Ss&&tt.cause.docsPath||tt.docsPath,ot=(st=errorConfig.getDocsUrl)==null?void 0:st.call(errorConfig,{...tt,docsPath:rt}),it=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...ot?[`Docs: ${ot}`]:[],...nt?[`Details: ${nt}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(` +`+ot.stack}return{value:o,source:et,stack:rt,digest:null}}function Ki(o,et,tt){return{value:o,source:null,stack:tt??null,digest:et??null}}function Li(o,et){try{console.error(et.value)}catch(tt){setTimeout(function(){throw tt})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(o,et,tt){tt=mh(-1,tt),tt.tag=3,tt.payload={element:null};var nt=et.value;return tt.callback=function(){Oi||(Oi=!0,Pi=nt),Li(o,et)},tt}function Qi(o,et,tt){tt=mh(-1,tt),tt.tag=3;var nt=o.type.getDerivedStateFromError;if(typeof nt=="function"){var rt=et.value;tt.payload=function(){return nt(rt)},tt.callback=function(){Li(o,et)}}var ot=o.stateNode;return ot!==null&&typeof ot.componentDidCatch=="function"&&(tt.callback=function(){Li(o,et),typeof nt!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var it=et.stack;this.componentDidCatch(et.value,{componentStack:it!==null?it:""})}),tt}function Si(o,et,tt){var nt=o.pingCache;if(nt===null){nt=o.pingCache=new Mi;var rt=new Set;nt.set(et,rt)}else rt=nt.get(et),rt===void 0&&(rt=new Set,nt.set(et,rt));rt.has(tt)||(rt.add(tt),o=Ti.bind(null,o,et,tt),et.then(o,o))}function Ui(o){do{var et;if((et=o.tag===13)&&(et=o.memoizedState,et=et!==null?et.dehydrated!==null:!0),et)return o;o=o.return}while(o!==null);return null}function Vi(o,et,tt,nt,rt){return o.mode&1?(o.flags|=65536,o.lanes=rt,o):(o===et?o.flags|=65536:(o.flags|=128,tt.flags|=131072,tt.flags&=-52805,tt.tag===1&&(tt.alternate===null?tt.tag=17:(et=mh(-1,1),et.tag=2,nh(tt,et,1))),tt.lanes|=1),o)}var Wi=ua.ReactCurrentOwner,dh=!1;function Xi(o,et,tt,nt){et.child=o===null?Vg(et,null,tt,nt):Ug(et,o.child,tt,nt)}function Yi(o,et,tt,nt,rt){tt=tt.render;var ot=et.ref;return ch(et,rt),nt=Nh(o,et,tt,nt,ot,rt),tt=Sh(),o!==null&&!dh?(et.updateQueue=o.updateQueue,et.flags&=-2053,o.lanes&=~rt,Zi(o,et,rt)):(I$1&&tt&&vg(et),et.flags|=1,Xi(o,et,nt,rt),et.child)}function $i(o,et,tt,nt,rt){if(o===null){var ot=tt.type;return typeof ot=="function"&&!aj(ot)&&ot.defaultProps===void 0&&tt.compare===null&&tt.defaultProps===void 0?(et.tag=15,et.type=ot,bj(o,et,ot,nt,rt)):(o=Rg(tt.type,null,nt,et,et.mode,rt),o.ref=et.ref,o.return=et,et.child=o)}if(ot=o.child,!(o.lanes&rt)){var it=ot.memoizedProps;if(tt=tt.compare,tt=tt!==null?tt:Ie,tt(it,nt)&&o.ref===et.ref)return Zi(o,et,rt)}return et.flags|=1,o=Pg(ot,nt),o.ref=et.ref,o.return=et,et.child=o}function bj(o,et,tt,nt,rt){if(o!==null){var ot=o.memoizedProps;if(Ie(ot,nt)&&o.ref===et.ref)if(dh=!1,et.pendingProps=nt=ot,(o.lanes&rt)!==0)o.flags&131072&&(dh=!0);else return et.lanes=o.lanes,Zi(o,et,rt)}return cj(o,et,tt,nt,rt)}function dj(o,et,tt){var nt=et.pendingProps,rt=nt.children,ot=o!==null?o.memoizedState:null;if(nt.mode==="hidden")if(!(et.mode&1))et.memoizedState={baseLanes:0,cachePool:null,transitions:null},G$1(ej,fj),fj|=tt;else{if(!(tt&1073741824))return o=ot!==null?ot.baseLanes|tt:tt,et.lanes=et.childLanes=1073741824,et.memoizedState={baseLanes:o,cachePool:null,transitions:null},et.updateQueue=null,G$1(ej,fj),fj|=o,null;et.memoizedState={baseLanes:0,cachePool:null,transitions:null},nt=ot!==null?ot.baseLanes:tt,G$1(ej,fj),fj|=nt}else ot!==null?(nt=ot.baseLanes|tt,et.memoizedState=null):nt=tt,G$1(ej,fj),fj|=nt;return Xi(o,et,rt,tt),et.child}function gj(o,et){var tt=et.ref;(o===null&&tt!==null||o!==null&&o.ref!==tt)&&(et.flags|=512,et.flags|=2097152)}function cj(o,et,tt,nt,rt){var ot=Zf(tt)?Xf:H$1.current;return ot=Yf(et,ot),ch(et,rt),tt=Nh(o,et,tt,nt,ot,rt),nt=Sh(),o!==null&&!dh?(et.updateQueue=o.updateQueue,et.flags&=-2053,o.lanes&=~rt,Zi(o,et,rt)):(I$1&&nt&&vg(et),et.flags|=1,Xi(o,et,tt,rt),et.child)}function hj(o,et,tt,nt,rt){if(Zf(tt)){var ot=!0;cg(et)}else ot=!1;if(ch(et,rt),et.stateNode===null)ij(o,et),Gi(et,tt,nt),Ii(et,tt,nt,rt),nt=!0;else if(o===null){var it=et.stateNode,st=et.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(et,ct));var lt=tt.getDerivedStateFromProps,dt=typeof lt=="function"||typeof it.getSnapshotBeforeUpdate=="function";dt||typeof it.UNSAFE_componentWillReceiveProps!="function"&&typeof it.componentWillReceiveProps!="function"||(st!==nt||at!==ct)&&Hi(et,it,nt,ct),jh=!1;var ht=et.memoizedState;it.state=ht,qh(et,nt,it,rt),at=et.memoizedState,st!==nt||ht!==at||Wf.current||jh?(typeof lt=="function"&&(Di(et,tt,lt,nt),at=et.memoizedState),(st=jh||Fi(et,tt,st,nt,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"&&(et.flags|=4194308)):(typeof it.componentDidMount=="function"&&(et.flags|=4194308),et.memoizedProps=nt,et.memoizedState=at),it.props=nt,it.state=at,it.context=ct,nt=st):(typeof it.componentDidMount=="function"&&(et.flags|=4194308),nt=!1)}else{it=et.stateNode,lh(o,et),st=et.memoizedProps,ct=et.type===et.elementType?st:Ci(et.type,st),it.props=ct,dt=et.pendingProps,ht=it.context,at=tt.contextType,typeof at=="object"&&at!==null?at=eh(at):(at=Zf(tt)?Xf:H$1.current,at=Yf(et,at));var ft=tt.getDerivedStateFromProps;(lt=typeof ft=="function"||typeof it.getSnapshotBeforeUpdate=="function")||typeof it.UNSAFE_componentWillReceiveProps!="function"&&typeof it.componentWillReceiveProps!="function"||(st!==dt||ht!==at)&&Hi(et,it,nt,at),jh=!1,ht=et.memoizedState,it.state=ht,qh(et,nt,it,rt);var mt=et.memoizedState;st!==dt||ht!==mt||Wf.current||jh?(typeof ft=="function"&&(Di(et,tt,ft,nt),mt=et.memoizedState),(ct=jh||Fi(et,tt,ct,nt,ht,mt,at)||!1)?(lt||typeof it.UNSAFE_componentWillUpdate!="function"&&typeof it.componentWillUpdate!="function"||(typeof it.componentWillUpdate=="function"&&it.componentWillUpdate(nt,mt,at),typeof it.UNSAFE_componentWillUpdate=="function"&&it.UNSAFE_componentWillUpdate(nt,mt,at)),typeof it.componentDidUpdate=="function"&&(et.flags|=4),typeof it.getSnapshotBeforeUpdate=="function"&&(et.flags|=1024)):(typeof it.componentDidUpdate!="function"||st===o.memoizedProps&&ht===o.memoizedState||(et.flags|=4),typeof it.getSnapshotBeforeUpdate!="function"||st===o.memoizedProps&&ht===o.memoizedState||(et.flags|=1024),et.memoizedProps=nt,et.memoizedState=mt),it.props=nt,it.state=mt,it.context=at,nt=ct):(typeof it.componentDidUpdate!="function"||st===o.memoizedProps&&ht===o.memoizedState||(et.flags|=4),typeof it.getSnapshotBeforeUpdate!="function"||st===o.memoizedProps&&ht===o.memoizedState||(et.flags|=1024),nt=!1)}return jj(o,et,tt,nt,ot,rt)}function jj(o,et,tt,nt,rt,ot){gj(o,et);var it=(et.flags&128)!==0;if(!nt&&!it)return rt&&dg(et,tt,!1),Zi(o,et,ot);nt=et.stateNode,Wi.current=et;var st=it&&typeof tt.getDerivedStateFromError!="function"?null:nt.render();return et.flags|=1,o!==null&&it?(et.child=Ug(et,o.child,null,ot),et.child=Ug(et,null,st,ot)):Xi(o,et,st,ot),et.memoizedState=nt.state,rt&&dg(et,tt,!0),et.child}function kj(o){var et=o.stateNode;et.pendingContext?ag(o,et.pendingContext,et.pendingContext!==et.context):et.context&&ag(o,et.context,!1),yh(o,et.containerInfo)}function lj(o,et,tt,nt,rt){return Ig(),Jg(rt),et.flags|=256,Xi(o,et,tt,nt),et.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(o){return{baseLanes:o,cachePool:null,transitions:null}}function oj(o,et,tt){var nt=et.pendingProps,rt=L$1.current,ot=!1,it=(et.flags&128)!==0,st;if((st=it)||(st=o!==null&&o.memoizedState===null?!1:(rt&2)!==0),st?(ot=!0,et.flags&=-129):(o===null||o.memoizedState!==null)&&(rt|=1),G$1(L$1,rt&1),o===null)return Eg(et),o=et.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?(et.mode&1?o.data==="$!"?et.lanes=8:et.lanes=1073741824:et.lanes=1,null):(it=nt.children,o=nt.fallback,ot?(nt=et.mode,ot=et.child,it={mode:"hidden",children:it},!(nt&1)&&ot!==null?(ot.childLanes=0,ot.pendingProps=it):ot=pj(it,nt,0,null),o=Tg(o,nt,tt,null),ot.return=et,o.return=et,ot.sibling=o,et.child=ot,et.child.memoizedState=nj(tt),et.memoizedState=mj,o):qj(et,it));if(rt=o.memoizedState,rt!==null&&(st=rt.dehydrated,st!==null))return rj(o,et,it,nt,st,rt,tt);if(ot){ot=nt.fallback,it=et.mode,rt=o.child,st=rt.sibling;var at={mode:"hidden",children:nt.children};return!(it&1)&&et.child!==rt?(nt=et.child,nt.childLanes=0,nt.pendingProps=at,et.deletions=null):(nt=Pg(rt,at),nt.subtreeFlags=rt.subtreeFlags&14680064),st!==null?ot=Pg(st,ot):(ot=Tg(ot,it,tt,null),ot.flags|=2),ot.return=et,nt.return=et,nt.sibling=ot,et.child=nt,nt=ot,ot=et.child,it=o.child.memoizedState,it=it===null?nj(tt):{baseLanes:it.baseLanes|tt,cachePool:null,transitions:it.transitions},ot.memoizedState=it,ot.childLanes=o.childLanes&~tt,et.memoizedState=mj,nt}return ot=o.child,o=ot.sibling,nt=Pg(ot,{mode:"visible",children:nt.children}),!(et.mode&1)&&(nt.lanes=tt),nt.return=et,nt.sibling=null,o!==null&&(tt=et.deletions,tt===null?(et.deletions=[o],et.flags|=16):tt.push(o)),et.child=nt,et.memoizedState=null,nt}function qj(o,et){return et=pj({mode:"visible",children:et},o.mode,0,null),et.return=o,o.child=et}function sj(o,et,tt,nt){return nt!==null&&Jg(nt),Ug(et,o.child,null,tt),o=qj(et,et.pendingProps.children),o.flags|=2,et.memoizedState=null,o}function rj(o,et,tt,nt,rt,ot,it){if(tt)return et.flags&256?(et.flags&=-257,nt=Ki(Error(p$4(422))),sj(o,et,it,nt)):et.memoizedState!==null?(et.child=o.child,et.flags|=128,null):(ot=nt.fallback,rt=et.mode,nt=pj({mode:"visible",children:nt.children},rt,0,null),ot=Tg(ot,rt,it,null),ot.flags|=2,nt.return=et,ot.return=et,nt.sibling=ot,et.child=nt,et.mode&1&&Ug(et,o.child,null,it),et.child.memoizedState=nj(it),et.memoizedState=mj,ot);if(!(et.mode&1))return sj(o,et,it,null);if(rt.data==="$!"){if(nt=rt.nextSibling&&rt.nextSibling.dataset,nt)var st=nt.dgst;return nt=st,ot=Error(p$4(419)),nt=Ki(ot,nt,void 0),sj(o,et,it,nt)}if(st=(it&o.childLanes)!==0,dh||st){if(nt=Q$1,nt!==null){switch(it&-it){case 4:rt=2;break;case 16:rt=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:rt=32;break;case 536870912:rt=268435456;break;default:rt=0}rt=rt&(nt.suspendedLanes|it)?0:rt,rt!==0&&rt!==ot.retryLane&&(ot.retryLane=rt,ih(o,rt),gi(nt,o,rt,-1))}return tj(),nt=Ki(Error(p$4(421))),sj(o,et,it,nt)}return rt.data==="$?"?(et.flags|=128,et.child=o.child,et=uj.bind(null,o),rt._reactRetry=et,null):(o=ot.treeContext,yg=Lf(rt.nextSibling),xg=et,I$1=!0,zg=null,o!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=o.id,sg=o.overflow,qg=et),et=qj(et,nt.children),et.flags|=4096,et)}function vj(o,et,tt){o.lanes|=et;var nt=o.alternate;nt!==null&&(nt.lanes|=et),bh(o.return,et,tt)}function wj(o,et,tt,nt,rt){var ot=o.memoizedState;ot===null?o.memoizedState={isBackwards:et,rendering:null,renderingStartTime:0,last:nt,tail:tt,tailMode:rt}:(ot.isBackwards=et,ot.rendering=null,ot.renderingStartTime=0,ot.last=nt,ot.tail=tt,ot.tailMode=rt)}function xj(o,et,tt){var nt=et.pendingProps,rt=nt.revealOrder,ot=nt.tail;if(Xi(o,et,nt.children,tt),nt=L$1.current,nt&2)nt=nt&1|2,et.flags|=128;else{if(o!==null&&o.flags&128)e:for(o=et.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&vj(o,tt,et);else if(o.tag===19)vj(o,tt,et);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===et)break e;for(;o.sibling===null;){if(o.return===null||o.return===et)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}nt&=1}if(G$1(L$1,nt),!(et.mode&1))et.memoizedState=null;else switch(rt){case"forwards":for(tt=et.child,rt=null;tt!==null;)o=tt.alternate,o!==null&&Ch(o)===null&&(rt=tt),tt=tt.sibling;tt=rt,tt===null?(rt=et.child,et.child=null):(rt=tt.sibling,tt.sibling=null),wj(et,!1,rt,tt,ot);break;case"backwards":for(tt=null,rt=et.child,et.child=null;rt!==null;){if(o=rt.alternate,o!==null&&Ch(o)===null){et.child=rt;break}o=rt.sibling,rt.sibling=tt,tt=rt,rt=o}wj(et,!0,tt,null,ot);break;case"together":wj(et,!1,null,null,void 0);break;default:et.memoizedState=null}return et.child}function ij(o,et){!(et.mode&1)&&o!==null&&(o.alternate=null,et.alternate=null,et.flags|=2)}function Zi(o,et,tt){if(o!==null&&(et.dependencies=o.dependencies),rh|=et.lanes,!(tt&et.childLanes))return null;if(o!==null&&et.child!==o.child)throw Error(p$4(153));if(et.child!==null){for(o=et.child,tt=Pg(o,o.pendingProps),et.child=tt,tt.return=et;o.sibling!==null;)o=o.sibling,tt=tt.sibling=Pg(o,o.pendingProps),tt.return=et;tt.sibling=null}return et.child}function yj(o,et,tt){switch(et.tag){case 3:kj(et),Ig();break;case 5:Ah(et);break;case 1:Zf(et.type)&&cg(et);break;case 4:yh(et,et.stateNode.containerInfo);break;case 10:var nt=et.type._context,rt=et.memoizedProps.value;G$1(Wg,nt._currentValue),nt._currentValue=rt;break;case 13:if(nt=et.memoizedState,nt!==null)return nt.dehydrated!==null?(G$1(L$1,L$1.current&1),et.flags|=128,null):tt&et.child.childLanes?oj(o,et,tt):(G$1(L$1,L$1.current&1),o=Zi(o,et,tt),o!==null?o.sibling:null);G$1(L$1,L$1.current&1);break;case 19:if(nt=(tt&et.childLanes)!==0,o.flags&128){if(nt)return xj(o,et,tt);et.flags|=128}if(rt=et.memoizedState,rt!==null&&(rt.rendering=null,rt.tail=null,rt.lastEffect=null),G$1(L$1,L$1.current),nt)break;return null;case 22:case 23:return et.lanes=0,dj(o,et,tt)}return Zi(o,et,tt)}var zj,Aj,Bj,Cj;zj=function(o,et){for(var tt=et.child;tt!==null;){if(tt.tag===5||tt.tag===6)o.appendChild(tt.stateNode);else if(tt.tag!==4&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===et)break;for(;tt.sibling===null;){if(tt.return===null||tt.return===et)return;tt=tt.return}tt.sibling.return=tt.return,tt=tt.sibling}};Aj=function(){};Bj=function(o,et,tt,nt){var rt=o.memoizedProps;if(rt!==nt){o=et.stateNode,xh(uh.current);var ot=null;switch(tt){case"input":rt=Ya(o,rt),nt=Ya(o,nt),ot=[];break;case"select":rt=A$1({},rt,{value:void 0}),nt=A$1({},nt,{value:void 0}),ot=[];break;case"textarea":rt=gb(o,rt),nt=gb(o,nt),ot=[];break;default:typeof rt.onClick!="function"&&typeof nt.onClick=="function"&&(o.onclick=Bf)}ub(tt,nt);var it;tt=null;for(ct in rt)if(!nt.hasOwnProperty(ct)&&rt.hasOwnProperty(ct)&&rt[ct]!=null)if(ct==="style"){var st=rt[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 nt){var at=nt[ct];if(st=rt!=null?rt[ct]:void 0,nt.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",o),ot||st===at||(ot=[])):(ot=ot||[]).push(ct,at))}tt&&(ot=ot||[]).push("style",tt);var ct=ot;(et.updateQueue=ct)&&(et.flags|=4)}};Cj=function(o,et,tt,nt){tt!==nt&&(et.flags|=4)};function Dj(o,et){if(!I$1)switch(o.tailMode){case"hidden":et=o.tail;for(var tt=null;et!==null;)et.alternate!==null&&(tt=et),et=et.sibling;tt===null?o.tail=null:tt.sibling=null;break;case"collapsed":tt=o.tail;for(var nt=null;tt!==null;)tt.alternate!==null&&(nt=tt),tt=tt.sibling;nt===null?et||o.tail===null?o.tail=null:o.tail.sibling=null:nt.sibling=null}}function S$1(o){var et=o.alternate!==null&&o.alternate.child===o.child,tt=0,nt=0;if(et)for(var rt=o.child;rt!==null;)tt|=rt.lanes|rt.childLanes,nt|=rt.subtreeFlags&14680064,nt|=rt.flags&14680064,rt.return=o,rt=rt.sibling;else for(rt=o.child;rt!==null;)tt|=rt.lanes|rt.childLanes,nt|=rt.subtreeFlags,nt|=rt.flags,rt.return=o,rt=rt.sibling;return o.subtreeFlags|=nt,o.childLanes=tt,et}function Ej(o,et,tt){var nt=et.pendingProps;switch(wg(et),et.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$1(et),null;case 1:return Zf(et.type)&&$f(),S$1(et),null;case 3:return nt=et.stateNode,zh(),E$1(Wf),E$1(H$1),Eh(),nt.pendingContext&&(nt.context=nt.pendingContext,nt.pendingContext=null),(o===null||o.child===null)&&(Gg(et)?et.flags|=4:o===null||o.memoizedState.isDehydrated&&!(et.flags&256)||(et.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(o,et),S$1(et),null;case 5:Bh(et);var rt=xh(wh.current);if(tt=et.type,o!==null&&et.stateNode!=null)Bj(o,et,tt,nt,rt),o.ref!==et.ref&&(et.flags|=512,et.flags|=2097152);else{if(!nt){if(et.stateNode===null)throw Error(p$4(166));return S$1(et),null}if(o=xh(uh.current),Gg(et)){nt=et.stateNode,tt=et.type;var ot=et.memoizedProps;switch(nt[Of]=et,nt[Pf]=ot,o=(et.mode&1)!==0,tt){case"dialog":D$1("cancel",nt),D$1("close",nt);break;case"iframe":case"object":case"embed":D$1("load",nt);break;case"video":case"audio":for(rt=0;rt<\/script>",o=o.removeChild(o.firstChild)):typeof nt.is=="string"?o=it.createElement(tt,{is:nt.is}):(o=it.createElement(tt),tt==="select"&&(it=o,nt.multiple?it.multiple=!0:nt.size&&(it.size=nt.size))):o=it.createElementNS(o,tt),o[Of]=et,o[Pf]=nt,zj(o,et,!1,!1),et.stateNode=o;e:{switch(it=vb(tt,nt),tt){case"dialog":D$1("cancel",o),D$1("close",o),rt=nt;break;case"iframe":case"object":case"embed":D$1("load",o),rt=nt;break;case"video":case"audio":for(rt=0;rtGj&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304)}else{if(!nt)if(o=Ch(it),o!==null){if(et.flags|=128,nt=!0,tt=o.updateQueue,tt!==null&&(et.updateQueue=tt,et.flags|=4),Dj(ot,!0),ot.tail===null&&ot.tailMode==="hidden"&&!it.alternate&&!I$1)return S$1(et),null}else 2*B$1()-ot.renderingStartTime>Gj&&tt!==1073741824&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304);ot.isBackwards?(it.sibling=et.child,et.child=it):(tt=ot.last,tt!==null?tt.sibling=it:et.child=it,ot.last=it)}return ot.tail!==null?(et=ot.tail,ot.rendering=et,ot.tail=et.sibling,ot.renderingStartTime=B$1(),et.sibling=null,tt=L$1.current,G$1(L$1,nt?tt&1|2:tt&1),et):(S$1(et),null);case 22:case 23:return Hj(),nt=et.memoizedState!==null,o!==null&&o.memoizedState!==null!==nt&&(et.flags|=8192),nt&&et.mode&1?fj&1073741824&&(S$1(et),et.subtreeFlags&6&&(et.flags|=8192)):S$1(et),null;case 24:return null;case 25:return null}throw Error(p$4(156,et.tag))}function Ij(o,et){switch(wg(et),et.tag){case 1:return Zf(et.type)&&$f(),o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 3:return zh(),E$1(Wf),E$1(H$1),Eh(),o=et.flags,o&65536&&!(o&128)?(et.flags=o&-65537|128,et):null;case 5:return Bh(et),null;case 13:if(E$1(L$1),o=et.memoizedState,o!==null&&o.dehydrated!==null){if(et.alternate===null)throw Error(p$4(340));Ig()}return o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 19:return E$1(L$1),null;case 4:return zh(),null;case 10:return ah(et.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(o,et){var tt=o.ref;if(tt!==null)if(typeof tt=="function")try{tt(null)}catch(nt){W$1(o,et,nt)}else tt.current=null}function Mj(o,et,tt){try{tt()}catch(nt){W$1(o,et,nt)}}var Nj=!1;function Oj(o,et){if(Cf=dd,o=Me$1(),Ne$1(o)){if("selectionStart"in o)var tt={start:o.selectionStart,end:o.selectionEnd};else e:{tt=(tt=o.ownerDocument)&&tt.defaultView||window;var nt=tt.getSelection&&tt.getSelection();if(nt&&nt.rangeCount!==0){tt=nt.anchorNode;var rt=nt.anchorOffset,ot=nt.focusNode;nt=nt.focusOffset;try{tt.nodeType,ot.nodeType}catch{tt=null;break e}var it=0,st=-1,at=-1,ct=0,lt=0,dt=o,ht=null;t:for(;;){for(var ft;dt!==tt||rt!==0&&dt.nodeType!==3||(st=it+rt),dt!==ot||nt!==0&&dt.nodeType!==3||(at=it+nt),dt.nodeType===3&&(it+=dt.nodeValue.length),(ft=dt.firstChild)!==null;)ht=dt,dt=ft;for(;;){if(dt===o)break t;if(ht===tt&&++ct===rt&&(st=it),ht===ot&&++lt===nt&&(at=it),(ft=dt.nextSibling)!==null)break;dt=ht,ht=dt.parentNode}dt=ft}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:o,selectionRange:tt},dd=!1,V$2=et;V$2!==null;)if(et=V$2,o=et.child,(et.subtreeFlags&1028)!==0&&o!==null)o.return=et,V$2=o;else for(;V$2!==null;){et=V$2;try{var mt=et.alternate;if(et.flags&1024)switch(et.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var pt=mt.memoizedProps,yt=mt.memoizedState,gt=et.stateNode,xt=gt.getSnapshotBeforeUpdate(et.elementType===et.type?pt:Ci(et.type,pt),yt);gt.__reactInternalSnapshotBeforeUpdate=xt}break;case 3:var vt=et.stateNode.containerInfo;vt.nodeType===1?vt.textContent="":vt.nodeType===9&&vt.documentElement&&vt.removeChild(vt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$4(163))}}catch(bt){W$1(et,et.return,bt)}if(o=et.sibling,o!==null){o.return=et.return,V$2=o;break}V$2=et.return}return mt=Nj,Nj=!1,mt}function Pj(o,et,tt){var nt=et.updateQueue;if(nt=nt!==null?nt.lastEffect:null,nt!==null){var rt=nt=nt.next;do{if((rt.tag&o)===o){var ot=rt.destroy;rt.destroy=void 0,ot!==void 0&&Mj(et,tt,ot)}rt=rt.next}while(rt!==nt)}}function Qj(o,et){if(et=et.updateQueue,et=et!==null?et.lastEffect:null,et!==null){var tt=et=et.next;do{if((tt.tag&o)===o){var nt=tt.create;tt.destroy=nt()}tt=tt.next}while(tt!==et)}}function Rj(o){var et=o.ref;if(et!==null){var tt=o.stateNode;switch(o.tag){case 5:o=tt;break;default:o=tt}typeof et=="function"?et(o):et.current=o}}function Sj(o){var et=o.alternate;et!==null&&(o.alternate=null,Sj(et)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(et=o.stateNode,et!==null&&(delete et[Of],delete et[Pf],delete et[of],delete et[Qf],delete et[Rf])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Tj(o){return o.tag===5||o.tag===3||o.tag===4}function Uj(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Tj(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Vj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.nodeType===8?tt.parentNode.insertBefore(o,et):tt.insertBefore(o,et):(tt.nodeType===8?(et=tt.parentNode,et.insertBefore(o,tt)):(et=tt,et.appendChild(o)),tt=tt._reactRootContainer,tt!=null||et.onclick!==null||(et.onclick=Bf));else if(nt!==4&&(o=o.child,o!==null))for(Vj(o,et,tt),o=o.sibling;o!==null;)Vj(o,et,tt),o=o.sibling}function Wj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.insertBefore(o,et):tt.appendChild(o);else if(nt!==4&&(o=o.child,o!==null))for(Wj(o,et,tt),o=o.sibling;o!==null;)Wj(o,et,tt),o=o.sibling}var X$1=null,Xj=!1;function Yj(o,et,tt){for(tt=tt.child;tt!==null;)Zj(o,et,tt),tt=tt.sibling}function Zj(o,et,tt){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,tt)}catch{}switch(tt.tag){case 5:U$1||Lj(tt,et);case 6:var nt=X$1,rt=Xj;X$1=null,Yj(o,et,tt),X$1=nt,Xj=rt,X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?o.parentNode.removeChild(tt):o.removeChild(tt)):X$1.removeChild(tt.stateNode));break;case 18:X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?Kf(o.parentNode,tt):o.nodeType===1&&Kf(o,tt),bd(o)):Kf(X$1,tt.stateNode));break;case 4:nt=X$1,rt=Xj,X$1=tt.stateNode.containerInfo,Xj=!0,Yj(o,et,tt),X$1=nt,Xj=rt;break;case 0:case 11:case 14:case 15:if(!U$1&&(nt=tt.updateQueue,nt!==null&&(nt=nt.lastEffect,nt!==null))){rt=nt=nt.next;do{var ot=rt,it=ot.destroy;ot=ot.tag,it!==void 0&&(ot&2||ot&4)&&Mj(tt,et,it),rt=rt.next}while(rt!==nt)}Yj(o,et,tt);break;case 1:if(!U$1&&(Lj(tt,et),nt=tt.stateNode,typeof nt.componentWillUnmount=="function"))try{nt.props=tt.memoizedProps,nt.state=tt.memoizedState,nt.componentWillUnmount()}catch(st){W$1(tt,et,st)}Yj(o,et,tt);break;case 21:Yj(o,et,tt);break;case 22:tt.mode&1?(U$1=(nt=U$1)||tt.memoizedState!==null,Yj(o,et,tt),U$1=nt):Yj(o,et,tt);break;default:Yj(o,et,tt)}}function ak(o){var et=o.updateQueue;if(et!==null){o.updateQueue=null;var tt=o.stateNode;tt===null&&(tt=o.stateNode=new Kj),et.forEach(function(nt){var rt=bk.bind(null,o,nt);tt.has(nt)||(tt.add(nt),nt.then(rt,rt))})}}function ck(o,et){var tt=et.deletions;if(tt!==null)for(var nt=0;ntrt&&(rt=it),nt&=~ot}if(nt=rt,nt=B$1()-nt,nt=(120>nt?120:480>nt?480:1080>nt?1080:1920>nt?1920:3e3>nt?3e3:4320>nt?4320:1960*lk(nt/1960))-nt,10o?16:o,wk===null)var nt=!1;else{if(o=wk,wk=null,xk=0,K$1&6)throw Error(p$4(331));var rt=K$1;for(K$1|=4,V$2=o.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(o,0):rk|=tt),Dk(o,et)}function Yk(o,et){et===0&&(o.mode&1?(et=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):et=1);var tt=R();o=ih(o,et),o!==null&&(Ac(o,et,tt),Dk(o,tt))}function uj(o){var et=o.memoizedState,tt=0;et!==null&&(tt=et.retryLane),Yk(o,tt)}function bk(o,et){var tt=0;switch(o.tag){case 13:var nt=o.stateNode,rt=o.memoizedState;rt!==null&&(tt=rt.retryLane);break;case 19:nt=o.stateNode;break;default:throw Error(p$4(314))}nt!==null&&nt.delete(et),Yk(o,tt)}var Vk;Vk=function(o,et,tt){if(o!==null)if(o.memoizedProps!==et.pendingProps||Wf.current)dh=!0;else{if(!(o.lanes&tt)&&!(et.flags&128))return dh=!1,yj(o,et,tt);dh=!!(o.flags&131072)}else dh=!1,I$1&&et.flags&1048576&&ug(et,ng,et.index);switch(et.lanes=0,et.tag){case 2:var nt=et.type;ij(o,et),o=et.pendingProps;var rt=Yf(et,H$1.current);ch(et,tt),rt=Nh(null,et,nt,o,rt,tt);var ot=Sh();return et.flags|=1,typeof rt=="object"&&rt!==null&&typeof rt.render=="function"&&rt.$$typeof===void 0?(et.tag=1,et.memoizedState=null,et.updateQueue=null,Zf(nt)?(ot=!0,cg(et)):ot=!1,et.memoizedState=rt.state!==null&&rt.state!==void 0?rt.state:null,kh(et),rt.updater=Ei,et.stateNode=rt,rt._reactInternals=et,Ii(et,nt,o,tt),et=jj(null,et,nt,!0,ot,tt)):(et.tag=0,I$1&&ot&&vg(et),Xi(null,et,rt,tt),et=et.child),et;case 16:nt=et.elementType;e:{switch(ij(o,et),o=et.pendingProps,rt=nt._init,nt=rt(nt._payload),et.type=nt,rt=et.tag=Zk(nt),o=Ci(nt,o),rt){case 0:et=cj(null,et,nt,o,tt);break e;case 1:et=hj(null,et,nt,o,tt);break e;case 11:et=Yi(null,et,nt,o,tt);break e;case 14:et=$i(null,et,nt,Ci(nt.type,o),tt);break e}throw Error(p$4(306,nt,""))}return et;case 0:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),cj(o,et,nt,rt,tt);case 1:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),hj(o,et,nt,rt,tt);case 3:e:{if(kj(et),o===null)throw Error(p$4(387));nt=et.pendingProps,ot=et.memoizedState,rt=ot.element,lh(o,et),qh(et,nt,null,tt);var it=et.memoizedState;if(nt=it.element,ot.isDehydrated)if(ot={element:nt,isDehydrated:!1,cache:it.cache,pendingSuspenseBoundaries:it.pendingSuspenseBoundaries,transitions:it.transitions},et.updateQueue.baseState=ot,et.memoizedState=ot,et.flags&256){rt=Ji(Error(p$4(423)),et),et=lj(o,et,nt,tt,rt);break e}else if(nt!==rt){rt=Ji(Error(p$4(424)),et),et=lj(o,et,nt,tt,rt);break e}else for(yg=Lf(et.stateNode.containerInfo.firstChild),xg=et,I$1=!0,zg=null,tt=Vg(et,null,nt,tt),et.child=tt;tt;)tt.flags=tt.flags&-3|4096,tt=tt.sibling;else{if(Ig(),nt===rt){et=Zi(o,et,tt);break e}Xi(o,et,nt,tt)}et=et.child}return et;case 5:return Ah(et),o===null&&Eg(et),nt=et.type,rt=et.pendingProps,ot=o!==null?o.memoizedProps:null,it=rt.children,Ef(nt,rt)?it=null:ot!==null&&Ef(nt,ot)&&(et.flags|=32),gj(o,et),Xi(o,et,it,tt),et.child;case 6:return o===null&&Eg(et),null;case 13:return oj(o,et,tt);case 4:return yh(et,et.stateNode.containerInfo),nt=et.pendingProps,o===null?et.child=Ug(et,null,nt,tt):Xi(o,et,nt,tt),et.child;case 11:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),Yi(o,et,nt,rt,tt);case 7:return Xi(o,et,et.pendingProps,tt),et.child;case 8:return Xi(o,et,et.pendingProps.children,tt),et.child;case 12:return Xi(o,et,et.pendingProps.children,tt),et.child;case 10:e:{if(nt=et.type._context,rt=et.pendingProps,ot=et.memoizedProps,it=rt.value,G$1(Wg,nt._currentValue),nt._currentValue=it,ot!==null)if(He(ot.value,it)){if(ot.children===rt.children&&!Wf.current){et=Zi(o,et,tt);break e}}else for(ot=et.child,ot!==null&&(ot.return=et);ot!==null;){var st=ot.dependencies;if(st!==null){it=ot.child;for(var at=st.firstContext;at!==null;){if(at.context===nt){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,et),st.lanes|=tt;break}at=at.next}}else if(ot.tag===10)it=ot.type===et.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,et),it=ot.sibling}else it=ot.child;if(it!==null)it.return=ot;else for(it=ot;it!==null;){if(it===et){it=null;break}if(ot=it.sibling,ot!==null){ot.return=it.return,it=ot;break}it=it.return}ot=it}Xi(o,et,rt.children,tt),et=et.child}return et;case 9:return rt=et.type,nt=et.pendingProps.children,ch(et,tt),rt=eh(rt),nt=nt(rt),et.flags|=1,Xi(o,et,nt,tt),et.child;case 14:return nt=et.type,rt=Ci(nt,et.pendingProps),rt=Ci(nt.type,rt),$i(o,et,nt,rt,tt);case 15:return bj(o,et,et.type,et.pendingProps,tt);case 17:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),ij(o,et),et.tag=1,Zf(nt)?(o=!0,cg(et)):o=!1,ch(et,tt),Gi(et,nt,rt),Ii(et,nt,rt,tt),jj(null,et,nt,!0,o,tt);case 19:return xj(o,et,tt);case 22:return dj(o,et,tt)}throw Error(p$4(156,et.tag))};function Fk(o,et){return ac(o,et)}function $k(o,et,tt,nt){this.tag=o,this.key=tt,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=et,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=nt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(o,et,tt,nt){return new $k(o,et,tt,nt)}function aj(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Zk(o){if(typeof o=="function")return aj(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Da)return 11;if(o===Ga)return 14}return 2}function Pg(o,et){var tt=o.alternate;return tt===null?(tt=Bg(o.tag,et,o.key,o.mode),tt.elementType=o.elementType,tt.type=o.type,tt.stateNode=o.stateNode,tt.alternate=o,o.alternate=tt):(tt.pendingProps=et,tt.type=o.type,tt.flags=0,tt.subtreeFlags=0,tt.deletions=null),tt.flags=o.flags&14680064,tt.childLanes=o.childLanes,tt.lanes=o.lanes,tt.child=o.child,tt.memoizedProps=o.memoizedProps,tt.memoizedState=o.memoizedState,tt.updateQueue=o.updateQueue,et=o.dependencies,tt.dependencies=et===null?null:{lanes:et.lanes,firstContext:et.firstContext},tt.sibling=o.sibling,tt.index=o.index,tt.ref=o.ref,tt}function Rg(o,et,tt,nt,rt,ot){var it=2;if(nt=o,typeof o=="function")aj(o)&&(it=1);else if(typeof o=="string")it=5;else e:switch(o){case ya:return Tg(tt.children,rt,ot,et);case za:it=8,rt|=8;break;case Aa:return o=Bg(12,tt,et,rt|2),o.elementType=Aa,o.lanes=ot,o;case Ea:return o=Bg(13,tt,et,rt),o.elementType=Ea,o.lanes=ot,o;case Fa:return o=Bg(19,tt,et,rt),o.elementType=Fa,o.lanes=ot,o;case Ia:return pj(tt,rt,ot,et);default:if(typeof o=="object"&&o!==null)switch(o.$$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,nt=null;break e}throw Error(p$4(130,o==null?o:typeof o,""))}return et=Bg(it,tt,et,rt),et.elementType=o,et.type=nt,et.lanes=ot,et}function Tg(o,et,tt,nt){return o=Bg(7,o,nt,et),o.lanes=tt,o}function pj(o,et,tt,nt){return o=Bg(22,o,nt,et),o.elementType=Ia,o.lanes=tt,o.stateNode={isHidden:!1},o}function Qg(o,et,tt){return o=Bg(6,o,null,et),o.lanes=tt,o}function Sg(o,et,tt){return et=Bg(4,o.children!==null?o.children:[],o.key,et),et.lanes=tt,et.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},et}function al(o,et,tt,nt,rt){this.tag=et,this.containerInfo=o,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=nt,this.onRecoverableError=rt,this.mutableSourceEagerHydrationData=null}function bl(o,et,tt,nt,rt,ot,it,st,at){return o=new al(o,et,tt,st,at),et===1?(et=1,ot===!0&&(et|=8)):et=0,ot=Bg(3,null,null,et),o.current=ot,ot.stateNode=o,ot.memoizedState={element:nt,isDehydrated:tt,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(ot),o}function cl(o,et,tt){var nt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(o){console.error(o)}}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.45";let errorConfig={getDocsUrl:({docsBaseUrl:o,docsPath:et="",docsSlug:tt})=>et?`${o??"https://viem.sh"}${et}${tt?`#${tt}`:""}`:void 0,version:`viem@${version$8}`},BaseError$3=class ks extends Error{constructor(et,tt={}){var st;const nt=(()=>{var at;return tt.cause instanceof ks?tt.cause.details:(at=tt.cause)!=null&&at.message?tt.cause.message:tt.details})(),rt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=(st=errorConfig.getDocsUrl)==null?void 0:st.call(errorConfig,{...tt,docsPath:rt}),it=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...ot?[`Docs: ${ot}`]:[],...nt?[`Details: ${nt}`]:[],...errorConfig.version?[`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=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.name=tt.name??this.name,this.shortMessage=et,this.version=version$8}walk(et){return walk(this,et)}};function walk(o,et){return et!=null&&et(o)?o:o&&typeof o=="object"&&"cause"in o&&o.cause!==void 0?walk(o.cause,et):et?null:o}class IntegerOutOfRangeError extends BaseError$3{constructor({max:et,min:tt,signed:nt,size:rt,value:ot}){super(`Number "${ot}" is not in safe ${rt?`${rt*8}-bit ${nt?"signed":"unsigned"} `:""}integer range ${et?`(${tt} to ${et})`:`(above ${tt})`}`,{name:"IntegerOutOfRangeError"})}}class InvalidBytesBooleanError extends BaseError$3{constructor(et){super(`Bytes value "${et}" 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:et,maxSize:tt}){super(`Size cannot exceed ${tt} bytes. Given size: ${et} bytes.`,{name:"SizeOverflowError"})}}class SliceOffsetOutOfBoundsError extends BaseError$3{constructor({offset:et,position:tt,size:nt}){super(`Slice ${tt==="start"?"starting":"ending"} at offset "${et}" is out-of-bounds (size: ${nt}).`,{name:"SliceOffsetOutOfBoundsError"})}}class SizeExceedsPaddingSizeError extends BaseError$3{constructor({size:et,targetSize:tt,type:nt}){super(`${nt.charAt(0).toUpperCase()}${nt.slice(1).toLowerCase()} size (${et}) exceeds padding size (${tt}).`,{name:"SizeExceedsPaddingSizeError"})}}class InvalidBytesLengthError extends BaseError$3{constructor({size:et,targetSize:tt,type:nt}){super(`${nt.charAt(0).toUpperCase()}${nt.slice(1).toLowerCase()} is expected to be ${tt} ${nt} long, but is ${et} ${nt} long.`,{name:"InvalidBytesLengthError"})}}function pad(o,{dir:et,size:tt=32}={}){return typeof o=="string"?padHex(o,{dir:et,size:tt}):padBytes(o,{dir:et,size:tt})}function padHex(o,{dir:et,size:tt=32}={}){if(tt===null)return o;const nt=o.replace("0x","");if(nt.length>tt*2)throw new SizeExceedsPaddingSizeError({size:Math.ceil(nt.length/2),targetSize:tt,type:"hex"});return`0x${nt[et==="right"?"padEnd":"padStart"](tt*2,"0")}`}function padBytes(o,{dir:et,size:tt=32}={}){if(tt===null)return o;if(o.length>tt)throw new SizeExceedsPaddingSizeError({size:o.length,targetSize:tt,type:"bytes"});const nt=new Uint8Array(tt);for(let rt=0;rt=charCodeMap.zero&&o<=charCodeMap.nine)return o-charCodeMap.zero;if(o>=charCodeMap.A&&o<=charCodeMap.F)return o-(charCodeMap.A-10);if(o>=charCodeMap.a&&o<=charCodeMap.f)return o-(charCodeMap.a-10)}function hexToBytes$3(o,et={}){let tt=o;et.size&&(assertSize(tt,{size:et.size}),tt=pad(tt,{dir:"right",size:et.size}));let nt=tt.slice(2);nt.length%2&&(nt=`0${nt}`);const rt=nt.length/2,ot=new Uint8Array(rt);for(let it=0,st=0;itet)throw new SizeOverflowError({givenSize:size$2(o),maxSize:et})}function hexToBigInt(o,et={}){const{signed:tt}=et;et.size&&assertSize(o,{size:et.size});const nt=BigInt(o);if(!tt)return nt;const rt=(o.length-2)/2,ot=(1n<et.toString(16).padStart(2,"0"));function toHex(o,et={}){return typeof o=="number"||typeof o=="bigint"?numberToHex(o,et):typeof o=="string"?stringToHex(o,et):typeof o=="boolean"?boolToHex(o,et):bytesToHex$4(o,et)}function boolToHex(o,et={}){const tt=`0x${Number(o)}`;return typeof et.size=="number"?(assertSize(tt,{size:et.size}),pad(tt,{size:et.size})):tt}function bytesToHex$4(o,et={}){let tt="";for(let rt=0;rtot||rtformatAbiParam(tt,{includeName:et})).join(et?", ":","):""}function formatAbiParam(o,{includeName:et}){return o.type.startsWith("tuple")?`(${formatAbiParams(o.components,{includeName:et})})${o.type.slice(5)}`:o.type+(et&&o.name?` ${o.name}`:"")}class AbiConstructorNotFoundError extends BaseError$3{constructor({docsPath:et}){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:et,name:"AbiConstructorNotFoundError"})}}class AbiConstructorParamsNotFoundError extends BaseError$3{constructor({docsPath:et}){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:et,name:"AbiConstructorParamsNotFoundError"})}}class AbiDecodingDataSizeTooSmallError extends BaseError$3{constructor({data:et,params:tt,size:nt}){super([`Data size of ${nt} bytes is too small for given parameters.`].join(` @@ -56,15 +56,15 @@ Error generating stack: `+ot.message+` `),{docsPath:tt,name:"InvalidAbiEncodingType"})}}class InvalidAbiDecodingTypeError extends BaseError$3{constructor(et,{docsPath:tt}){super([`Type "${et}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:tt,name:"InvalidAbiDecodingType"})}}class InvalidArrayError extends BaseError$3{constructor(et){super([`Value "${et}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class InvalidDefinitionTypeError extends BaseError$3{constructor(et){super([`"${et}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}function concat$3(o){return typeof o[0]=="string"?concatHex(o):concatBytes$3(o)}function concatBytes$3(o){let et=0;for(const rt of o)et+=rt.length;const tt=new Uint8Array(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function concatHex(o){return`0x${o.reduce((et,tt)=>et+tt.replace("0x",""),"")}`}class InvalidAddressError extends BaseError$3{constructor({address:et}){super(`Address "${et}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(et){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=et}get(et){const tt=super.get(et);return super.has(et)&&tt!==void 0&&(this.delete(et),super.set(et,tt)),tt}set(et,tt){if(super.set(et,tt),this.maxSize&&this.size>this.maxSize){const nt=this.keys().next().value;nt&&this.delete(nt)}return this}}function number$4(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function isBytes$3(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes$1(o,...et){if(!isBytes$3(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function hash$1(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$4(o.outputLen),number$4(o.blockLen)}function exists$1(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output$1(o,et){bytes$1(o);const tt=et.outputLen;if(o.length>_32n&U32_MASK64)}:{h:Number(o>>_32n&U32_MASK64)|0,l:Number(o&U32_MASK64)|0}}function split$1(o,et=!1){let tt=new Uint32Array(o.length),nt=new Uint32Array(o.length);for(let rt=0;rtBigInt(o>>>0)<<_32n|BigInt(et>>>0),shrSH=(o,et,tt)=>o>>>tt,shrSL=(o,et,tt)=>o<<32-tt|et>>>tt,rotrSH=(o,et,tt)=>o>>>tt|et<<32-tt,rotrSL=(o,et,tt)=>o<<32-tt|et>>>tt,rotrBH=(o,et,tt)=>o<<64-tt|et>>>tt-32,rotrBL=(o,et,tt)=>o>>>tt-32|et<<64-tt,rotr32H=(o,et)=>et,rotr32L=(o,et)=>o,rotlSH=(o,et,tt)=>o<>>32-tt,rotlSL=(o,et,tt)=>et<>>32-tt,rotlBH=(o,et,tt)=>et<>>64-tt,rotlBL=(o,et,tt)=>o<>>64-tt;function add(o,et,tt,nt){const rt=(et>>>0)+(nt>>>0);return{h:o+tt+(rt/2**32|0)|0,l:rt|0}}const add3L=(o,et,tt)=>(o>>>0)+(et>>>0)+(tt>>>0),add3H=(o,et,tt,nt)=>et+tt+nt+(o/2**32|0)|0,add4L=(o,et,tt,nt)=>(o>>>0)+(et>>>0)+(tt>>>0)+(nt>>>0),add4H=(o,et,tt,nt,rt)=>et+tt+nt+rt+(o/2**32|0)|0,add5L=(o,et,tt,nt,rt)=>(o>>>0)+(et>>>0)+(tt>>>0)+(nt>>>0)+(rt>>>0),add5H=(o,et,tt,nt,rt,ot)=>et+tt+nt+rt+ot+(o/2**32|0)|0,u64={fromBig,split:split$1,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32$1=o=>new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView$1=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),rotr=(o,et)=>o<<32-et|o>>>et,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=o=>o<<24&4278190080|o<<8&16711680|o>>>8&65280|o>>>24&255;function byteSwap32(o){for(let et=0;etet.toString(16).padStart(2,"0"));function bytesToHex$3(o){bytes$1(o);let et="";for(let tt=0;tto().update(toBytes$2(nt)).digest(),tt=o();return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=()=>o(),et}function wrapXOFConstructorWithOpts(o){const et=(nt,rt)=>o(rt).update(toBytes$2(nt)).digest(),tt=o({});return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}function randomBytes$1(o=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(o));if(crypto$2&&typeof crypto$2.randomBytes=="function")return crypto$2.randomBytes(o);throw new Error("crypto.getRandomValues must be defined")}const SHA3_PI=[],SHA3_ROTL=[],_SHA3_IOTA=[],_0n$7=BigInt(0),_1n$9=BigInt(1),_2n$6=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let o=0,et=_1n$9,tt=1,nt=0;o<24;o++){[tt,nt]=[nt,(2*tt+3*nt)%5],SHA3_PI.push(2*(5*nt+tt)),SHA3_ROTL.push((o+1)*(o+2)/2%64);let rt=_0n$7;for(let ot=0;ot<7;ot++)et=(et<<_1n$9^(et>>_7n)*_0x71n)%_256n,et&_2n$6&&(rt^=_1n$9<<(_1n$9<tt>32?rotlBH(o,et,tt):rotlSH(o,et,tt),rotlL=(o,et,tt)=>tt>32?rotlBL(o,et,tt):rotlSL(o,et,tt);function keccakP(o,et=24){const tt=new Uint32Array(10);for(let nt=24-et;nt<24;nt++){for(let it=0;it<10;it++)tt[it]=o[it]^o[it+10]^o[it+20]^o[it+30]^o[it+40];for(let it=0;it<10;it+=2){const st=(it+8)%10,at=(it+2)%10,ct=tt[at],lt=tt[at+1],dt=rotlH(ct,lt,1)^tt[st],ht=rotlL(ct,lt,1)^tt[st+1];for(let pt=0;pt<50;pt+=10)o[it+pt]^=dt,o[it+pt+1]^=ht}let rt=o[2],ot=o[3];for(let it=0;it<24;it++){const st=SHA3_ROTL[it],at=rotlH(rt,ot,st),ct=rotlL(rt,ot,st),lt=SHA3_PI[it];rt=o[lt],ot=o[lt+1],o[lt]=at,o[lt+1]=ct}for(let it=0;it<50;it+=10){for(let st=0;st<10;st++)tt[st]=o[it+st];for(let st=0;st<10;st++)o[it+st]^=~tt[(st+2)%10]&tt[(st+4)%10]}o[0]^=SHA3_IOTA_H[nt],o[1]^=SHA3_IOTA_L[nt]}tt.fill(0)}class Keccak extends Hash{constructor(et,tt,nt,rt=!1,ot=24){if(super(),this.blockLen=et,this.suffix=tt,this.outputLen=nt,this.enableXOF=rt,this.rounds=ot,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$4(nt),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$1(this.state)}keccak(){isLE$1||byteSwap32(this.state32),keccakP(this.state32,this.rounds),isLE$1||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(et){exists$1(this);const{blockLen:tt,state:nt}=this;et=toBytes$2(et);const rt=et.length;for(let ot=0;ot=nt&&this.keccak();const it=Math.min(nt-this.posOut,ot-rt);et.set(tt.subarray(this.posOut,this.posOut+it),rt),this.posOut+=it,rt+=it}return et}xofInto(et){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(et)}xof(et){return number$4(et),this.xofInto(new Uint8Array(et))}digestInto(et){if(output$1(et,this),this.finished)throw new Error("digest() was already called");return this.writeInto(et),this.destroy(),et}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(et){const{blockLen:tt,suffix:nt,outputLen:rt,rounds:ot,enableXOF:it}=this;return et||(et=new Keccak(tt,nt,rt,it,ot)),et.state32.set(this.state32),et.pos=this.pos,et.posOut=this.posOut,et.finished=this.finished,et.rounds=ot,et.suffix=nt,et.outputLen=rt,et.enableXOF=it,et.destroyed=this.destroyed,et}}const gen=(o,et,tt)=>wrapConstructor(()=>new Keccak(et,o,tt)),sha3_224=gen(6,144,224/8),sha3_256=gen(6,136,256/8),sha3_384=gen(6,104,384/8),sha3_512=gen(6,72,512/8),keccak_224=gen(1,144,224/8),keccak_256=gen(1,136,256/8),keccak_384=gen(1,104,384/8),keccak_512=gen(1,72,512/8),genShake=(o,et,tt)=>wrapXOFConstructorWithOpts((nt={})=>new Keccak(et,o,nt.dkLen===void 0?tt:nt.dkLen,!0)),shake128=genShake(31,168,128/8),shake256=genShake(31,136,256/8),sha3$2=Object.freeze(Object.defineProperty({__proto__:null,Keccak,keccakP,keccak_224,keccak_256,keccak_384,keccak_512,sha3_224,sha3_256,sha3_384,sha3_512,shake128,shake256},Symbol.toStringTag,{value:"Module"}));function keccak256$1(o,et){const tt=et||"hex",nt=keccak_256(isHex(o,{strict:!1})?toBytes$3(o):o);return tt==="bytes"?nt:toHex(nt)}const checksumAddressCache=new LruMap(8192);function checksumAddress(o,et){if(checksumAddressCache.has(`${o}.${et}`))return checksumAddressCache.get(`${o}.${et}`);const tt=et?`${et}${o.toLowerCase()}`:o.substring(2).toLowerCase(),nt=keccak256$1(stringToBytes(tt),"bytes"),rt=(et?tt.substring(`${et}0x`.length):tt).split("");for(let it=0;it<40;it+=2)nt[it>>1]>>4>=8&&rt[it]&&(rt[it]=rt[it].toUpperCase()),(nt[it>>1]&15)>=8&&rt[it+1]&&(rt[it+1]=rt[it+1].toUpperCase());const ot=`0x${rt.join("")}`;return checksumAddressCache.set(`${o}.${et}`,ot),ot}function getAddress(o,et){if(!isAddress(o,{strict:!1}))throw new InvalidAddressError({address:o});return checksumAddress(o,et)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(o,et){const{strict:tt=!0}=et??{},nt=`${o}.${tt}`;if(isAddressCache.has(nt))return isAddressCache.get(nt);const rt=addressRegex.test(o)?o.toLowerCase()===o?!0:tt?checksumAddress(o)===o:!0:!1;return isAddressCache.set(nt,rt),rt}function slice(o,et,tt,{strict:nt}={}){return isHex(o,{strict:!1})?sliceHex(o,et,tt,{strict:nt}):sliceBytes(o,et,tt,{strict:nt})}function assertStartOffset(o,et){if(typeof et=="number"&&et>0&&et>size$2(o)-1)throw new SliceOffsetOutOfBoundsError({offset:et,position:"start",size:size$2(o)})}function assertEndOffset(o,et,tt){if(typeof et=="number"&&typeof tt=="number"&&size$2(o)!==tt-et)throw new SliceOffsetOutOfBoundsError({offset:tt,position:"end",size:size$2(o)})}function sliceBytes(o,et,tt,{strict:nt}={}){assertStartOffset(o,et);const rt=o.slice(et,tt);return nt&&assertEndOffset(rt,et,tt),rt}function sliceHex(o,et,tt,{strict:nt}={}){assertStartOffset(o,et);const rt=`0x${o.replace("0x","").slice((et??0)*2,(tt??o.length)*2)}`;return nt&&assertEndOffset(rt,et,tt),rt}function encodeAbiParameters(o,et){if(o.length!==et.length)throw new AbiEncodingLengthMismatchError({expectedLength:o.length,givenLength:et.length});const tt=prepareParams({params:o,values:et}),nt=encodeParams(tt);return nt.length===0?"0x":nt}function prepareParams({params:o,values:et}){const tt=[];for(let nt=0;nt0?concat$3([st,it]):st}}if(rt)return{dynamic:!0,encoded:it}}return{dynamic:!1,encoded:concat$3(ot.map(({encoded:it})=>it))}}function encodeBytes(o,{param:et}){const[,tt]=et.type.split("bytes"),nt=size$2(o);if(!tt){let rt=o;return nt%32!==0&&(rt=padHex(rt,{dir:"right",size:Math.ceil((o.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$3([padHex(numberToHex(nt,{size:32})),rt])}}if(nt!==Number.parseInt(tt))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(tt),value:o});return{dynamic:!1,encoded:padHex(o,{dir:"right"})}}function encodeBool(o){if(typeof o!="boolean")throw new BaseError$3(`Invalid boolean value: "${o}" (type: ${typeof o}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex(boolToHex(o))}}function encodeNumber(o,{signed:et}){return{dynamic:!1,encoded:numberToHex(o,{size:32,signed:et})}}function encodeString(o){const et=stringToHex(o),tt=Math.ceil(size$2(et)/32),nt=[];for(let rt=0;rtrt))}}function getArrayComponents(o){const et=o.match(/^(.*)\[(\d+)?\]$/);return et?[et[2]?Number(et[2]):null,et[1]]:void 0}const docsPath$2="/docs/contract/encodeDeployData";function encodeDeployData(o){const{abi:et,args:tt,bytecode:nt}=o;if(!tt||tt.length===0)return nt;const rt=et.find(it=>"type"in it&&it.type==="constructor");if(!rt)throw new AbiConstructorNotFoundError({docsPath:docsPath$2});if(!("inputs"in rt))throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});if(!rt.inputs||rt.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});const ot=encodeAbiParameters(rt.inputs,tt);return concatHex([nt,ot])}function parseAccount(o){return typeof o=="string"?{address:o,type:"json-rpc"}:o}class AccountNotFoundError extends BaseError$3{constructor({docsPath:et}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:et,docsSlug:"account",name:"AccountNotFoundError"})}}const scriptRel="modulepreload",assetsURL=function(o){return"/"+o},seen={},__vitePreload=function(et,tt,nt){let rt=Promise.resolve();if(tt&&tt.length>0){document.getElementsByTagName("link");const it=document.querySelector("meta[property=csp-nonce]"),st=(it==null?void 0:it.nonce)||(it==null?void 0:it.getAttribute("nonce"));rt=Promise.allSettled(tt.map(at=>{if(at=assetsURL(at),at in seen)return;seen[at]=!0;const ct=at.endsWith(".css"),lt=ct?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${at}"]${lt}`))return;const dt=document.createElement("link");if(dt.rel=ct?"stylesheet":scriptRel,ct||(dt.as="script"),dt.crossOrigin="",dt.href=at,st&&dt.setAttribute("nonce",st),document.head.appendChild(dt),ct)return new Promise((ht,pt)=>{dt.addEventListener("load",ht),dt.addEventListener("error",()=>pt(new Error(`Unable to preload CSS for ${at}`)))})}))}function ot(it){const st=new Event("vite:preloadError",{cancelable:!0});if(st.payload=it,window.dispatchEvent(st),!st.defaultPrevented)throw it}return rt.then(it=>{for(const st of it||[])st.status==="rejected"&&ot(st.reason);return et().catch(ot)})};class NegativeOffsetError extends BaseError$3{constructor({offset:et}){super(`Offset \`${et}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError$3{constructor({length:et,position:tt}){super(`Position \`${tt}\` is out of bounds (\`0 < position < ${et}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError$3{constructor({count:et,limit:tt}){super(`Recursive read limit of \`${tt}\` exceeded (recursive read count: \`${et}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(o){if(o<0||o>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:o})},decrementPosition(o){if(o<0)throw new NegativeOffsetError({offset:o});const et=this.position-o;this.assertPosition(et),this.position=et},getReadCount(o){return this.positionReadCount.get(o||this.position)||0},incrementPosition(o){if(o<0)throw new NegativeOffsetError({offset:o});const et=this.position+o;this.assertPosition(et),this.position=et},inspectByte(o){const et=o??this.position;return this.assertPosition(et),this.bytes[et]},inspectBytes(o,et){const tt=et??this.position;return this.assertPosition(tt+o-1),this.bytes.subarray(tt,tt+o)},inspectUint8(o){const et=o??this.position;return this.assertPosition(et),this.bytes[et]},inspectUint16(o){const et=o??this.position;return this.assertPosition(et+1),this.dataView.getUint16(et)},inspectUint24(o){const et=o??this.position;return this.assertPosition(et+2),(this.dataView.getUint16(et)<<8)+this.dataView.getUint8(et+2)},inspectUint32(o){const et=o??this.position;return this.assertPosition(et+3),this.dataView.getUint32(et)},pushByte(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushBytes(o){this.assertPosition(this.position+o.length-1),this.bytes.set(o,this.position),this.position+=o.length},pushUint8(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushUint16(o){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,o),this.position+=2},pushUint24(o){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,o>>8),this.dataView.setUint8(this.position+2,o&255),this.position+=3},pushUint32(o){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,o),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const o=this.inspectByte();return this.position++,o},readBytes(o,et){this.assertReadLimit(),this._touch();const tt=this.inspectBytes(o);return this.position+=et??o,tt},readUint8(){this.assertReadLimit(),this._touch();const o=this.inspectUint8();return this.position+=1,o},readUint16(){this.assertReadLimit(),this._touch();const o=this.inspectUint16();return this.position+=2,o},readUint24(){this.assertReadLimit(),this._touch();const o=this.inspectUint24();return this.position+=3,o},readUint32(){this.assertReadLimit(),this._touch();const o=this.inspectUint32();return this.position+=4,o},get remaining(){return this.bytes.length-this.position},setPosition(o){const et=this.position;return this.assertPosition(o),this.position=o,()=>this.position=et},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const o=this.getReadCount();this.positionReadCount.set(this.position,o+1),o>0&&this.recursiveReadCount++}};function createCursor(o,{recursiveReadLimit:et=8192}={}){const tt=Object.create(staticCursor);return tt.bytes=o,tt.dataView=new DataView(o.buffer,o.byteOffset,o.byteLength),tt.positionReadCount=new Map,tt.recursiveReadLimit=et,tt}function toRlp(o,et="hex"){const tt=getEncodable(o),nt=createCursor(new Uint8Array(tt.length));return tt.encode(nt),et==="hex"?bytesToHex$4(nt.bytes):nt.bytes}function getEncodable(o){return Array.isArray(o)?getEncodableList(o.map(et=>getEncodable(et))):getEncodableBytes(o)}function getEncodableList(o){const et=o.reduce((rt,ot)=>rt+ot.length,0),tt=getSizeOfLength(et);return{length:et<=55?1+et:1+tt+et,encode(rt){et<=55?rt.pushByte(192+et):(rt.pushByte(247+tt),tt===1?rt.pushUint8(et):tt===2?rt.pushUint16(et):tt===3?rt.pushUint24(et):rt.pushUint32(et));for(const{encode:ot}of o)ot(rt)}}}function getEncodableBytes(o){const et=typeof o=="string"?hexToBytes$3(o):o,tt=getSizeOfLength(et.length);return{length:et.length===1&&et[0]<128?1:et.length<=55?1+et.length:1+tt+et.length,encode(rt){et.length===1&&et[0]<128?rt.pushBytes(et):et.length<=55?(rt.pushByte(128+et.length),rt.pushBytes(et)):(rt.pushByte(183+tt),tt===1?rt.pushUint8(et.length):tt===2?rt.pushUint16(et.length):tt===3?rt.pushUint24(et.length):rt.pushUint32(et.length),rt.pushBytes(et))}}}function getSizeOfLength(o){if(o<2**8)return 1;if(o<2**16)return 2;if(o<2**24)return 3;if(o<2**32)return 4;throw new BaseError$3("Length is too large.")}class ChainDoesNotSupportContract extends BaseError$3{constructor({blockNumber:et,chain:tt,contract:nt}){super(`Chain "${tt.name}" does not support contract "${nt.name}".`,{metaMessages:["This could be due to any of the following:",...et&&nt.blockCreated&&nt.blockCreated>et?[`- The contract "${nt.name}" was not deployed until block ${nt.blockCreated} (current block ${et}).`]:[`- The chain does not have the contract "${nt.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ClientChainNotConfiguredError extends BaseError$3{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError$3{constructor({chainId:et}){super(typeof et=="number"?`Chain ID "${et}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9},weiUnits={ether:-18,gwei:-9};function formatUnits(o,et){let tt=o.toString();const nt=tt.startsWith("-");nt&&(tt=tt.slice(1)),tt=tt.padStart(et,"0");let[rt,ot]=[tt.slice(0,tt.length-et),tt.slice(tt.length-et)];return ot=ot.replace(/(0+)$/,""),`${nt?"-":""}${rt||"0"}${ot?`.${ot}`:""}`}function formatGwei(o,et="wei"){return formatUnits(o,gweiUnits[et])}class ExecutionRevertedError extends BaseError$3{constructor({cause:et,message:tt}={}){var rt;const nt=(rt=tt==null?void 0:tt.replace("execution reverted: ",""))==null?void 0:rt.replace("execution reverted","");super(`Execution reverted ${nt?`with reason: ${nt}`:"for an unknown reason"}.`,{cause:et,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError$3{constructor({cause:et,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:et,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class FeeCapTooLowError extends BaseError$3{constructor({cause:et,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)}`:""} gwei) cannot be lower than the block base fee.`,{cause:et,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class NonceTooHighError extends BaseError$3{constructor({cause:et,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}is higher than the next one expected.`,{cause:et,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError$3{constructor({cause:et,nonce:tt}={}){super([`Nonce provided for the transaction ${tt?`(${tt}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`),{name:"InvalidDefinitionTypeError"})}}function concat$3(o){return typeof o[0]=="string"?concatHex(o):concatBytes$3(o)}function concatBytes$3(o){let et=0;for(const rt of o)et+=rt.length;const tt=new Uint8Array(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function concatHex(o){return`0x${o.reduce((et,tt)=>et+tt.replace("0x",""),"")}`}class InvalidAddressError extends BaseError$3{constructor({address:et}){super(`Address "${et}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(et){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=et}get(et){const tt=super.get(et);return super.has(et)&&tt!==void 0&&(this.delete(et),super.set(et,tt)),tt}set(et,tt){if(super.set(et,tt),this.maxSize&&this.size>this.maxSize){const nt=this.keys().next().value;nt&&this.delete(nt)}return this}}function number$4(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function isBytes$3(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes$1(o,...et){if(!isBytes$3(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function hash$1(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$4(o.outputLen),number$4(o.blockLen)}function exists$1(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output$1(o,et){bytes$1(o);const tt=et.outputLen;if(o.length>_32n&U32_MASK64)}:{h:Number(o>>_32n&U32_MASK64)|0,l:Number(o&U32_MASK64)|0}}function split$1(o,et=!1){let tt=new Uint32Array(o.length),nt=new Uint32Array(o.length);for(let rt=0;rtBigInt(o>>>0)<<_32n|BigInt(et>>>0),shrSH=(o,et,tt)=>o>>>tt,shrSL=(o,et,tt)=>o<<32-tt|et>>>tt,rotrSH=(o,et,tt)=>o>>>tt|et<<32-tt,rotrSL=(o,et,tt)=>o<<32-tt|et>>>tt,rotrBH=(o,et,tt)=>o<<64-tt|et>>>tt-32,rotrBL=(o,et,tt)=>o>>>tt-32|et<<64-tt,rotr32H=(o,et)=>et,rotr32L=(o,et)=>o,rotlSH=(o,et,tt)=>o<>>32-tt,rotlSL=(o,et,tt)=>et<>>32-tt,rotlBH=(o,et,tt)=>et<>>64-tt,rotlBL=(o,et,tt)=>o<>>64-tt;function add(o,et,tt,nt){const rt=(et>>>0)+(nt>>>0);return{h:o+tt+(rt/2**32|0)|0,l:rt|0}}const add3L=(o,et,tt)=>(o>>>0)+(et>>>0)+(tt>>>0),add3H=(o,et,tt,nt)=>et+tt+nt+(o/2**32|0)|0,add4L=(o,et,tt,nt)=>(o>>>0)+(et>>>0)+(tt>>>0)+(nt>>>0),add4H=(o,et,tt,nt,rt)=>et+tt+nt+rt+(o/2**32|0)|0,add5L=(o,et,tt,nt,rt)=>(o>>>0)+(et>>>0)+(tt>>>0)+(nt>>>0)+(rt>>>0),add5H=(o,et,tt,nt,rt,ot)=>et+tt+nt+rt+ot+(o/2**32|0)|0,u64={fromBig,split:split$1,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32$1=o=>new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView$1=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),rotr=(o,et)=>o<<32-et|o>>>et,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=o=>o<<24&4278190080|o<<8&16711680|o>>>8&65280|o>>>24&255;function byteSwap32(o){for(let et=0;etet.toString(16).padStart(2,"0"));function bytesToHex$3(o){bytes$1(o);let et="";for(let tt=0;tto().update(toBytes$2(nt)).digest(),tt=o();return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=()=>o(),et}function wrapXOFConstructorWithOpts(o){const et=(nt,rt)=>o(rt).update(toBytes$2(nt)).digest(),tt=o({});return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}function randomBytes$1(o=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(o));if(crypto$2&&typeof crypto$2.randomBytes=="function")return crypto$2.randomBytes(o);throw new Error("crypto.getRandomValues must be defined")}const SHA3_PI=[],SHA3_ROTL=[],_SHA3_IOTA=[],_0n$7=BigInt(0),_1n$9=BigInt(1),_2n$6=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let o=0,et=_1n$9,tt=1,nt=0;o<24;o++){[tt,nt]=[nt,(2*tt+3*nt)%5],SHA3_PI.push(2*(5*nt+tt)),SHA3_ROTL.push((o+1)*(o+2)/2%64);let rt=_0n$7;for(let ot=0;ot<7;ot++)et=(et<<_1n$9^(et>>_7n)*_0x71n)%_256n,et&_2n$6&&(rt^=_1n$9<<(_1n$9<tt>32?rotlBH(o,et,tt):rotlSH(o,et,tt),rotlL=(o,et,tt)=>tt>32?rotlBL(o,et,tt):rotlSL(o,et,tt);function keccakP(o,et=24){const tt=new Uint32Array(10);for(let nt=24-et;nt<24;nt++){for(let it=0;it<10;it++)tt[it]=o[it]^o[it+10]^o[it+20]^o[it+30]^o[it+40];for(let it=0;it<10;it+=2){const st=(it+8)%10,at=(it+2)%10,ct=tt[at],lt=tt[at+1],dt=rotlH(ct,lt,1)^tt[st],ht=rotlL(ct,lt,1)^tt[st+1];for(let ft=0;ft<50;ft+=10)o[it+ft]^=dt,o[it+ft+1]^=ht}let rt=o[2],ot=o[3];for(let it=0;it<24;it++){const st=SHA3_ROTL[it],at=rotlH(rt,ot,st),ct=rotlL(rt,ot,st),lt=SHA3_PI[it];rt=o[lt],ot=o[lt+1],o[lt]=at,o[lt+1]=ct}for(let it=0;it<50;it+=10){for(let st=0;st<10;st++)tt[st]=o[it+st];for(let st=0;st<10;st++)o[it+st]^=~tt[(st+2)%10]&tt[(st+4)%10]}o[0]^=SHA3_IOTA_H[nt],o[1]^=SHA3_IOTA_L[nt]}tt.fill(0)}class Keccak extends Hash{constructor(et,tt,nt,rt=!1,ot=24){if(super(),this.blockLen=et,this.suffix=tt,this.outputLen=nt,this.enableXOF=rt,this.rounds=ot,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$4(nt),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$1(this.state)}keccak(){isLE$1||byteSwap32(this.state32),keccakP(this.state32,this.rounds),isLE$1||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(et){exists$1(this);const{blockLen:tt,state:nt}=this;et=toBytes$2(et);const rt=et.length;for(let ot=0;ot=nt&&this.keccak();const it=Math.min(nt-this.posOut,ot-rt);et.set(tt.subarray(this.posOut,this.posOut+it),rt),this.posOut+=it,rt+=it}return et}xofInto(et){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(et)}xof(et){return number$4(et),this.xofInto(new Uint8Array(et))}digestInto(et){if(output$1(et,this),this.finished)throw new Error("digest() was already called");return this.writeInto(et),this.destroy(),et}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(et){const{blockLen:tt,suffix:nt,outputLen:rt,rounds:ot,enableXOF:it}=this;return et||(et=new Keccak(tt,nt,rt,it,ot)),et.state32.set(this.state32),et.pos=this.pos,et.posOut=this.posOut,et.finished=this.finished,et.rounds=ot,et.suffix=nt,et.outputLen=rt,et.enableXOF=it,et.destroyed=this.destroyed,et}}const gen=(o,et,tt)=>wrapConstructor(()=>new Keccak(et,o,tt)),sha3_224=gen(6,144,224/8),sha3_256=gen(6,136,256/8),sha3_384=gen(6,104,384/8),sha3_512=gen(6,72,512/8),keccak_224=gen(1,144,224/8),keccak_256=gen(1,136,256/8),keccak_384=gen(1,104,384/8),keccak_512=gen(1,72,512/8),genShake=(o,et,tt)=>wrapXOFConstructorWithOpts((nt={})=>new Keccak(et,o,nt.dkLen===void 0?tt:nt.dkLen,!0)),shake128=genShake(31,168,128/8),shake256=genShake(31,136,256/8),sha3$2=Object.freeze(Object.defineProperty({__proto__:null,Keccak,keccakP,keccak_224,keccak_256,keccak_384,keccak_512,sha3_224,sha3_256,sha3_384,sha3_512,shake128,shake256},Symbol.toStringTag,{value:"Module"}));function keccak256$1(o,et){const tt=et||"hex",nt=keccak_256(isHex(o,{strict:!1})?toBytes$3(o):o);return tt==="bytes"?nt:toHex(nt)}const checksumAddressCache=new LruMap(8192);function checksumAddress(o,et){if(checksumAddressCache.has(`${o}.${et}`))return checksumAddressCache.get(`${o}.${et}`);const tt=et?`${et}${o.toLowerCase()}`:o.substring(2).toLowerCase(),nt=keccak256$1(stringToBytes(tt),"bytes"),rt=(et?tt.substring(`${et}0x`.length):tt).split("");for(let it=0;it<40;it+=2)nt[it>>1]>>4>=8&&rt[it]&&(rt[it]=rt[it].toUpperCase()),(nt[it>>1]&15)>=8&&rt[it+1]&&(rt[it+1]=rt[it+1].toUpperCase());const ot=`0x${rt.join("")}`;return checksumAddressCache.set(`${o}.${et}`,ot),ot}function getAddress(o,et){if(!isAddress(o,{strict:!1}))throw new InvalidAddressError({address:o});return checksumAddress(o,et)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(o,et){const{strict:tt=!0}=et??{},nt=`${o}.${tt}`;if(isAddressCache.has(nt))return isAddressCache.get(nt);const rt=addressRegex.test(o)?o.toLowerCase()===o?!0:tt?checksumAddress(o)===o:!0:!1;return isAddressCache.set(nt,rt),rt}function slice(o,et,tt,{strict:nt}={}){return isHex(o,{strict:!1})?sliceHex(o,et,tt,{strict:nt}):sliceBytes(o,et,tt,{strict:nt})}function assertStartOffset(o,et){if(typeof et=="number"&&et>0&&et>size$2(o)-1)throw new SliceOffsetOutOfBoundsError({offset:et,position:"start",size:size$2(o)})}function assertEndOffset(o,et,tt){if(typeof et=="number"&&typeof tt=="number"&&size$2(o)!==tt-et)throw new SliceOffsetOutOfBoundsError({offset:tt,position:"end",size:size$2(o)})}function sliceBytes(o,et,tt,{strict:nt}={}){assertStartOffset(o,et);const rt=o.slice(et,tt);return nt&&assertEndOffset(rt,et,tt),rt}function sliceHex(o,et,tt,{strict:nt}={}){assertStartOffset(o,et);const rt=`0x${o.replace("0x","").slice((et??0)*2,(tt??o.length)*2)}`;return nt&&assertEndOffset(rt,et,tt),rt}function encodeAbiParameters(o,et){if(o.length!==et.length)throw new AbiEncodingLengthMismatchError({expectedLength:o.length,givenLength:et.length});const tt=prepareParams({params:o,values:et}),nt=encodeParams(tt);return nt.length===0?"0x":nt}function prepareParams({params:o,values:et}){const tt=[];for(let nt=0;nt0?concat$3([st,it]):st}}if(rt)return{dynamic:!0,encoded:it}}return{dynamic:!1,encoded:concat$3(ot.map(({encoded:it})=>it))}}function encodeBytes(o,{param:et}){const[,tt]=et.type.split("bytes"),nt=size$2(o);if(!tt){let rt=o;return nt%32!==0&&(rt=padHex(rt,{dir:"right",size:Math.ceil((o.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$3([padHex(numberToHex(nt,{size:32})),rt])}}if(nt!==Number.parseInt(tt))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(tt),value:o});return{dynamic:!1,encoded:padHex(o,{dir:"right"})}}function encodeBool(o){if(typeof o!="boolean")throw new BaseError$3(`Invalid boolean value: "${o}" (type: ${typeof o}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex(boolToHex(o))}}function encodeNumber(o,{signed:et}){return{dynamic:!1,encoded:numberToHex(o,{size:32,signed:et})}}function encodeString(o){const et=stringToHex(o),tt=Math.ceil(size$2(et)/32),nt=[];for(let rt=0;rtrt))}}function getArrayComponents(o){const et=o.match(/^(.*)\[(\d+)?\]$/);return et?[et[2]?Number(et[2]):null,et[1]]:void 0}const docsPath$2="/docs/contract/encodeDeployData";function encodeDeployData(o){const{abi:et,args:tt,bytecode:nt}=o;if(!tt||tt.length===0)return nt;const rt=et.find(it=>"type"in it&&it.type==="constructor");if(!rt)throw new AbiConstructorNotFoundError({docsPath:docsPath$2});if(!("inputs"in rt))throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});if(!rt.inputs||rt.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});const ot=encodeAbiParameters(rt.inputs,tt);return concatHex([nt,ot])}function parseAccount(o){return typeof o=="string"?{address:o,type:"json-rpc"}:o}class AccountNotFoundError extends BaseError$3{constructor({docsPath:et}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:et,docsSlug:"account",name:"AccountNotFoundError"})}}const scriptRel="modulepreload",assetsURL=function(o){return"/"+o},seen={},__vitePreload=function(et,tt,nt){let rt=Promise.resolve();if(tt&&tt.length>0){document.getElementsByTagName("link");const it=document.querySelector("meta[property=csp-nonce]"),st=(it==null?void 0:it.nonce)||(it==null?void 0:it.getAttribute("nonce"));rt=Promise.allSettled(tt.map(at=>{if(at=assetsURL(at),at in seen)return;seen[at]=!0;const ct=at.endsWith(".css"),lt=ct?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${at}"]${lt}`))return;const dt=document.createElement("link");if(dt.rel=ct?"stylesheet":scriptRel,ct||(dt.as="script"),dt.crossOrigin="",dt.href=at,st&&dt.setAttribute("nonce",st),document.head.appendChild(dt),ct)return new Promise((ht,ft)=>{dt.addEventListener("load",ht),dt.addEventListener("error",()=>ft(new Error(`Unable to preload CSS for ${at}`)))})}))}function ot(it){const st=new Event("vite:preloadError",{cancelable:!0});if(st.payload=it,window.dispatchEvent(st),!st.defaultPrevented)throw it}return rt.then(it=>{for(const st of it||[])st.status==="rejected"&&ot(st.reason);return et().catch(ot)})};class NegativeOffsetError extends BaseError$3{constructor({offset:et}){super(`Offset \`${et}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError$3{constructor({length:et,position:tt}){super(`Position \`${tt}\` is out of bounds (\`0 < position < ${et}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError$3{constructor({count:et,limit:tt}){super(`Recursive read limit of \`${tt}\` exceeded (recursive read count: \`${et}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(o){if(o<0||o>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:o})},decrementPosition(o){if(o<0)throw new NegativeOffsetError({offset:o});const et=this.position-o;this.assertPosition(et),this.position=et},getReadCount(o){return this.positionReadCount.get(o||this.position)||0},incrementPosition(o){if(o<0)throw new NegativeOffsetError({offset:o});const et=this.position+o;this.assertPosition(et),this.position=et},inspectByte(o){const et=o??this.position;return this.assertPosition(et),this.bytes[et]},inspectBytes(o,et){const tt=et??this.position;return this.assertPosition(tt+o-1),this.bytes.subarray(tt,tt+o)},inspectUint8(o){const et=o??this.position;return this.assertPosition(et),this.bytes[et]},inspectUint16(o){const et=o??this.position;return this.assertPosition(et+1),this.dataView.getUint16(et)},inspectUint24(o){const et=o??this.position;return this.assertPosition(et+2),(this.dataView.getUint16(et)<<8)+this.dataView.getUint8(et+2)},inspectUint32(o){const et=o??this.position;return this.assertPosition(et+3),this.dataView.getUint32(et)},pushByte(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushBytes(o){this.assertPosition(this.position+o.length-1),this.bytes.set(o,this.position),this.position+=o.length},pushUint8(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushUint16(o){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,o),this.position+=2},pushUint24(o){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,o>>8),this.dataView.setUint8(this.position+2,o&255),this.position+=3},pushUint32(o){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,o),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const o=this.inspectByte();return this.position++,o},readBytes(o,et){this.assertReadLimit(),this._touch();const tt=this.inspectBytes(o);return this.position+=et??o,tt},readUint8(){this.assertReadLimit(),this._touch();const o=this.inspectUint8();return this.position+=1,o},readUint16(){this.assertReadLimit(),this._touch();const o=this.inspectUint16();return this.position+=2,o},readUint24(){this.assertReadLimit(),this._touch();const o=this.inspectUint24();return this.position+=3,o},readUint32(){this.assertReadLimit(),this._touch();const o=this.inspectUint32();return this.position+=4,o},get remaining(){return this.bytes.length-this.position},setPosition(o){const et=this.position;return this.assertPosition(o),this.position=o,()=>this.position=et},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const o=this.getReadCount();this.positionReadCount.set(this.position,o+1),o>0&&this.recursiveReadCount++}};function createCursor(o,{recursiveReadLimit:et=8192}={}){const tt=Object.create(staticCursor);return tt.bytes=o,tt.dataView=new DataView(o.buffer,o.byteOffset,o.byteLength),tt.positionReadCount=new Map,tt.recursiveReadLimit=et,tt}function toRlp(o,et="hex"){const tt=getEncodable(o),nt=createCursor(new Uint8Array(tt.length));return tt.encode(nt),et==="hex"?bytesToHex$4(nt.bytes):nt.bytes}function getEncodable(o){return Array.isArray(o)?getEncodableList(o.map(et=>getEncodable(et))):getEncodableBytes(o)}function getEncodableList(o){const et=o.reduce((rt,ot)=>rt+ot.length,0),tt=getSizeOfLength(et);return{length:et<=55?1+et:1+tt+et,encode(rt){et<=55?rt.pushByte(192+et):(rt.pushByte(247+tt),tt===1?rt.pushUint8(et):tt===2?rt.pushUint16(et):tt===3?rt.pushUint24(et):rt.pushUint32(et));for(const{encode:ot}of o)ot(rt)}}}function getEncodableBytes(o){const et=typeof o=="string"?hexToBytes$3(o):o,tt=getSizeOfLength(et.length);return{length:et.length===1&&et[0]<128?1:et.length<=55?1+et.length:1+tt+et.length,encode(rt){et.length===1&&et[0]<128?rt.pushBytes(et):et.length<=55?(rt.pushByte(128+et.length),rt.pushBytes(et)):(rt.pushByte(183+tt),tt===1?rt.pushUint8(et.length):tt===2?rt.pushUint16(et.length):tt===3?rt.pushUint24(et.length):rt.pushUint32(et.length),rt.pushBytes(et))}}}function getSizeOfLength(o){if(o<2**8)return 1;if(o<2**16)return 2;if(o<2**24)return 3;if(o<2**32)return 4;throw new BaseError$3("Length is too large.")}class ChainDoesNotSupportContract extends BaseError$3{constructor({blockNumber:et,chain:tt,contract:nt}){super(`Chain "${tt.name}" does not support contract "${nt.name}".`,{metaMessages:["This could be due to any of the following:",...et&&nt.blockCreated&&nt.blockCreated>et?[`- The contract "${nt.name}" was not deployed until block ${nt.blockCreated} (current block ${et}).`]:[`- The chain does not have the contract "${nt.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ClientChainNotConfiguredError extends BaseError$3{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError$3{constructor({chainId:et}){super(typeof et=="number"?`Chain ID "${et}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9},weiUnits={ether:-18,gwei:-9};function formatUnits(o,et){let tt=o.toString();const nt=tt.startsWith("-");nt&&(tt=tt.slice(1)),tt=tt.padStart(et,"0");let[rt,ot]=[tt.slice(0,tt.length-et),tt.slice(tt.length-et)];return ot=ot.replace(/(0+)$/,""),`${nt?"-":""}${rt||"0"}${ot?`.${ot}`:""}`}function formatGwei(o,et="wei"){return formatUnits(o,gweiUnits[et])}class ExecutionRevertedError extends BaseError$3{constructor({cause:et,message:tt}={}){var rt;const nt=(rt=tt==null?void 0:tt.replace("execution reverted: ",""))==null?void 0:rt.replace("execution reverted","");super(`Execution reverted ${nt?`with reason: ${nt}`:"for an unknown reason"}.`,{cause:et,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError$3{constructor({cause:et,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:et,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class FeeCapTooLowError extends BaseError$3{constructor({cause:et,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)}`:""} gwei) cannot be lower than the block base fee.`,{cause:et,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class NonceTooHighError extends BaseError$3{constructor({cause:et,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}is higher than the next one expected.`,{cause:et,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError$3{constructor({cause:et,nonce:tt}={}){super([`Nonce provided for the transaction ${tt?`(${tt}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:et,name:"NonceTooLowError"})}}Object.defineProperty(NonceTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class NonceMaxValueError extends BaseError$3{constructor({cause:et,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}exceeds the maximum allowed nonce.`,{cause:et,name:"NonceMaxValueError"})}}Object.defineProperty(NonceMaxValueError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class InsufficientFundsError extends BaseError$3{constructor({cause:et}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:et,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(InsufficientFundsError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class IntrinsicGasTooHighError extends BaseError$3{constructor({cause:et,gas:tt}={}){super(`The amount of gas ${tt?`(${tt}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:et,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(IntrinsicGasTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class IntrinsicGasTooLowError extends BaseError$3{constructor({cause:et,gas:tt}={}){super(`The amount of gas ${tt?`(${tt}) `:""}provided for the transaction is too low.`,{cause:et,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(IntrinsicGasTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class TransactionTypeNotSupportedError extends BaseError$3{constructor({cause:et}){super("The transaction type is not supported for this chain.",{cause:et,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(TransactionTypeNotSupportedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class TipAboveFeeCapError extends BaseError$3{constructor({cause:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${nt?` = ${formatGwei(nt)} gwei`:""}).`].join(` `),{cause:et,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class UnknownNodeError extends BaseError$3{constructor({cause:et}){super(`An error occurred while executing: ${et==null?void 0:et.shortMessage}`,{cause:et,name:"UnknownNodeError"})}}function formatEther(o,et="wei"){return formatUnits(o,etherUnits[et])}function prettyPrint(o){const et=Object.entries(o).map(([nt,rt])=>rt===void 0||rt===!1?null:[nt,rt]).filter(Boolean),tt=et.reduce((nt,[rt])=>Math.max(nt,rt.length),0);return et.map(([nt,rt])=>` ${`${nt}:`.padEnd(tt+1)} ${rt}`).join(` `)}class FeeConflictError extends BaseError$3{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` `),{name:"FeeConflictError"})}}class InvalidLegacyVError extends BaseError$3{constructor({v:et}){super(`Invalid \`v\` value "${et}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class InvalidSerializableTransactionError extends BaseError$3{constructor({transaction:et}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",prettyPrint(et),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class InvalidStorageKeySizeError extends BaseError$3{constructor({storageKey:et}){super(`Size for storage key "${et}" is invalid. Expected 32 bytes. Got ${Math.floor((et.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}const stringify$2=(o,et,tt)=>JSON.stringify(o,(nt,rt)=>typeof rt=="bigint"?rt.toString():rt,tt),getContractAddress=o=>o,getUrl=o=>o;class HttpRequestError extends BaseError$3{constructor({body:et,cause:tt,details:nt,headers:rt,status:ot,url:it}){super("HTTP request failed.",{cause:tt,details:nt,metaMessages:[ot&&`Status: ${ot}`,`URL: ${getUrl(it)}`,et&&`Request body: ${stringify$2(et)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=et,this.headers=rt,this.status=ot,this.url=it}}class RpcRequestError extends BaseError$3{constructor({body:et,error:tt,url:nt}){super("RPC Request failed.",{cause:tt,details:tt.message,metaMessages:[`URL: ${getUrl(nt)}`,`Request body: ${stringify$2(et)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=tt.code}}let TimeoutError$4=class extends BaseError$3{constructor({body:et,url:tt}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${getUrl(tt)}`,`Request body: ${stringify$2(et)}`],name:"TimeoutError"})}};const unknownErrorCode=-1;class RpcError extends BaseError$3{constructor(et,{code:tt,docsPath:nt,metaMessages:rt,name:ot,shortMessage:it}){super(it,{cause:et,docsPath:nt,metaMessages:rt||(et==null?void 0:et.metaMessages),name:ot||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=ot||et.name,this.code=et instanceof RpcRequestError?et.code:tt??unknownErrorCode}}class ProviderRpcError extends RpcError{constructor(et,tt){super(et,tt),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=tt.data}}class ParseRpcError extends RpcError{constructor(et){super(et,{code:ParseRpcError.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ParseRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class InvalidRequestRpcError extends RpcError{constructor(et){super(et,{code:InvalidRequestRpcError.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(InvalidRequestRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class MethodNotFoundRpcError extends RpcError{constructor(et,{method:tt}={}){super(et,{code:MethodNotFoundRpcError.code,name:"MethodNotFoundRpcError",shortMessage:`The method${tt?` "${tt}"`:""} does not exist / is not available.`})}}Object.defineProperty(MethodNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class InvalidParamsRpcError extends RpcError{constructor(et){super(et,{code:InvalidParamsRpcError.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(InvalidParamsRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class InternalRpcError extends RpcError{constructor(et){super(et,{code:InternalRpcError.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(InternalRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class InvalidInputRpcError extends RpcError{constructor(et){super(et,{code:InvalidInputRpcError.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(InvalidInputRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ResourceNotFoundRpcError extends RpcError{constructor(et){super(et,{code:ResourceNotFoundRpcError.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ResourceNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ResourceUnavailableRpcError extends RpcError{constructor(et){super(et,{code:ResourceUnavailableRpcError.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ResourceUnavailableRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class TransactionRejectedRpcError extends RpcError{constructor(et){super(et,{code:TransactionRejectedRpcError.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(TransactionRejectedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class MethodNotSupportedRpcError extends RpcError{constructor(et,{method:tt}={}){super(et,{code:MethodNotSupportedRpcError.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${tt?` "${tt}"`:""} is not implemented.`})}}Object.defineProperty(MethodNotSupportedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class LimitExceededRpcError extends RpcError{constructor(et){super(et,{code:LimitExceededRpcError.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(LimitExceededRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class JsonRpcVersionUnsupportedError extends RpcError{constructor(et){super(et,{code:JsonRpcVersionUnsupportedError.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(JsonRpcVersionUnsupportedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class UserRejectedRequestError extends ProviderRpcError{constructor(et){super(et,{code:UserRejectedRequestError.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(UserRejectedRequestError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class UnauthorizedProviderError extends ProviderRpcError{constructor(et){super(et,{code:UnauthorizedProviderError.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(UnauthorizedProviderError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class UnsupportedProviderMethodError extends ProviderRpcError{constructor(et,{method:tt}={}){super(et,{code:UnsupportedProviderMethodError.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${tt?` " ${tt}"`:""}.`})}}Object.defineProperty(UnsupportedProviderMethodError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ProviderDisconnectedError extends ProviderRpcError{constructor(et){super(et,{code:ProviderDisconnectedError.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ProviderDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ChainDisconnectedError extends ProviderRpcError{constructor(et){super(et,{code:ChainDisconnectedError.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ChainDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class SwitchChainError extends ProviderRpcError{constructor(et){super(et,{code:SwitchChainError.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(SwitchChainError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class UnknownRpcError extends RpcError{constructor(et){super(et,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function getNodeError(o,et){const tt=(o.details||"").toLowerCase(),nt=o instanceof BaseError$3?o.walk(rt=>(rt==null?void 0:rt.code)===ExecutionRevertedError.code):o;return nt instanceof BaseError$3?new ExecutionRevertedError({cause:o,message:nt.details}):ExecutionRevertedError.nodeMessage.test(tt)?new ExecutionRevertedError({cause:o,message:o.details}):FeeCapTooHighError.nodeMessage.test(tt)?new FeeCapTooHighError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(tt)?new FeeCapTooLowError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas}):NonceTooHighError.nodeMessage.test(tt)?new NonceTooHighError({cause:o,nonce:et==null?void 0:et.nonce}):NonceTooLowError.nodeMessage.test(tt)?new NonceTooLowError({cause:o,nonce:et==null?void 0:et.nonce}):NonceMaxValueError.nodeMessage.test(tt)?new NonceMaxValueError({cause:o,nonce:et==null?void 0:et.nonce}):InsufficientFundsError.nodeMessage.test(tt)?new InsufficientFundsError({cause:o}):IntrinsicGasTooHighError.nodeMessage.test(tt)?new IntrinsicGasTooHighError({cause:o,gas:et==null?void 0:et.gas}):IntrinsicGasTooLowError.nodeMessage.test(tt)?new IntrinsicGasTooLowError({cause:o,gas:et==null?void 0:et.gas}):TransactionTypeNotSupportedError.nodeMessage.test(tt)?new TransactionTypeNotSupportedError({cause:o}):TipAboveFeeCapError.nodeMessage.test(tt)?new TipAboveFeeCapError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas,maxPriorityFeePerGas:et==null?void 0:et.maxPriorityFeePerGas}):new UnknownNodeError({cause:o})}function extract$1(o,{format:et}){if(!et)return{};const tt={};function nt(ot){const it=Object.keys(ot);for(const st of it)st in o&&(tt[st]=o[st]),ot[st]&&typeof ot[st]=="object"&&!Array.isArray(ot[st])&&nt(ot[st])}const rt=et(o||{});return nt(rt),tt}function defineFormatter(o,et){return({exclude:tt,format:nt})=>({exclude:tt,format:rt=>{const ot=et(rt);if(tt)for(const it of tt)delete ot[it];return{...ot,...nt(rt)}},type:o})}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(o){const et={};return typeof o.authorizationList<"u"&&(et.authorizationList=formatAuthorizationList$1(o.authorizationList)),typeof o.accessList<"u"&&(et.accessList=o.accessList),typeof o.blobVersionedHashes<"u"&&(et.blobVersionedHashes=o.blobVersionedHashes),typeof o.blobs<"u"&&(typeof o.blobs[0]!="string"?et.blobs=o.blobs.map(tt=>bytesToHex$4(tt)):et.blobs=o.blobs),typeof o.data<"u"&&(et.data=o.data),typeof o.from<"u"&&(et.from=o.from),typeof o.gas<"u"&&(et.gas=numberToHex(o.gas)),typeof o.gasPrice<"u"&&(et.gasPrice=numberToHex(o.gasPrice)),typeof o.maxFeePerBlobGas<"u"&&(et.maxFeePerBlobGas=numberToHex(o.maxFeePerBlobGas)),typeof o.maxFeePerGas<"u"&&(et.maxFeePerGas=numberToHex(o.maxFeePerGas)),typeof o.maxPriorityFeePerGas<"u"&&(et.maxPriorityFeePerGas=numberToHex(o.maxPriorityFeePerGas)),typeof o.nonce<"u"&&(et.nonce=numberToHex(o.nonce)),typeof o.to<"u"&&(et.to=o.to),typeof o.type<"u"&&(et.type=rpcTransactionType[o.type]),typeof o.value<"u"&&(et.value=numberToHex(o.value)),et}function formatAuthorizationList$1(o){return o.map(et=>({address:et.contractAddress,r:et.r,s:et.s,chainId:numberToHex(et.chainId),nonce:numberToHex(et.nonce),...typeof et.yParity<"u"?{yParity:numberToHex(et.yParity)}:{},...typeof et.v<"u"&&typeof et.yParity>"u"?{v:numberToHex(et.v)}:{}}))}function getAction$1(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const maxUint256=2n**256n-1n;function assertRequest(o){const{account:et,gasPrice:tt,maxFeePerGas:nt,maxPriorityFeePerGas:rt,to:ot}=o,it=et?parseAccount(et):void 0;if(it&&!isAddress(it.address))throw new InvalidAddressError({address:it.address});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof tt<"u"&&(typeof nt<"u"||typeof rt<"u"))throw new FeeConflictError;if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(rt&&nt&&rt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:rt})}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(o){const et={...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,chainId:o.chainId?hexToNumber$2(o.chainId):void 0,gas:o.gas?BigInt(o.gas):void 0,gasPrice:o.gasPrice?BigInt(o.gasPrice):void 0,maxFeePerBlobGas:o.maxFeePerBlobGas?BigInt(o.maxFeePerBlobGas):void 0,maxFeePerGas:o.maxFeePerGas?BigInt(o.maxFeePerGas):void 0,maxPriorityFeePerGas:o.maxPriorityFeePerGas?BigInt(o.maxPriorityFeePerGas):void 0,nonce:o.nonce?hexToNumber$2(o.nonce):void 0,to:o.to?o.to:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,type:o.type?transactionType[o.type]:void 0,typeHex:o.type?o.type:void 0,value:o.value?BigInt(o.value):void 0,v:o.v?BigInt(o.v):void 0};return o.authorizationList&&(et.authorizationList=formatAuthorizationList(o.authorizationList)),et.yParity=(()=>{if(o.yParity)return Number(o.yParity);if(typeof et.v=="bigint"){if(et.v===0n||et.v===27n)return 0;if(et.v===1n||et.v===28n)return 1;if(et.v>=35n)return et.v%2n===0n?1:0}})(),et.type==="legacy"&&(delete et.accessList,delete et.maxFeePerBlobGas,delete et.maxFeePerGas,delete et.maxPriorityFeePerGas,delete et.yParity),et.type==="eip2930"&&(delete et.maxFeePerBlobGas,delete et.maxFeePerGas,delete et.maxPriorityFeePerGas),et.type==="eip1559"&&delete et.maxFeePerBlobGas,et}const defineTransaction=defineFormatter("transaction",formatTransaction);function formatAuthorizationList(o){return o.map(et=>({contractAddress:et.address,chainId:Number(et.chainId),nonce:Number(et.nonce),r:et.r,s:et.s,yParity:Number(et.yParity)}))}function formatBlock(o){var tt;const et=(tt=o.transactions)==null?void 0:tt.map(nt=>typeof nt=="string"?nt:formatTransaction(nt));return{...o,baseFeePerGas:o.baseFeePerGas?BigInt(o.baseFeePerGas):null,blobGasUsed:o.blobGasUsed?BigInt(o.blobGasUsed):void 0,difficulty:o.difficulty?BigInt(o.difficulty):void 0,excessBlobGas:o.excessBlobGas?BigInt(o.excessBlobGas):void 0,gasLimit:o.gasLimit?BigInt(o.gasLimit):void 0,gasUsed:o.gasUsed?BigInt(o.gasUsed):void 0,hash:o.hash?o.hash:null,logsBloom:o.logsBloom?o.logsBloom:null,nonce:o.nonce?o.nonce:null,number:o.number?BigInt(o.number):null,size:o.size?BigInt(o.size):void 0,timestamp:o.timestamp?BigInt(o.timestamp):void 0,transactions:et,totalDifficulty:o.totalDifficulty?BigInt(o.totalDifficulty):null}}const defineBlock=defineFormatter("block",formatBlock);class AccountStateConflictError extends BaseError$3{constructor({address:et}){super(`State for account "${et}" is set multiple times.`,{name:"AccountStateConflictError"})}}class StateAssignmentConflictError extends BaseError$3{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function prettyStateMapping(o){return o.reduce((et,{slot:tt,value:nt})=>`${et} ${tt}: ${nt} +`)})}}Object.defineProperty(InvalidInputRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ResourceNotFoundRpcError extends RpcError{constructor(et){super(et,{code:ResourceNotFoundRpcError.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ResourceNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ResourceUnavailableRpcError extends RpcError{constructor(et){super(et,{code:ResourceUnavailableRpcError.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ResourceUnavailableRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class TransactionRejectedRpcError extends RpcError{constructor(et){super(et,{code:TransactionRejectedRpcError.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(TransactionRejectedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class MethodNotSupportedRpcError extends RpcError{constructor(et,{method:tt}={}){super(et,{code:MethodNotSupportedRpcError.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${tt?` "${tt}"`:""} is not implemented.`})}}Object.defineProperty(MethodNotSupportedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class LimitExceededRpcError extends RpcError{constructor(et){super(et,{code:LimitExceededRpcError.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(LimitExceededRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class JsonRpcVersionUnsupportedError extends RpcError{constructor(et){super(et,{code:JsonRpcVersionUnsupportedError.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(JsonRpcVersionUnsupportedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class UserRejectedRequestError extends ProviderRpcError{constructor(et){super(et,{code:UserRejectedRequestError.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(UserRejectedRequestError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class UnauthorizedProviderError extends ProviderRpcError{constructor(et){super(et,{code:UnauthorizedProviderError.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(UnauthorizedProviderError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class UnsupportedProviderMethodError extends ProviderRpcError{constructor(et,{method:tt}={}){super(et,{code:UnsupportedProviderMethodError.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${tt?` " ${tt}"`:""}.`})}}Object.defineProperty(UnsupportedProviderMethodError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ProviderDisconnectedError extends ProviderRpcError{constructor(et){super(et,{code:ProviderDisconnectedError.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ProviderDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ChainDisconnectedError extends ProviderRpcError{constructor(et){super(et,{code:ChainDisconnectedError.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ChainDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class SwitchChainError extends ProviderRpcError{constructor(et){super(et,{code:SwitchChainError.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(SwitchChainError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class UnknownRpcError extends RpcError{constructor(et){super(et,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function getNodeError(o,et){const tt=(o.details||"").toLowerCase(),nt=o instanceof BaseError$3?o.walk(rt=>(rt==null?void 0:rt.code)===ExecutionRevertedError.code):o;return nt instanceof BaseError$3?new ExecutionRevertedError({cause:o,message:nt.details}):ExecutionRevertedError.nodeMessage.test(tt)?new ExecutionRevertedError({cause:o,message:o.details}):FeeCapTooHighError.nodeMessage.test(tt)?new FeeCapTooHighError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(tt)?new FeeCapTooLowError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas}):NonceTooHighError.nodeMessage.test(tt)?new NonceTooHighError({cause:o,nonce:et==null?void 0:et.nonce}):NonceTooLowError.nodeMessage.test(tt)?new NonceTooLowError({cause:o,nonce:et==null?void 0:et.nonce}):NonceMaxValueError.nodeMessage.test(tt)?new NonceMaxValueError({cause:o,nonce:et==null?void 0:et.nonce}):InsufficientFundsError.nodeMessage.test(tt)?new InsufficientFundsError({cause:o}):IntrinsicGasTooHighError.nodeMessage.test(tt)?new IntrinsicGasTooHighError({cause:o,gas:et==null?void 0:et.gas}):IntrinsicGasTooLowError.nodeMessage.test(tt)?new IntrinsicGasTooLowError({cause:o,gas:et==null?void 0:et.gas}):TransactionTypeNotSupportedError.nodeMessage.test(tt)?new TransactionTypeNotSupportedError({cause:o}):TipAboveFeeCapError.nodeMessage.test(tt)?new TipAboveFeeCapError({cause:o,maxFeePerGas:et==null?void 0:et.maxFeePerGas,maxPriorityFeePerGas:et==null?void 0:et.maxPriorityFeePerGas}):new UnknownNodeError({cause:o})}function extract$1(o,{format:et}){if(!et)return{};const tt={};function nt(ot){const it=Object.keys(ot);for(const st of it)st in o&&(tt[st]=o[st]),ot[st]&&typeof ot[st]=="object"&&!Array.isArray(ot[st])&&nt(ot[st])}const rt=et(o||{});return nt(rt),tt}function defineFormatter(o,et){return({exclude:tt,format:nt})=>({exclude:tt,format:rt=>{const ot=et(rt);if(tt)for(const it of tt)delete ot[it];return{...ot,...nt(rt)}},type:o})}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(o){const et={};return typeof o.authorizationList<"u"&&(et.authorizationList=formatAuthorizationList$1(o.authorizationList)),typeof o.accessList<"u"&&(et.accessList=o.accessList),typeof o.blobVersionedHashes<"u"&&(et.blobVersionedHashes=o.blobVersionedHashes),typeof o.blobs<"u"&&(typeof o.blobs[0]!="string"?et.blobs=o.blobs.map(tt=>bytesToHex$4(tt)):et.blobs=o.blobs),typeof o.data<"u"&&(et.data=o.data),typeof o.from<"u"&&(et.from=o.from),typeof o.gas<"u"&&(et.gas=numberToHex(o.gas)),typeof o.gasPrice<"u"&&(et.gasPrice=numberToHex(o.gasPrice)),typeof o.maxFeePerBlobGas<"u"&&(et.maxFeePerBlobGas=numberToHex(o.maxFeePerBlobGas)),typeof o.maxFeePerGas<"u"&&(et.maxFeePerGas=numberToHex(o.maxFeePerGas)),typeof o.maxPriorityFeePerGas<"u"&&(et.maxPriorityFeePerGas=numberToHex(o.maxPriorityFeePerGas)),typeof o.nonce<"u"&&(et.nonce=numberToHex(o.nonce)),typeof o.to<"u"&&(et.to=o.to),typeof o.type<"u"&&(et.type=rpcTransactionType[o.type]),typeof o.value<"u"&&(et.value=numberToHex(o.value)),et}function formatAuthorizationList$1(o){return o.map(et=>({address:et.contractAddress,r:et.r,s:et.s,chainId:numberToHex(et.chainId),nonce:numberToHex(et.nonce),...typeof et.yParity<"u"?{yParity:numberToHex(et.yParity)}:{},...typeof et.v<"u"&&typeof et.yParity>"u"?{v:numberToHex(et.v)}:{}}))}function getAction$1(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const maxUint256=2n**256n-1n;function assertRequest(o){const{account:et,gasPrice:tt,maxFeePerGas:nt,maxPriorityFeePerGas:rt,to:ot}=o,it=et?parseAccount(et):void 0;if(it&&!isAddress(it.address))throw new InvalidAddressError({address:it.address});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof tt<"u"&&(typeof nt<"u"||typeof rt<"u"))throw new FeeConflictError;if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(rt&&nt&&rt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:rt})}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(o){const et={...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,chainId:o.chainId?hexToNumber$2(o.chainId):void 0,gas:o.gas?BigInt(o.gas):void 0,gasPrice:o.gasPrice?BigInt(o.gasPrice):void 0,maxFeePerBlobGas:o.maxFeePerBlobGas?BigInt(o.maxFeePerBlobGas):void 0,maxFeePerGas:o.maxFeePerGas?BigInt(o.maxFeePerGas):void 0,maxPriorityFeePerGas:o.maxPriorityFeePerGas?BigInt(o.maxPriorityFeePerGas):void 0,nonce:o.nonce?hexToNumber$2(o.nonce):void 0,to:o.to?o.to:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,type:o.type?transactionType[o.type]:void 0,typeHex:o.type?o.type:void 0,value:o.value?BigInt(o.value):void 0,v:o.v?BigInt(o.v):void 0};return o.authorizationList&&(et.authorizationList=formatAuthorizationList(o.authorizationList)),et.yParity=(()=>{if(o.yParity)return Number(o.yParity);if(typeof et.v=="bigint"){if(et.v===0n||et.v===27n)return 0;if(et.v===1n||et.v===28n)return 1;if(et.v>=35n)return et.v%2n===0n?1:0}})(),et.type==="legacy"&&(delete et.accessList,delete et.maxFeePerBlobGas,delete et.maxFeePerGas,delete et.maxPriorityFeePerGas,delete et.yParity),et.type==="eip2930"&&(delete et.maxFeePerBlobGas,delete et.maxFeePerGas,delete et.maxPriorityFeePerGas),et.type==="eip1559"&&delete et.maxFeePerBlobGas,et}const defineTransaction=defineFormatter("transaction",formatTransaction);function formatAuthorizationList(o){return o.map(et=>({contractAddress:et.address,chainId:Number(et.chainId),nonce:Number(et.nonce),r:et.r,s:et.s,yParity:Number(et.yParity)}))}function formatBlock(o){const et=(o.transactions??[]).map(tt=>typeof tt=="string"?tt:formatTransaction(tt));return{...o,baseFeePerGas:o.baseFeePerGas?BigInt(o.baseFeePerGas):null,blobGasUsed:o.blobGasUsed?BigInt(o.blobGasUsed):void 0,difficulty:o.difficulty?BigInt(o.difficulty):void 0,excessBlobGas:o.excessBlobGas?BigInt(o.excessBlobGas):void 0,gasLimit:o.gasLimit?BigInt(o.gasLimit):void 0,gasUsed:o.gasUsed?BigInt(o.gasUsed):void 0,hash:o.hash?o.hash:null,logsBloom:o.logsBloom?o.logsBloom:null,nonce:o.nonce?o.nonce:null,number:o.number?BigInt(o.number):null,size:o.size?BigInt(o.size):void 0,timestamp:o.timestamp?BigInt(o.timestamp):void 0,transactions:et,totalDifficulty:o.totalDifficulty?BigInt(o.totalDifficulty):null}}const defineBlock=defineFormatter("block",formatBlock);class AccountStateConflictError extends BaseError$3{constructor({address:et}){super(`State for account "${et}" is set multiple times.`,{name:"AccountStateConflictError"})}}class StateAssignmentConflictError extends BaseError$3{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function prettyStateMapping(o){return o.reduce((et,{slot:tt,value:nt})=>`${et} ${tt}: ${nt} `,"")}function prettyStateOverride(o){return o.reduce((et,{address:tt,...nt})=>{let rt=`${et} ${tt}: `;return nt.nonce&&(rt+=` nonce: ${nt.nonce} `),nt.balance&&(rt+=` balance: ${nt.balance} @@ -72,11 +72,11 @@ Error generating stack: `+ot.message+` `),nt.state&&(rt+=` state: `,rt+=prettyStateMapping(nt.state)),nt.stateDiff&&(rt+=` stateDiff: `,rt+=prettyStateMapping(nt.stateDiff)),rt},` State Override: -`).slice(0,-1)}function serializeStateMapping(o){if(!(!o||o.length===0))return o.reduce((et,{slot:tt,value:nt})=>{if(tt.length!==66)throw new InvalidBytesLengthError({size:tt.length,targetSize:66,type:"hex"});if(nt.length!==66)throw new InvalidBytesLengthError({size:nt.length,targetSize:66,type:"hex"});return et[tt]=nt,et},{})}function serializeAccountStateOverride(o){const{balance:et,nonce:tt,state:nt,stateDiff:rt,code:ot}=o,it={};if(ot!==void 0&&(it.code=ot),et!==void 0&&(it.balance=numberToHex(et)),tt!==void 0&&(it.nonce=numberToHex(tt)),nt!==void 0&&(it.state=serializeStateMapping(nt)),rt!==void 0){if(it.state)throw new StateAssignmentConflictError;it.stateDiff=serializeStateMapping(rt)}return it}function serializeStateOverride(o){if(!o)return;const et={};for(const{address:tt,...nt}of o){if(!isAddress(tt,{strict:!1}))throw new InvalidAddressError({address:tt});if(et[tt])throw new AccountStateConflictError({address:tt});et[tt]=serializeAccountStateOverride(nt)}return et}async function getBalance$1(o,{address:et,blockNumber:tt,blockTag:nt="latest"}){const rt=tt?numberToHex(tt):void 0,ot=await o.request({method:"eth_getBalance",params:[et,rt||nt]});return BigInt(ot)}function blobsToCommitments(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(ot=>hexToBytes$3(ot)):o.blobs,rt=[];for(const ot of nt)rt.push(Uint8Array.from(et.blobToKzgCommitment(ot)));return tt==="bytes"?rt:rt.map(ot=>bytesToHex$4(ot))}function blobsToProofs(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(it=>hexToBytes$3(it)):o.blobs,rt=typeof o.commitments[0]=="string"?o.commitments.map(it=>hexToBytes$3(it)):o.commitments,ot=[];for(let it=0;itbytesToHex$4(it))}function setBigUint64$1(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=nt?4:0,ct=nt?0:4;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}const Chi=(o,et,tt)=>o&et^~o&tt,Maj=(o,et,tt)=>o&et^o&tt^et&tt;class HashMD extends Hash{constructor(et,tt,nt,rt){super(),this.blockLen=et,this.outputLen=tt,this.padOffset=nt,this.isLE=rt,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(et),this.view=createView$1(this.buffer)}update(et){exists$1(this);const{view:tt,buffer:nt,blockLen:rt}=this;et=toBytes$2(et);const ot=et.length;for(let it=0;itrt-it&&(this.process(nt,0),it=0);for(let dt=it;dtlt.length)throw new Error("_sha2: outputLen bigger than state");for(let dt=0;dt>>3,ft=rotr(pt,17)^rotr(pt,19)^pt>>>10;SHA256_W[dt]=ft+SHA256_W[dt-7]+mt+SHA256_W[dt-16]|0}let{A:nt,B:rt,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),pt=lt+ht+Chi(st,at,ct)+SHA256_K[dt]+SHA256_W[dt]|0,ft=(rotr(nt,2)^rotr(nt,13)^rotr(nt,22))+Maj(nt,rt,ot)|0;lt=ct,ct=at,at=st,st=it+pt|0,it=ot,ot=rt,rt=nt,nt=pt+ft|0}nt=nt+this.A|0,rt=rt+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(nt,rt,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$2=wrapConstructor(()=>new SHA256);function sha256$1(o,et){return sha256$2(isHex(o,{strict:!1})?toBytes$3(o):o)}function commitmentToVersionedHash(o){const{commitment:et,version:tt=1}=o,nt=o.to??(typeof et=="string"?"hex":"bytes"),rt=sha256$1(et);return rt.set([tt],0),nt==="bytes"?rt:bytesToHex$4(rt)}function commitmentsToVersionedHashes(o){const{commitments:et,version:tt}=o,nt=o.to??(typeof et[0]=="string"?"hex":"bytes"),rt=[];for(const ot of et)rt.push(commitmentToVersionedHash({commitment:ot,to:nt,version:tt}));return rt}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:et,size:tt}){super("Blob size is too large.",{metaMessages:[`Max: ${et} 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:et,size:tt}){super(`Versioned hash "${et}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${tt}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError$3{constructor({hash:et,version:tt}){super(`Versioned hash "${et}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${tt}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(o){const et=o.to??(typeof o.data=="string"?"hex":"bytes"),tt=typeof o.data=="string"?hexToBytes$3(o.data):o.data,nt=size$2(tt);if(!nt)throw new EmptyBlobError;if(nt>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:nt});const rt=[];let ot=!0,it=0;for(;ot;){const st=createCursor(new Uint8Array(bytesPerBlob));let at=0;for(;atst.bytes):rt.map(st=>bytesToHex$4(st.bytes))}function toBlobSidecars(o){const{data:et,kzg:tt,to:nt}=o,rt=o.blobs??toBlobs({data:et,to:nt}),ot=o.commitments??blobsToCommitments({blobs:rt,kzg:tt,to:nt}),it=o.proofs??blobsToProofs({blobs:rt,commitments:ot,kzg:tt,to:nt}),st=[];for(let at=0;at1||tt[0]>1)throw new InvalidBytesBooleanError(tt);return!!tt[0]}function bytesToNumber$1(o,et={}){typeof et.size<"u"&&assertSize(o,{size:et.size});const tt=bytesToHex$4(o,et);return hexToNumber$2(tt,et)}function bytesToString(o,et={}){let tt=o;return typeof et.size<"u"&&(assertSize(tt,{size:et.size}),tt=trim$1(tt,{dir:"right"})),new TextDecoder().decode(tt)}function decodeAbiParameters(o,et){const tt=typeof et=="string"?hexToBytes$3(et):et,nt=createCursor(tt);if(size$2(tt)===0&&o.length>0)throw new AbiDecodingZeroDataError;if(size$2(et)&&size$2(et)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof et=="string"?et:bytesToHex$4(et),params:o,size:size$2(et)});let rt=0;const ot=[];for(let it=0;it48?bytesToBigInt(rt,{signed:tt}):bytesToNumber$1(rt,{signed:tt}),32]}function decodeTuple(o,et,{staticPosition:tt}){const nt=et.components.length===0||et.components.some(({name:it})=>!it),rt=nt?[]:{};let ot=0;if(hasDynamicChild(et)){const it=bytesToNumber$1(o.readBytes(sizeOfOffset)),st=tt+it;for(let at=0;atkeccak256$1(toBytes$3(o));function hashSignature(o){return hash(o)}const version$7="1.0.6";let BaseError$2=class ks extends Error{constructor(et,tt={}){var it;const nt=tt.cause instanceof ks?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,rt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: https://abitype.dev${rt}`]:[],...nt?[`Details: ${nt}`]:[],`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=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}};function execTyped(o,et){const tt=o.exec(et);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(o){let et=o.type;if(tupleRegex.test(o.type)&&"components"in o){et="(";const tt=o.components.length;for(let rt=0;rt[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(o){return errorSignatureRegex.test(o)}function execErrorSignature(o){return execTyped(errorSignatureRegex,o)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(o){return eventSignatureRegex.test(o)}function execEventSignature(o){return execTyped(eventSignatureRegex,o)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(o){return functionSignatureRegex.test(o)}function execFunctionSignature(o){return execTyped(functionSignatureRegex,o)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(o){return structSignatureRegex.test(o)}function execStructSignature(o){return execTyped(structSignatureRegex,o)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(o){return constructorSignatureRegex.test(o)}function execConstructorSignature(o){return execTyped(constructorSignatureRegex,o)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(o){return fallbackSignatureRegex.test(o)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(o){return receiveSignatureRegex.test(o)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" 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:et}){super("Unknown type.",{metaMessages:[`Type "${et}" 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:et}){super("Invalid ABI parameter.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$2{constructor({param:et,name:tt}){super("Invalid ABI parameter.",{details:et,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:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" 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:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${nt}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$2{constructor({abiParameter:et}){super("Invalid ABI parameter.",{details:JSON.stringify(et,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:et,type:tt}){super(`Invalid ${tt} signature.`,{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class UnknownSignatureError extends BaseError$2{constructor({signature:et}){super("Unknown signature.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$2{constructor({signature:et}){super("Invalid struct signature.",{details:et,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$2{constructor({type:et}){super("Circular reference detected.",{metaMessages:[`Struct "${et}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$2{constructor({current:et,depth:tt}){super("Unbalanced parentheses.",{metaMessages:[`"${et.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(o,et){return et?`${et}:${o}`:o}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(o,et={}){if(isFunctionSignature(o)){const tt=execFunctionSignature(o);if(!tt)throw new InvalidSignatureError$1({signature:o,type:"function"});const nt=splitParameters(tt.parameters),rt=[],ot=nt.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(o,et){var dt,ht;const tt=getParameterCacheKey(o,et==null?void 0:et.type);if(parameterCache.has(tt))return parameterCache.get(tt);const nt=isTupleRegex.test(o),rt=execTyped(nt?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,o);if(!rt)throw new InvalidParameterError({param:o});if(rt.name&&isSolidityKeyword(rt.name))throw new SolidityProtectedKeywordError({param:o,name:rt.name});const ot=rt.name?{name:rt.name}:{},it=rt.modifier==="indexed"?{indexed:!0}:{},st=(et==null?void 0:et.structs)??{};let at,ct={};if(nt){at="tuple";const pt=splitParameters(rt.type),mt=[],ft=pt.length;for(let yt=0;yt[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(o,et,tt=new Set){const nt=[],rt=o.length;for(let ot=0;ot{const et=typeof o=="string"?o:formatAbiItem(o);return normalizeSignature$1(et)};function toSignatureHash(o){return hashSignature(toSignature(o))}const toEventSelector=toSignatureHash,toFunctionSelector=o=>slice(toSignatureHash(o),0,4);function getAbiItem(o){const{abi:et,args:tt=[],name:nt}=o,rt=isHex(nt,{strict:!1}),ot=et.filter(st=>rt?st.type==="function"?toFunctionSelector(st)===nt:st.type==="event"?toEventSelector(st)===nt:!1:"name"in st&&st.name===nt);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(o,et){const tt=typeof o,nt=et.type;switch(nt){case"address":return isAddress(o,{strict:!1});case"bool":return tt==="boolean";case"function":return tt==="string";case"string":return tt==="string";default:return nt==="tuple"&&"components"in et?Object.values(et.components).every((rt,ot)=>isArgOfType(Object.values(o)[ot],rt)):/^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(nt)?tt==="number"||tt==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(nt)?tt==="string"||o instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(nt)?Array.isArray(o)&&o.every(rt=>isArgOfType(rt,{...et,type:nt.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(o,et,tt){for(const nt in o){const rt=o[nt],ot=et[nt];if(rt.type==="tuple"&&ot.type==="tuple"&&"components"in rt&&"components"in ot)return getAmbiguousTypes(rt.components,ot.components,tt[nt]);const it=[rt.type,ot.type];if(it.includes("address")&&it.includes("bytes20")?!0:it.includes("address")&&it.includes("string")?isAddress(tt[nt],{strict:!1}):it.includes("address")&&it.includes("bytes")?isAddress(tt[nt],{strict:!1}):!1)return it}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(o){const{abi:et,args:tt,functionName:nt,data:rt}=o;let ot=et[0];if(nt){const st=getAbiItem({abi:et,args:tt,name:nt});if(!st)throw new AbiFunctionNotFoundError(nt,{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,rt);if(it&&it.length>1)return it;if(it&&it.length===1)return it[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(o){const{abi:et,args:tt,functionName:nt}=o;let rt=et[0];if(nt){const ot=getAbiItem({abi:et,args:tt,name:nt});if(!ot)throw new AbiFunctionNotFoundError(nt,{docsPath});rt=ot}if(rt.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[rt],functionName:toFunctionSelector(formatAbiItem$1(rt))}}function encodeFunctionData(o){const{args:et}=o,{abi:tt,functionName:nt}=(()=>{var st;return o.abi.length===1&&((st=o.functionName)!=null&&st.startsWith("0x"))?o:prepareEncodeFunctionData(o)})(),rt=tt[0],ot=nt,it="inputs"in rt&&rt.inputs?encodeAbiParameters(rt.inputs,et??[]):void 0;return concatHex([ot,it??"0x"])}function getChainContractAddress({blockNumber:o,chain:et,contract:tt}){var rt;const nt=(rt=et==null?void 0:et.contracts)==null?void 0:rt[tt];if(!nt)throw new ChainDoesNotSupportContract({chain:et,contract:{name:tt}});if(o&&nt.blockCreated&&nt.blockCreated>o)throw new ChainDoesNotSupportContract({blockNumber:o,chain:et,contract:{name:tt,blockCreated:nt.blockCreated}});return nt.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(o){const{abi:et,data:tt}=o,nt=slice(tt,0,4);if(nt==="0x")throw new AbiDecodingZeroDataError;const ot=[...et||[],solidityError,solidityPanic].find(it=>it.type==="error"&&nt===toFunctionSelector(formatAbiItem$1(it)));if(!ot)throw new AbiErrorSignatureNotFoundError(nt,{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:o,args:et,includeFunctionName:tt=!0,includeName:nt=!1}){if("name"in o&&"inputs"in o&&o.inputs)return`${tt?o.name:""}(${o.inputs.map((rt,ot)=>`${nt&&rt.name?`${rt.name}: `:""}${typeof et[ot]=="object"?stringify$2(et[ot]):et[ot]}`).join(", ")})`}class CallExecutionError extends BaseError$3{constructor(et,{account:tt,docsPath:nt,chain:rt,data:ot,gas:it,gasPrice:st,maxFeePerGas:at,maxPriorityFeePerGas:ct,nonce:lt,to:dt,value:ht,stateOverride:pt}){var yt;const mt=tt?parseAccount(tt):void 0;let ft=prettyPrint({from:mt==null?void 0:mt.address,to:dt,value:typeof ht<"u"&&`${formatEther(ht)} ${((yt=rt==null?void 0:rt.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});pt&&(ft+=` -${prettyStateOverride(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],"Raw Call Arguments:",ft].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=et}}class ContractFunctionExecutionError extends BaseError$3{constructor(et,{abi:tt,args:nt,contractAddress:rt,docsPath:ot,functionName:it,sender:st}){const at=getAbiItem({abi:tt,args:nt,name:it}),ct=at?formatAbiItemWithArgs({abiItem:at,args:nt,includeFunctionName:!1,includeName:!1}):void 0,lt=at?formatAbiItem$1(at,{includeName:!0}):void 0,dt=prettyPrint({address:rt&&getContractAddress(rt),function:lt,args:ct&&ct!=="()"&&`${[...Array((it==null?void 0:it.length)??0).keys()].map(()=>" ").join("")}${ct}`,sender:st});super(et.shortMessage||`An unknown error occurred while executing the contract function "${it}".`,{cause:et,docsPath:ot,metaMessages:[...et.metaMessages?[...et.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=nt,this.cause=et,this.contractAddress=rt,this.functionName=it,this.sender=st}}class ContractFunctionRevertedError extends BaseError$3{constructor({abi:et,data:tt,functionName:nt,message:rt}){let ot,it,st,at;if(tt&&tt!=="0x")try{it=decodeErrorResult({abi:et,data:tt});const{abiItem:lt,errorName:dt,args:ht}=it;if(dt==="Error")at=ht[0];else if(dt==="Panic"){const[pt]=ht;at=panicReasons[pt]}else{const pt=lt?formatAbiItem$1(lt,{includeName:!0}):void 0,mt=lt&&ht?formatAbiItemWithArgs({abiItem:lt,args:ht,includeFunctionName:!1,includeName:!1}):void 0;st=[pt?`Error: ${pt}`:"",mt&&mt!=="()"?` ${[...Array((dt==null?void 0:dt.length)??0).keys()].map(()=>" ").join("")}${mt}`:""]}}catch(lt){ot=lt}else rt&&(at=rt);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 "${nt}" reverted with the following ${ct?"signature":"reason"}:`,at||ct].join(` -`):`The contract function "${nt}" 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:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - 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:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{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:et,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=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.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")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let pt=0;pt{for(let pt=0;ptschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:pt}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:pt}),dt):(ct({args:lt,resolve:ht,reject:pt}),setTimeout(ot,nt),dt)}}}async function call(o,et){var jt,Ot,Bt,zt;const{account:tt=o.account,batch:nt=!!((jt=o.batch)!=null&&jt.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,It=lt&&dt&&xt&&ct,Rt=kt||It,Pt=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):It?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Ot=o.chain)==null?void 0:Ot.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Lt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:Pt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Lt})&&!Ht)try{return await scheduleMulticall(o,{...Lt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Lt,Yt,Ht]:[Lt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Lt}=await import("./ccip-BfnZBgwN.js");return{offchainLookup:qt,offchainLookupSignature:Lt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var ft;const{batchSize:tt=1024,wait:nt=0}=typeof((ft=o.batch)==null?void 0:ft.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:pt,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:pt});return pt==="0x"?{data:void 0}:{data:pt}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const pt=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return pt==="0x"||trim$1(pt)==="0x00"?null:pt}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){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(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" 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(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.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(o);if(o.startsWith("http")&&!lt&&!dt){let pt=o;return et!=null&&et.arweave&&(pt=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:pt,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.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(!rt)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:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});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:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,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(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.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(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,pt=0;for(let gt=0;gt0&&pt>ct&&dt[ht].length>0&&(ht++,pt=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),ft=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var pt,mt;const ht=rt();if(ht.length!==0)for(const ft of ht)(mt=(pt=ft.fns)[lt])==null||mt.call(pt,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var pt;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let ft=at+1n;ftat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(pt=ht.onError)==null||pt.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let pt=!0,mt=()=>pt=!1;return(async()=>{try{const ft=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await ft.subscribe({params:["newHeads"],onData(gt){var vt;if(!pt)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,pt||mt()}catch(ft){rt==null||rt(ft)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(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:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const ft={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,ft),gt=await(rt==null?void 0:rt(yt,ft))??{...ft,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let pt;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))pt=await ht.json();else{pt=await ht.text();try{pt=JSON.parse(pt||"{}")}catch(mt){if(ht.ok)throw mt;pt={error:pt}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(pt.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return pt}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof pt>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof pt>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});pt=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),ft=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(pt)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const pt=27n+(et.v===27n?0n:1n);if(et.v!==pt)throw new InvalidLegacyVError({v:et.v});return pt})(),dt=trim$1(et.r),ht=trim$1(et.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(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.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 rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! 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(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let pt;for(;!(pt=ht(ct()));)at();return it(),pt}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.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(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_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(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),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,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.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(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! 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(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.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}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=pt,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=ft%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}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){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,pt=o.ZERO;ht>0;ht--)pt=pt.add(st[ht]),dt=dt.add(pt);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&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=et.subarray(nt,nt+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(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((ft,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(ft=>{const yt=ft.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(ft){const{a:yt,b:gt}=et,xt=tt.sqr(ft),vt=tt.mul(xt,ft);return tt.add(tt.add(vt,tt.mul(ft,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(ft){return inRange(ft,_1n$5,et.n)}function at(ft){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;if(yt&&typeof ft!="bigint"){if(isBytes$2(ft)&&(ft=bytesToHex$2(ft)),typeof ft!="string"||!yt.includes(ft.length))throw new Error("Invalid key");ft=ft.padStart(gt*2,"0")}let bt;try{bt=typeof ft=="bigint"?ft:bytesToNumberBE(ensureBytes$1("private key",ft,gt))}catch{throw new Error(`private key must be ${gt} bytes, hex or bigint, not ${typeof ft}`)}return xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(ft){if(!(ft instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((ft,yt)=>{const{px:gt,py:xt,pz:vt}=ft;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=ft.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(ft=>{if(ft.is0()){if(et.allowInfinityPoint&&!tt.is0(ft.py))return;throw new Error("bad point: ZERO")}const{x:yt,y:gt}=ft.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))throw new Error("bad point: equation left != right");if(!ft.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(yt,gt,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).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,nt,yt,gt)}_setWindowSize(yt){mt.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:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),It=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&It}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,It=tt.ZERO,Rt=tt.mul(vt,vt),Pt=tt.mul(bt,bt),jt=tt.mul(Et,Et),Ot=tt.mul(vt,bt);return Ot=tt.add(Ot,Ot),It=tt.mul(vt,Et),It=tt.add(It,It),wt=tt.mul(yt,It),kt=tt.mul(xt,jt),kt=tt.add(wt,kt),wt=tt.sub(Pt,kt),kt=tt.add(Pt,kt),kt=tt.mul(wt,kt),wt=tt.mul(Ot,wt),It=tt.mul(xt,It),jt=tt.mul(yt,jt),Ot=tt.sub(Rt,jt),Ot=tt.mul(yt,Ot),Ot=tt.add(Ot,It),It=tt.add(Rt,Rt),Rt=tt.add(It,Rt),Rt=tt.add(Rt,jt),Rt=tt.mul(Rt,Ot),kt=tt.add(kt,Rt),jt=tt.mul(bt,Et),jt=tt.add(jt,jt),Rt=tt.mul(jt,Ot),wt=tt.sub(wt,Rt),It=tt.mul(jt,Pt),It=tt.add(It,It),It=tt.add(It,It),new ht(wt,kt,It)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,It=tt.ZERO,Rt=tt.ZERO;const Pt=et.a,jt=tt.mul(et.b,_3n$2);let Ot=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Ot,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Ot,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul(Pt,Yt),kt=tt.mul(jt,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),It=tt.mul(kt,Rt),Bt=tt.add(Ot,Ot),Bt=tt.add(Bt,Ot),zt=tt.mul(Pt,zt),Yt=tt.mul(jt,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Ot,zt),zt=tt.mul(Pt,zt),Yt=tt.add(Yt,zt),Ot=tt.mul(Bt,Yt),It=tt.add(It,Ot),Ot=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Ot),Ot=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Ot),new ht(kt,It,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,It=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(It=It.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(It=It.negate()),It=new ht(tt.mul(It.px,xt.beta),It.py,It.pz),kt.add(It)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:It}=gt.splitScalar(yt);let{p:Rt,f:Pt}=this.wNAF(wt),{p:jt,f:Ot}=this.wNAF(It);Rt=mt.constTimeNegate(Et,Rt),jt=mt.constTimeNegate(kt,jt),jt=new ht(tt.mul(jt.px,gt.beta),jt.py,jt.pz),vt=Rt.add(jt),bt=Pt.add(Ot)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;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}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const pt=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(pt/2):pt);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Lt;try{Lt=tt.sqrt(qt)}catch(Nt){const Gt=Nt instanceof Error?": "+Nt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Lt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Lt=tt.neg(Lt)),{x:Ut,y:Lt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function pt(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return pt(zt)?it(-zt):zt}const ft=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(ft(Ft,0,Yt),ft(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Lt=Ut===2||Ut===3?Yt+et.n:Yt;if(Lt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Lt)),Nt=st(Lt),Gt=it(-qt*Nt),nn=it(Ht*Nt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return pt(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(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function It(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=Pt){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Lt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Lt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Nt=ct(Ft),Gt=[It(Nt),It(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),_t=at.BASE.multiply(Jt).toAffine(),Dt=it(_t.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Nt));if(Vt===_0n$3)return;let en=(_t.x===Dt?0:2)|Number(_t.y&_1n$5),an=Vt;return qt&&pt(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const Pt={lowS:et.lowS,prehash:!1},jt={lowS:et.lowS,prehash:!1};function Ot(zt,Ft,Yt=Pt){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=jt){var _t;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Lt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Lt&&(Ft=et.hash(Ft));const{r:Nt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Nt*Wt),Jt=(_t=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:_t.toAffine();return Jt?it(Jt.x)===Nt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Ot,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),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=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,pt=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(pt,rt,et)*pt%et,ft=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(ft,st,et)*ft%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*ft%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}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:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.4",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class As extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,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 nt=tt.cause instanceof As?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof As&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` -`),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}walk(et){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,et)}};_BaseError_instances=new WeakSet,_BaseError_walk=function o(et,tt){return tt!=null&&tt(et)?et:et.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",o).call(this,et.cause,tt):et};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:et,connector:tt}){super(`Account "${et}" 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:et,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${et}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${et}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:et}){super(`Connector "${et.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(o,et){var nt;let tt;if(typeof et.connector=="function"?tt=o._internal.connectors.setup(et.connector):tt=et.connector,tt.uid===o.state.current)throw new ConnectorAlreadyConnectedError;try{o.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const rt=await tt.connect({chainId:et.chainId}),ot=rt.accounts;return tt.emitter.off("connect",o._internal.events.connect),tt.emitter.on("change",o._internal.events.change),tt.emitter.on("disconnect",o._internal.events.disconnect),await((nt=o.storage)==null?void 0:nt.setItem("recentConnectorId",tt.id)),o.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:rt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:rt.chainId}}catch(rt){throw o.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),rt}}const size$1=256;let index$3=size$1,buffer$1;function uid$1(o=11){if(!buffer$1||index$3+o>size$1*2){buffer$1="",index$3=0;for(let et=0;et{const xt=gt(yt);for(const bt in mt)delete xt[bt];const vt={...yt,...xt};return Object.assign(vt,{extend:ft(vt)})}}return Object.assign(mt,{extend:ft(mt)})}function createTransport({key:o,name:et,request:tt,retryCount:nt=3,retryDelay:rt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:o,name:et,request:tt,retryCount:nt,retryDelay:rt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:nt,retryDelay:rt,uid:at}),value:st}}function custom(o,et={}){const{key:tt="custom",name:nt="Custom Provider",retryDelay:rt}=et;return({retryCount:ot})=>createTransport({key:tt,name:nt,request:o.request.bind(o),retryCount:et.retryCount??ot,retryDelay:rt,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(o,et={}){const{batch:tt,fetchOptions:nt,key:rt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=et;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:pt=0}=typeof tt=="object"?tt:{},mt=et.retryCount??lt,ft=dt??et.timeout??1e4,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{fetchOptions:nt,onRequest:it,onResponse:st,timeout:ft});return createTransport({key:rt,name:ot,async request({method:xt,params:vt}){const bt={method:xt,params:vt},{schedule:Et}=createBatchScheduler({id:yt,wait:pt,shouldSplitBatch(Rt){return Rt.length>ht},fn:Rt=>gt.request({body:Rt}),sort:(Rt,Pt)=>Rt.id-Pt.id}),wt=async Rt=>tt?Et(Rt):[await gt.request({body:Rt})],[{error:kt,result:It}]=await wt(bt);if(kt)throw new RpcRequestError({body:bt,error:kt,url:yt});return It},retryCount:mt,retryDelay:at,timeout:ft,type:"http"},{fetchOptions:nt,url:yt})}}async function getConnectorClient(o,et={}){let tt;if(et.connector){const{connector:ct}=et;if(o.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=o.state.connections.get(o.state.current);if(!tt)throw new ConnectorNotConnectedError;const nt=et.chainId??tt.chainId,rt=await tt.connector.getChainId();if(rt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:rt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:nt});const it=parseAccount(et.account??tt.accounts[0]);if(it.address=getAddress(it.address),et.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=o.chains.find(ct=>ct.id===nt),at=await tt.connector.getProvider({chainId:nt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom(at)({...ct,retryCount:0})})}async function disconnect(o,et={}){var rt,ot;let tt;if(et.connector)tt=et.connector;else{const{connections:it,current:st}=o.state,at=it.get(st);tt=at==null?void 0:at.connector}const nt=o.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",o._internal.events.change),tt.emitter.off("disconnect",o._internal.events.disconnect),tt.emitter.on("connect",o._internal.events.connect),nt.delete(tt.uid)),o.setState(it=>{if(nt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=nt.values().next().value;return{...it,connections:new Map(nt),current:st.connector.uid}});{const it=o.state.current;if(!it)return;const st=(rt=o.state.connections.get(it))==null?void 0:rt.connector;if(!st)return;await((ot=o.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(o){return typeof o=="number"?o:o==="wei"?0:Math.abs(weiUnits[o])}function getAccount(o){const et=o.state.current,tt=o.state.connections.get(et),nt=tt==null?void 0:tt.accounts,rt=nt==null?void 0:nt[0],ot=o.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=o.state.status;switch(it){case"connected":return{address:rt,addresses:nt,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:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!rt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:rt,addresses:nt,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(o,et){const{allowFailure:tt=!0,chainId:nt,contracts:rt,...ot}=et,it=o.getClient({chainId:nt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:rt,...ot})}function readContract(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,readContract$1,"readContract")(nt)}async function readContracts(o,et){var st;const{allowFailure:tt=!0,blockNumber:nt,blockTag:rt,...ot}=et,it=et.contracts;try{const at={};for(const[ht,pt]of it.entries()){const mt=pt.chainId??o.state.chainId;at[mt]||(at[mt]=[]),(st=at[mt])==null||st.push({contract:pt,index:ht})}const ct=()=>Object.entries(at).map(([ht,pt])=>multicall(o,{...ot,allowFailure:tt,blockNumber:nt,blockTag:rt,chainId:Number.parseInt(ht),contracts:pt.map(({contract:mt})=>mt)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:pt})=>pt));return lt.reduce((ht,pt,mt)=>(ht&&(ht[dt[mt]]=pt),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(o,{...lt,blockNumber:nt,blockTag:rt}));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(o,et){const{address:tt,blockNumber:nt,blockTag:rt,chainId:ot,token:it,unit:st="ether"}=et;if(it)try{return await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht.name==="ContractFunctionExecutionError"){const pt=await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),mt=hexToString(trim$1(pt.symbol,{dir:"right"}));return{...pt,symbol:mt}}throw ht}const at=o.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(nt?{address:tt,blockNumber:nt}:{address:tt,blockTag:rt}),dt=o.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(o,et){const{balanceAddress:tt,chainId:nt,symbolType:rt,tokenAddress:ot,unit:it}=et,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:rt}]}],address:ot},[at,ct,lt]=await readContracts(o,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:nt},{...st,functionName:"decimals",chainId:nt},{...st,functionName:"symbol",chainId:nt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(o,et={}){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getBlockNumber$1,"getBlockNumber")(nt)}function getChainId(o){return o.state.chainId}function deepEqual(o,et){if(o===et)return!0;if(o&&et&&typeof o=="object"&&typeof et=="object"){if(o.constructor!==et.constructor)return!1;let tt,nt;if(Array.isArray(o)&&Array.isArray(et)){if(tt=o.length,tt!==et.length)return!1;for(nt=tt;nt--!==0;)if(!deepEqual(o[nt],et[nt]))return!1;return!0}if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===et.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===et.toString();const rt=Object.keys(o);if(tt=rt.length,tt!==Object.keys(et).length)return!1;for(nt=tt;nt--!==0;)if(!Object.prototype.hasOwnProperty.call(et,rt[nt]))return!1;for(nt=tt;nt--!==0;){const ot=rt[nt];if(ot&&!deepEqual(o[ot],et[ot]))return!1}return!0}return o!==o&&et!==et}let previousChains=[];function getChains(o){const et=o.chains;return deepEqual(previousChains,et)?previousChains:(previousChains=et,et)}let previousConnections=[];function getConnections(o){const et=[...o.state.connections.values()];return o.state.status==="reconnecting"||deepEqual(previousConnections,et)?previousConnections:(previousConnections=et,et)}let previousConnectors=[];function getConnectors(o){const et=o.connectors;return deepEqual(previousConnectors,et)?previousConnectors:(previousConnectors=et,et)}function getEnsAddress(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAddress$1,"getEnsAddress")(nt)}function getEnsAvatar(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAvatar$1,"getEnsAvatar")(nt)}function getEnsName(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsName$1,"getEnsName")(nt)}let isReconnecting=!1;async function reconnect(o,et={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,o.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=et.connectors)!=null&&ct.length)for(const dt of et.connectors){let ht;typeof dt=="function"?ht=o._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...o.connectors);let nt;try{nt=await((lt=o.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const rt={};for(const[,dt]of o.state.connections)rt[dt.connector.id]=1;nt&&(rt[nt]=0);const ot=Object.keys(rt).length>0?[...tt].sort((dt,ht)=>(rt[dt.id]??10)-(rt[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(ft=>ft===ht)||!await dt.isAuthorized())continue;const mt=await dt.connect({isReconnecting:!0}).catch(()=>null);mt&&(dt.emitter.off("connect",o._internal.events.connect),dt.emitter.on("change",o._internal.events.change),dt.emitter.on("disconnect",o._internal.events.disconnect),o.setState(ft=>{const yt=new Map(it?ft.connections:new Map).set(dt.uid,{accounts:mt.accounts,chainId:mt.chainId,connector:dt});return{...ft,current:it?ft.current:dt.uid,connections:yt}}),st.push({accounts:mt.accounts,chainId:mt.chainId,connector:dt}),at.push(ht),it=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(it?o.setState(dt=>({...dt,status:"connected"})):o.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(o,et){const{account:tt,connector:nt,...rt}=et;let ot;return typeof tt=="object"&&tt.type==="local"?ot=o.getClient():ot=await getConnectorClient(o,{account:tt,connector:nt}),getAction(ot,signMessage$1,"signMessage")({...rt,...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:et}){super(`"${et.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(o,et){var it;const{addEthereumChainParameter:tt,chainId:nt}=et,rt=o.state.connections.get(((it=et.connector)==null?void 0:it.uid)??o.state.current);if(rt){const st=rt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:nt})}const ot=o.chains.find(st=>st.id===nt);if(!ot)throw new ChainNotConfiguredError;return o.setState(st=>({...st,chainId:nt})),ot}function watchAccount(o,et){const{onChange:tt}=et;return o.subscribe(()=>getAccount(o),tt,{equalityFn(nt,rt){const{connector:ot,...it}=nt,{connector:st,...at}=rt;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(o,et){const{syncConnectedChain:tt=o._internal.syncConnectedChain,...nt}=et;let rt;const ot=at=>{rt&&rt();const ct=o.getClient({chainId:at});return rt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(nt),rt},it=ot(et.chainId);let st;return tt&&!et.chainId&&(st=o.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(o,et){const{onChange:tt}=et;return o.subscribe(nt=>nt.chainId,tt)}function watchConnections(o,et){const{onChange:tt}=et;return o.subscribe(()=>getConnections(o),tt,{equalityFn:deepEqual})}function watchConnectors(o,et){const{onChange:tt}=et;return o._internal.connectors.subscribe((nt,rt)=>{tt(Object.values(nt),rt)})}function createConnector(o){return o}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(o={}){const{shimDisconnect:et=!0,unstable_shimAsyncInject:tt}=o;function nt(){const at=o.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 rt,ot,it,st;return at=>({get icon(){return nt().icon},get id(){return nt().id},get name(){return nt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&o.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)))},async connect({chainId:ct,isReconnecting:lt}={}){var pt,mt,ft,yt,gt,xt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(et)try{ht=(yt=(ft=(mt=(pt=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:pt.caveats)==null?void 0:mt[0])==null?void 0:ft.value)==null?void 0:yt.map(bt=>getAddress(bt)),ht.length>0&&(ht=await this.getAccounts())}catch(vt){const bt=vt;if(bt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(bt);if(bt.code===ResourceUnavailableRpcError.code)throw bt}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),rt||(rt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let vt=await this.getChainId();if(ct&&vt!==ct){const bt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:vt}});vt=(bt==null?void 0:bt.id)??vt}return et&&await((gt=at.storage)==null?void 0:gt.removeItem(`${this.id}.disconnected`)),o.target||await((xt=at.storage)==null?void 0:xt.setItem("injected.connected",!0)),{accounts:ht,chainId:vt}}catch(vt){const bt=vt;throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):bt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(bt):bt}},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{}et&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),o.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=nt();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(et&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!o.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 mt=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",mt),!!await this.getProvider()),ft=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(gt=>window.addEventListener("ethereum#initialized",()=>gt(mt()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(mt()),ft))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,ft,yt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(xt=>xt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);const pt=new Promise(xt=>{const vt=bt=>{"chainId"in bt&&bt.chainId===lt&&(at.emitter.off("change",vt),xt())};at.emitter.on("change",vt)});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})}),pt]),ht}catch(xt){const vt=xt;if(vt.code===4902||((ft=(mt=vt==null?void 0:vt.data)==null?void 0:mt.originalError)==null?void 0:ft.code)===4902)try{const{default:bt,...Et}=ht.blockExplorers??{};let wt;ct!=null&&ct.blockExplorerUrls?wt=ct.blockExplorerUrls:bt&&(wt=[bt.url,...Object.values(Et).map(Rt=>Rt.url)]);let kt;(yt=ct==null?void 0:ct.rpcUrls)!=null&&yt.length?kt=ct.rpcUrls:kt=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const It={blockExplorerUrls:wt,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:kt};return await Promise.all([dt.request({method:"wallet_addEthereumChain",params:[It]}).then(async()=>{if(await this.getChainId()===lt)at.emitter.emit("change",{chainId:lt});else throw new UserRejectedRequestError(new Error("User rejected switch after adding network."))}),pt]),ht}catch(bt){throw new UserRejectedRequestError(bt)}throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):new SwitchChainError(vt)}},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}),et&&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),rt||(rt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",rt)),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))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o!=null&&o.coinbaseWalletExtension?o.coinbaseWalletExtension:findProvider(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return findProvider(o,et=>{if(!et.isMetaMask||et.isBraveWallet&&!et._events&&!et._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const nt of tt)if(et[nt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){var et,tt;return(et=o==null?void 0:o.phantom)!=null&&et.ethereum?(tt=o.phantom)==null?void 0:tt.ethereum:findProvider(o,"isPhantom")}}};function findProvider(o,et){function tt(rt){return typeof et=="function"?et(rt):typeof et=="string"?rt[et]:!0}const nt=o.ethereum;if(nt!=null&&nt.providers)return nt.providers.find(rt=>tt(rt));if(nt&&tt(nt))return nt}function requestProviders(o){if(typeof window>"u")return;const et=tt=>o(tt.detail);return window.addEventListener("eip6963:announceProvider",et),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",et)}function createStore$1(){const o=new Set;let et=[];const tt=()=>requestProviders(rt=>{et.some(({info:ot})=>ot.uuid===rt.info.uuid)||(et=[...et,rt],o.forEach(ot=>ot(et,{added:[rt]})))});let nt=tt();return{_listeners(){return o},clear(){o.forEach(rt=>rt([],{removed:[...et]})),et=[]},destroy(){this.clear(),o.clear(),nt==null||nt()},findProvider({rdns:rt}){return et.find(ot=>ot.info.rdns===rt)},getProviders(){return et},reset(){this.clear(),nt==null||nt(),nt=tt()},subscribe(rt,{emitImmediately:ot}={}){return o.add(rt),ot&&rt(et,{added:et}),()=>o.delete(rt)}}}const subscribeWithSelectorImpl=o=>(et,tt,nt)=>{const rt=nt.subscribe;return nt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(nt.getState());ct=ht=>{const pt=it(ht);if(!lt(dt,pt)){const mt=dt;st(dt=pt,mt)}},at!=null&&at.fireImmediately&&st(dt,dt)}return rt(ct)},o(et,tt,nt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(o,et){let tt;try{tt=o()}catch{return}return{getItem:rt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(rt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(rt,ot)=>tt.setItem(rt,JSON.stringify(ot,void 0)),removeItem:rt=>tt.removeItem(rt)}}const toThenable=o=>et=>{try{const tt=o(et);return tt instanceof Promise?tt:{then(nt){return toThenable(nt)(tt)},catch(nt){return this}}}catch(tt){return{then(nt){return this},catch(nt){return toThenable(nt)(tt)}}}},persistImpl=(o,et)=>(tt,nt,rt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:ft=>ft,version:0,merge:(ft,yt)=>({...yt,...ft}),...et},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return o((...ft)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...ft)},nt,rt);const lt=()=>{const ft=ot.partialize({...nt()});return ct.setItem(ot.name,{state:ft,version:ot.version})},dt=rt.setState;rt.setState=(ft,yt)=>{dt(ft,yt),lt()};const ht=o((...ft)=>{tt(...ft),lt()},nt,rt);rt.getInitialState=()=>ht;let pt;const mt=()=>{var ft,yt;if(!ct)return;it=!1,st.forEach(xt=>{var vt;return xt((vt=nt())!=null?vt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.call(ot,(ft=nt())!=null?ft:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(xt=>{if(xt)if(typeof xt.version=="number"&&xt.version!==ot.version){if(ot.migrate)return[!0,ot.migrate(xt.state,xt.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,xt.state];return[!1,void 0]}).then(xt=>{var vt;const[bt,Et]=xt;if(pt=ot.merge(Et,(vt=nt())!=null?vt:ht),tt(pt,!0),bt)return lt()}).then(()=>{gt==null||gt(pt,void 0),pt=nt(),it=!0,at.forEach(xt=>xt(pt))}).catch(xt=>{gt==null||gt(void 0,xt)})};return rt.persist={setOptions:ft=>{ot={...ot,...ft},ft.storage&&(ct=ft.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>mt(),hasHydrated:()=>it,onHydrate:ft=>(st.add(ft),()=>{st.delete(ft)}),onFinishHydration:ft=>(at.add(ft),()=>{at.delete(ft)})},ot.skipHydration||mt(),pt||ht},persist=persistImpl,createStoreImpl=o=>{let et;const tt=new Set,nt=(ct,lt)=>{const dt=typeof ct=="function"?ct(et):ct;if(!Object.is(dt,et)){const ht=et;et=lt??(typeof dt!="object"||dt===null)?dt:Object.assign({},et,dt),tt.forEach(pt=>pt(et,ht))}},rt=()=>et,st={setState:nt,getState:rt,getInitialState:()=>at,subscribe:ct=>(tt.add(ct),()=>tt.delete(ct))},at=et=o(nt,rt,st);return st},createStore=o=>o?createStoreImpl(o):createStoreImpl;var eventemitter3={exports:{}};(function(o){var et=Object.prototype.hasOwnProperty,tt="~";function nt(){}Object.create&&(nt.prototype=Object.create(null),new nt().__proto__||(tt=!1));function rt(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 pt=new rt(lt,dt||at,ht),mt=tt?tt+ct:ct;return at._events[mt]?at._events[mt].fn?at._events[mt]=[at._events[mt],pt]:at._events[mt].push(pt):(at._events[mt]=pt,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new nt:delete at._events[ct]}function st(){this._events=new nt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)et.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,pt=dt.length,mt=new Array(pt);ht{let rt=nt;return(rt==null?void 0:rt.__type)==="bigint"&&(rt=BigInt(rt.value)),(rt==null?void 0:rt.__type)==="Map"&&(rt=new Map(rt.value)),(et==null?void 0:et(tt,rt))??rt})}function getReferenceKey(o,et){return o.slice(0,et).join(".")||"."}function getCutoff(o,et){const{length:tt}=o;for(let nt=0;nt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(et==null?void 0:et(rt,it))??it},nt),tt??void 0)}function createStorage(o){const{deserialize:et=deserialize$1,key:tt="wagmi",serialize:nt=serialize$1,storage:rt=noopStorage}=o;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...rt,key:tt,async getItem(it,st){const at=rt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?et(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(rt.removeItem(at)):await ot(rt.setItem(at,nt(st)))},async removeItem(it){await ot(rt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer;function uid(o=11){if(!buffer||index$2+o>size*2){buffer="",index$2=0;for(let et=0;etot.chains),at=createStore(()=>{const Et=[],wt=new Set;for(const kt of ot.connectors??[]){const It=ct(kt);Et.push(It),!rt&&It.rdns&&wt.add(It.rdns)}if(!rt&&it){const kt=it.getProviders();for(const It of kt)wt.has(It.info.rdns)||Et.push(ct(lt(It)))}return Et});function ct(Et){var It;const wt=createEmitter(uid()),kt={...Et({emitter:wt,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:wt,uid:wt.uid};return wt.on("connect",vt),(It=kt.setup)==null||It.call(kt),kt}function lt(Et){const{info:wt}=Et,kt=Et.provider;return injected({target:{...wt,id:wt.rdns,provider:kt}})}const dt=new Map;function ht(Et={}){const wt=Et.chainId??yt.getState().chainId,kt=st.getState().find(Rt=>Rt.id===wt);if(Et.chainId&&!kt)throw new ChainNotConfiguredError;{const Rt=dt.get(yt.getState().chainId);if(Rt&&!kt)return Rt;if(!kt)throw new ChainNotConfiguredError}{const Rt=dt.get(wt);if(Rt)return Rt}let It;if(ot.client)It=ot.client({chain:kt});else{const Rt=kt.id,Pt=st.getState().map(Bt=>Bt.id),jt={},Ot=Object.entries(ot);for(const[Bt,zt]of Ot)if(!(Bt==="chains"||Bt==="client"||Bt==="connectors"||Bt==="transports"))if(typeof zt=="object")if(Rt in zt)jt[Bt]=zt[Rt];else{if(Pt.some(Yt=>Yt in zt))continue;jt[Bt]=zt}else jt[Bt]=zt;It=createClient({...jt,chain:kt,batch:jt.batch??{multicall:!0},transport:Bt=>ot.transports[Rt]({...Bt,connectors:at})})}return dt.set(wt,It),It}function pt(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let mt;const ft="0.0.0-canary-";version$6.startsWith(ft)?mt=Number.parseInt(version$6.replace(ft,"")):mt=Number.parseInt(version$6.split(".")[0]??"0");const yt=createStore(subscribeWithSelector(tt?persist(pt,{migrate(Et,wt){if(wt===mt)return Et;const kt=pt(),It=gt(Et,kt.chainId);return{...kt,chainId:It}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([wt,kt])=>{const{id:It,name:Rt,type:Pt,uid:jt}=kt.connector;return[wt,{...kt,connector:{id:It,name:Rt,type:Pt,uid:jt}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,wt){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const kt=gt(Et,wt.chainId);return{...wt,...Et,chainId:kt}},skipHydration:rt,storage:tt,version:mt}):pt));yt.setState(pt());function gt(Et,wt){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(kt=>kt.id===Et.chainId)?Et.chainId:wt}nt&&yt.subscribe(({connections:Et,current:wt})=>{var kt;return wt?(kt=Et.get(wt))==null?void 0:kt.chainId:void 0},Et=>{if(st.getState().some(kt=>kt.id===Et))return yt.setState(kt=>({...kt,chainId:Et??kt.chainId}))}),it==null||it.subscribe(Et=>{const wt=new Set,kt=new Set;for(const Rt of at.getState())wt.add(Rt.id),Rt.rdns&&kt.add(Rt.rdns);const It=[];for(const Rt of Et){if(kt.has(Rt.info.rdns))continue;const Pt=ct(lt(Rt));wt.has(Pt.id)||It.push(Pt)}tt&&!yt.persist.hasHydrated()||at.setState(Rt=>[...Rt,...It],!0)});function xt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);return kt?{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts??kt.accounts,chainId:Et.chainId??kt.chainId,connector:kt.connector})}:wt})}function vt(Et){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.setState(wt=>{const kt=at.getState().find(It=>It.uid===Et.uid);return kt?(kt.emitter.listenerCount("connect")&&kt.emitter.off("connect",xt),kt.emitter.listenerCount("change")||kt.emitter.on("change",xt),kt.emitter.listenerCount("disconnect")||kt.emitter.on("disconnect",bt),{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:kt}),current:Et.uid,status:"connected"}):wt})}function bt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);if(kt){const Rt=kt.connector;Rt.emitter.listenerCount("change")&&kt.connector.emitter.off("change",xt),Rt.emitter.listenerCount("disconnect")&&kt.connector.emitter.off("disconnect",bt),Rt.emitter.listenerCount("connect")||kt.connector.emitter.on("connect",vt)}if(wt.connections.delete(Et.uid),wt.connections.size===0)return{...wt,connections:new Map,current:null,status:"disconnected"};const It=wt.connections.values().next().value;return{...wt,connections:new Map(wt.connections),current:It.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 wt;typeof Et=="function"?wt=Et(yt.getState()):wt=Et;const kt=pt();typeof wt!="object"&&(wt=kt),Object.keys(kt).some(Rt=>!(Rt in wt))&&(wt=kt),yt.setState(wt,!0)},subscribe(Et,wt,kt){return yt.subscribe(Et,wt,kt?{...kt,fireImmediately:kt.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,ssr:!!rt,syncConnectedChain:nt,transports:ot.transports,chains:{setState(Et){const wt=typeof Et=="function"?Et(st.getState()):Et;if(wt.length!==0)return st.setState(wt,!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:xt,connect:vt,disconnect:bt}}}}function hydrate(o,et){const{initialState:tt,reconnectOnMount:nt}=et;return tt&&!o._internal.store.persist.hasHydrated()&&o.setState({...tt,chainId:o.chains.some(rt=>rt.id===tt.chainId)?tt.chainId:o.chains[0].id,connections:nt?tt.connections:new Map,status:nt?"reconnecting":"disconnected"}),{async onMount(){o._internal.ssr&&(await o._internal.store.persist.rehydrate(),o._internal.mipd&&o._internal.connectors.setState(rt=>{var at;const ot=new Set;for(const ct of rt??[])ct.rdns&&ot.add(ct.rdns);const it=[],st=((at=o._internal.mipd)==null?void 0:at.getProviders())??[];for(const ct of st){if(ot.has(ct.info.rdns))continue;const lt=o._internal.connectors.providerDetailToConnector(ct),dt=o._internal.connectors.setup(lt);it.push(dt)}return[...rt,...it]})),nt?reconnect(o):o.storage&&o.setState(rt=>({...rt,connections:new Map}))}}}function extractRpcUrls(o){var ot,it,st;const{chain:et}=o,tt=et.rpcUrls.default.http[0];if(!o.transports)return[tt];const nt=(it=(ot=o.transports)==null?void 0:ot[et.id])==null?void 0:it.call(ot,{chain:et});return(((st=nt==null?void 0:nt.value)==null?void 0:st.transports)||[nt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(o){const{children:et,config:tt,initialState:nt,reconnectOnMount:rt=!0}=o,{onMount:ot}=hydrate(tt,{initialState:nt,reconnectOnMount:rt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),et}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(o){const{children:et,config:tt}=o,nt={value:tt};return reactExports.createElement(Hydrate,o,reactExports.createElement(WagmiContext.Provider,nt,et))}const version$5="2.12.29",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(o={}){const et=o.config??reactExports.useContext(WagmiContext);if(!et)throw new WagmiProviderNotFoundError;return et}function watchChains(o,et){const{onChange:tt}=et;return o._internal.chains.subscribe((nt,rt)=>{tt(nt,rt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** +`).slice(0,-1)}function serializeStateMapping(o){if(!(!o||o.length===0))return o.reduce((et,{slot:tt,value:nt})=>{if(tt.length!==66)throw new InvalidBytesLengthError({size:tt.length,targetSize:66,type:"hex"});if(nt.length!==66)throw new InvalidBytesLengthError({size:nt.length,targetSize:66,type:"hex"});return et[tt]=nt,et},{})}function serializeAccountStateOverride(o){const{balance:et,nonce:tt,state:nt,stateDiff:rt,code:ot}=o,it={};if(ot!==void 0&&(it.code=ot),et!==void 0&&(it.balance=numberToHex(et)),tt!==void 0&&(it.nonce=numberToHex(tt)),nt!==void 0&&(it.state=serializeStateMapping(nt)),rt!==void 0){if(it.state)throw new StateAssignmentConflictError;it.stateDiff=serializeStateMapping(rt)}return it}function serializeStateOverride(o){if(!o)return;const et={};for(const{address:tt,...nt}of o){if(!isAddress(tt,{strict:!1}))throw new InvalidAddressError({address:tt});if(et[tt])throw new AccountStateConflictError({address:tt});et[tt]=serializeAccountStateOverride(nt)}return et}async function getBalance$1(o,{address:et,blockNumber:tt,blockTag:nt="latest"}){const rt=tt?numberToHex(tt):void 0,ot=await o.request({method:"eth_getBalance",params:[et,rt||nt]});return BigInt(ot)}function blobsToCommitments(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(ot=>hexToBytes$3(ot)):o.blobs,rt=[];for(const ot of nt)rt.push(Uint8Array.from(et.blobToKzgCommitment(ot)));return tt==="bytes"?rt:rt.map(ot=>bytesToHex$4(ot))}function blobsToProofs(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(it=>hexToBytes$3(it)):o.blobs,rt=typeof o.commitments[0]=="string"?o.commitments.map(it=>hexToBytes$3(it)):o.commitments,ot=[];for(let it=0;itbytesToHex$4(it))}function setBigUint64$1(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=nt?4:0,ct=nt?0:4;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}const Chi=(o,et,tt)=>o&et^~o&tt,Maj=(o,et,tt)=>o&et^o&tt^et&tt;class HashMD extends Hash{constructor(et,tt,nt,rt){super(),this.blockLen=et,this.outputLen=tt,this.padOffset=nt,this.isLE=rt,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(et),this.view=createView$1(this.buffer)}update(et){exists$1(this);const{view:tt,buffer:nt,blockLen:rt}=this;et=toBytes$2(et);const ot=et.length;for(let it=0;itrt-it&&(this.process(nt,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(ft,17)^rotr(ft,19)^ft>>>10;SHA256_W[dt]=pt+SHA256_W[dt-7]+mt+SHA256_W[dt-16]|0}let{A:nt,B:rt,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),ft=lt+ht+Chi(st,at,ct)+SHA256_K[dt]+SHA256_W[dt]|0,pt=(rotr(nt,2)^rotr(nt,13)^rotr(nt,22))+Maj(nt,rt,ot)|0;lt=ct,ct=at,at=st,st=it+ft|0,it=ot,ot=rt,rt=nt,nt=ft+pt|0}nt=nt+this.A|0,rt=rt+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(nt,rt,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$2=wrapConstructor(()=>new SHA256);function sha256$1(o,et){return sha256$2(isHex(o,{strict:!1})?toBytes$3(o):o)}function commitmentToVersionedHash(o){const{commitment:et,version:tt=1}=o,nt=o.to??(typeof et=="string"?"hex":"bytes"),rt=sha256$1(et);return rt.set([tt],0),nt==="bytes"?rt:bytesToHex$4(rt)}function commitmentsToVersionedHashes(o){const{commitments:et,version:tt}=o,nt=o.to??(typeof et[0]=="string"?"hex":"bytes"),rt=[];for(const ot of et)rt.push(commitmentToVersionedHash({commitment:ot,to:nt,version:tt}));return rt}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:et,size:tt}){super("Blob size is too large.",{metaMessages:[`Max: ${et} 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:et,size:tt}){super(`Versioned hash "${et}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${tt}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError$3{constructor({hash:et,version:tt}){super(`Versioned hash "${et}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${tt}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(o){const et=o.to??(typeof o.data=="string"?"hex":"bytes"),tt=typeof o.data=="string"?hexToBytes$3(o.data):o.data,nt=size$2(tt);if(!nt)throw new EmptyBlobError;if(nt>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:nt});const rt=[];let ot=!0,it=0;for(;ot;){const st=createCursor(new Uint8Array(bytesPerBlob));let at=0;for(;atst.bytes):rt.map(st=>bytesToHex$4(st.bytes))}function toBlobSidecars(o){const{data:et,kzg:tt,to:nt}=o,rt=o.blobs??toBlobs({data:et,to:nt}),ot=o.commitments??blobsToCommitments({blobs:rt,kzg:tt,to:nt}),it=o.proofs??blobsToProofs({blobs:rt,commitments:ot,kzg:tt,to:nt}),st=[];for(let at=0;at1||tt[0]>1)throw new InvalidBytesBooleanError(tt);return!!tt[0]}function bytesToNumber$1(o,et={}){typeof et.size<"u"&&assertSize(o,{size:et.size});const tt=bytesToHex$4(o,et);return hexToNumber$2(tt,et)}function bytesToString(o,et={}){let tt=o;return typeof et.size<"u"&&(assertSize(tt,{size:et.size}),tt=trim$1(tt,{dir:"right"})),new TextDecoder().decode(tt)}function decodeAbiParameters(o,et){const tt=typeof et=="string"?hexToBytes$3(et):et,nt=createCursor(tt);if(size$2(tt)===0&&o.length>0)throw new AbiDecodingZeroDataError;if(size$2(et)&&size$2(et)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof et=="string"?et:bytesToHex$4(et),params:o,size:size$2(et)});let rt=0;const ot=[];for(let it=0;it48?bytesToBigInt(rt,{signed:tt}):bytesToNumber$1(rt,{signed:tt}),32]}function decodeTuple(o,et,{staticPosition:tt}){const nt=et.components.length===0||et.components.some(({name:it})=>!it),rt=nt?[]:{};let ot=0;if(hasDynamicChild(et)){const it=bytesToNumber$1(o.readBytes(sizeOfOffset)),st=tt+it;for(let at=0;atkeccak256$1(toBytes$3(o));function hashSignature(o){return hash(o)}const version$7="1.0.6";let BaseError$2=class As extends Error{constructor(et,tt={}){var it;const nt=tt.cause instanceof As?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,rt=tt.cause instanceof As&&tt.cause.docsPath||tt.docsPath,ot=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: https://abitype.dev${rt}`]:[],...nt?[`Details: ${nt}`]:[],`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=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}};function execTyped(o,et){const tt=o.exec(et);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(o){let et=o.type;if(tupleRegex.test(o.type)&&"components"in o){et="(";const tt=o.components.length;for(let rt=0;rt[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(o){return errorSignatureRegex.test(o)}function execErrorSignature(o){return execTyped(errorSignatureRegex,o)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(o){return eventSignatureRegex.test(o)}function execEventSignature(o){return execTyped(eventSignatureRegex,o)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(o){return functionSignatureRegex.test(o)}function execFunctionSignature(o){return execTyped(functionSignatureRegex,o)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(o){return structSignatureRegex.test(o)}function execStructSignature(o){return execTyped(structSignatureRegex,o)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(o){return constructorSignatureRegex.test(o)}function execConstructorSignature(o){return execTyped(constructorSignatureRegex,o)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(o){return fallbackSignatureRegex.test(o)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(o){return receiveSignatureRegex.test(o)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" 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:et}){super("Unknown type.",{metaMessages:[`Type "${et}" 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:et}){super("Invalid ABI parameter.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$2{constructor({param:et,name:tt}){super("Invalid ABI parameter.",{details:et,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:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" 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:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${nt}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$2{constructor({abiParameter:et}){super("Invalid ABI parameter.",{details:JSON.stringify(et,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:et,type:tt}){super(`Invalid ${tt} signature.`,{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class UnknownSignatureError extends BaseError$2{constructor({signature:et}){super("Unknown signature.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$2{constructor({signature:et}){super("Invalid struct signature.",{details:et,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$2{constructor({type:et}){super("Circular reference detected.",{metaMessages:[`Struct "${et}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$2{constructor({current:et,depth:tt}){super("Unbalanced parentheses.",{metaMessages:[`"${et.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(o,et){return et?`${et}:${o}`:o}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(o,et={}){if(isFunctionSignature(o)){const tt=execFunctionSignature(o);if(!tt)throw new InvalidSignatureError$1({signature:o,type:"function"});const nt=splitParameters(tt.parameters),rt=[],ot=nt.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(o,et){var dt,ht;const tt=getParameterCacheKey(o,et==null?void 0:et.type);if(parameterCache.has(tt))return parameterCache.get(tt);const nt=isTupleRegex.test(o),rt=execTyped(nt?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,o);if(!rt)throw new InvalidParameterError({param:o});if(rt.name&&isSolidityKeyword(rt.name))throw new SolidityProtectedKeywordError({param:o,name:rt.name});const ot=rt.name?{name:rt.name}:{},it=rt.modifier==="indexed"?{indexed:!0}:{},st=(et==null?void 0:et.structs)??{};let at,ct={};if(nt){at="tuple";const ft=splitParameters(rt.type),mt=[],pt=ft.length;for(let yt=0;yt[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(o,et,tt=new Set){const nt=[],rt=o.length;for(let ot=0;ot{const et=typeof o=="string"?o:formatAbiItem(o);return normalizeSignature$1(et)};function toSignatureHash(o){return hashSignature(toSignature(o))}const toEventSelector=toSignatureHash,toFunctionSelector=o=>slice(toSignatureHash(o),0,4);function getAbiItem(o){const{abi:et,args:tt=[],name:nt}=o,rt=isHex(nt,{strict:!1}),ot=et.filter(st=>rt?st.type==="function"?toFunctionSelector(st)===nt:st.type==="event"?toEventSelector(st)===nt:!1:"name"in st&&st.name===nt);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(o,et){const tt=typeof o,nt=et.type;switch(nt){case"address":return isAddress(o,{strict:!1});case"bool":return tt==="boolean";case"function":return tt==="string";case"string":return tt==="string";default:return nt==="tuple"&&"components"in et?Object.values(et.components).every((rt,ot)=>isArgOfType(Object.values(o)[ot],rt)):/^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(nt)?tt==="number"||tt==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(nt)?tt==="string"||o instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(nt)?Array.isArray(o)&&o.every(rt=>isArgOfType(rt,{...et,type:nt.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(o,et,tt){for(const nt in o){const rt=o[nt],ot=et[nt];if(rt.type==="tuple"&&ot.type==="tuple"&&"components"in rt&&"components"in ot)return getAmbiguousTypes(rt.components,ot.components,tt[nt]);const it=[rt.type,ot.type];if(it.includes("address")&&it.includes("bytes20")?!0:it.includes("address")&&it.includes("string")?isAddress(tt[nt],{strict:!1}):it.includes("address")&&it.includes("bytes")?isAddress(tt[nt],{strict:!1}):!1)return it}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(o){const{abi:et,args:tt,functionName:nt,data:rt}=o;let ot=et[0];if(nt){const st=getAbiItem({abi:et,args:tt,name:nt});if(!st)throw new AbiFunctionNotFoundError(nt,{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,rt);if(it&&it.length>1)return it;if(it&&it.length===1)return it[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(o){const{abi:et,args:tt,functionName:nt}=o;let rt=et[0];if(nt){const ot=getAbiItem({abi:et,args:tt,name:nt});if(!ot)throw new AbiFunctionNotFoundError(nt,{docsPath});rt=ot}if(rt.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[rt],functionName:toFunctionSelector(formatAbiItem$1(rt))}}function encodeFunctionData(o){const{args:et}=o,{abi:tt,functionName:nt}=(()=>{var st;return o.abi.length===1&&((st=o.functionName)!=null&&st.startsWith("0x"))?o:prepareEncodeFunctionData(o)})(),rt=tt[0],ot=nt,it="inputs"in rt&&rt.inputs?encodeAbiParameters(rt.inputs,et??[]):void 0;return concatHex([ot,it??"0x"])}function getChainContractAddress({blockNumber:o,chain:et,contract:tt}){var rt;const nt=(rt=et==null?void 0:et.contracts)==null?void 0:rt[tt];if(!nt)throw new ChainDoesNotSupportContract({chain:et,contract:{name:tt}});if(o&&nt.blockCreated&&nt.blockCreated>o)throw new ChainDoesNotSupportContract({blockNumber:o,chain:et,contract:{name:tt,blockCreated:nt.blockCreated}});return nt.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(o){const{abi:et,data:tt}=o,nt=slice(tt,0,4);if(nt==="0x")throw new AbiDecodingZeroDataError;const ot=[...et||[],solidityError,solidityPanic].find(it=>it.type==="error"&&nt===toFunctionSelector(formatAbiItem$1(it)));if(!ot)throw new AbiErrorSignatureNotFoundError(nt,{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:o,args:et,includeFunctionName:tt=!0,includeName:nt=!1}){if("name"in o&&"inputs"in o&&o.inputs)return`${tt?o.name:""}(${o.inputs.map((rt,ot)=>`${nt&&rt.name?`${rt.name}: `:""}${typeof et[ot]=="object"?stringify$2(et[ot]):et[ot]}`).join(", ")})`}class CallExecutionError extends BaseError$3{constructor(et,{account:tt,docsPath:nt,chain:rt,data:ot,gas:it,gasPrice:st,maxFeePerGas:at,maxPriorityFeePerGas:ct,nonce:lt,to:dt,value:ht,stateOverride:ft}){var yt;const mt=tt?parseAccount(tt):void 0;let pt=prettyPrint({from:mt==null?void 0:mt.address,to:dt,value:typeof ht<"u"&&`${formatEther(ht)} ${((yt=rt==null?void 0:rt.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});ft&&(pt+=` +${prettyStateOverride(ft)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],"Raw Call Arguments:",pt].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=et}}class ContractFunctionExecutionError extends BaseError$3{constructor(et,{abi:tt,args:nt,contractAddress:rt,docsPath:ot,functionName:it,sender:st}){const at=getAbiItem({abi:tt,args:nt,name:it}),ct=at?formatAbiItemWithArgs({abiItem:at,args:nt,includeFunctionName:!1,includeName:!1}):void 0,lt=at?formatAbiItem$1(at,{includeName:!0}):void 0,dt=prettyPrint({address:rt&&getContractAddress(rt),function:lt,args:ct&&ct!=="()"&&`${[...Array((it==null?void 0:it.length)??0).keys()].map(()=>" ").join("")}${ct}`,sender:st});super(et.shortMessage||`An unknown error occurred while executing the contract function "${it}".`,{cause:et,docsPath:ot,metaMessages:[...et.metaMessages?[...et.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=nt,this.cause=et,this.contractAddress=rt,this.functionName=it,this.sender=st}}class ContractFunctionRevertedError extends BaseError$3{constructor({abi:et,data:tt,functionName:nt,message:rt}){let ot,it,st,at;if(tt&&tt!=="0x")try{it=decodeErrorResult({abi:et,data:tt});const{abiItem:lt,errorName:dt,args:ht}=it;if(dt==="Error")at=ht[0];else if(dt==="Panic"){const[ft]=ht;at=panicReasons[ft]}else{const ft=lt?formatAbiItem$1(lt,{includeName:!0}):void 0,mt=lt&&ht?formatAbiItemWithArgs({abiItem:lt,args:ht,includeFunctionName:!1,includeName:!1}):void 0;st=[ft?`Error: ${ft}`:"",mt&&mt!=="()"?` ${[...Array((dt==null?void 0:dt.length)??0).keys()].map(()=>" ").join("")}${mt}`:""]}}catch(lt){ot=lt}else rt&&(at=rt);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 "${nt}" reverted with the following ${ct?"signature":"reason"}:`,at||ct].join(` +`):`The contract function "${nt}" 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:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - 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:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{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:et,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=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.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")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let ft=0;ft{for(let ft=0;ftschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:ft}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:ft}),dt):(ct({args:lt,resolve:ht,reject:ft}),setTimeout(ot,nt),dt)}}}async function call(o,et){var Nt,Mt,Bt,zt;const{account:tt=o.account,batch:nt=!!((Nt=o.batch)!=null&&Nt.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,It=lt&&dt&&xt&&ct,Rt=kt||It,$t=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):It?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Mt=o.chain)==null?void 0:Mt.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Pt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:$t,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Pt})&&!Ht)try{return await scheduleMulticall(o,{...Pt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Pt,Yt,Ht]:[Pt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Pt}=await import("./ccip-zypZ5n5w.js");return{offchainLookup:qt,offchainLookupSignature:Pt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var pt;const{batchSize:tt=1024,wait:nt=0}=typeof((pt=o.batch)==null?void 0:pt.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:ft,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:ft});return ft==="0x"?{data:void 0}:{data:ft}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const ft=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return ft==="0x"||trim$1(ft)==="0x00"?null:ft}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){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(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" 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(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.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(o);if(o.startsWith("http")&&!lt&&!dt){let ft=o;return et!=null&&et.arweave&&(ft=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:ft,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.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(!rt)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:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});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:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,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(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.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(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,ft=0;for(let gt=0;gt0&&ft>ct&&dt[ht].length>0&&(ht++,ft=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var ft,mt;const ht=rt();if(ht.length!==0)for(const pt of ht)(mt=(ft=pt.fns)[lt])==null||mt.call(ft,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var ft;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let pt=at+1n;ptat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(ft=ht.onError)==null||ft.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let ft=!0,mt=()=>ft=!1;return(async()=>{try{const pt=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await pt.subscribe({params:["newHeads"],onData(gt){var vt;if(!ft)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,ft||mt()}catch(pt){rt==null||rt(pt)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(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:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const pt={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,pt),gt=await(rt==null?void 0:rt(yt,pt))??{...pt,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let ft;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))ft=await ht.json();else{ft=await ht.text();try{ft=JSON.parse(ft||"{}")}catch(mt){if(ht.ok)throw mt;ft={error:ft}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(ft.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return ft}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof ft>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof ft>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});ft=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),pt=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(ft)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const ft=27n+(et.v===27n?0n:1n);if(et.v!==ft)throw new InvalidLegacyVError({v:et.v});return ft})(),dt=trim$1(et.r),ht=trim$1(et.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(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.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 rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! 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(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let ft;for(;!(ft=ht(ct()));)at();return it(),ft}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.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(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_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(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),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,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.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(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! 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(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.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}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=ft,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=pt%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}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){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,ft=o.ZERO;ht>0;ht--)ft=ft.add(st[ht]),dt=dt.add(ft);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&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=et.subarray(nt,nt+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(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((pt,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(pt=>{const yt=pt.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(pt){const{a:yt,b:gt}=et,xt=tt.sqr(pt),vt=tt.mul(xt,pt);return tt.add(tt.add(vt,tt.mul(pt,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(pt){return inRange(pt,_1n$5,et.n)}function at(pt){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;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 bt;try{bt=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 xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(pt){if(!(pt instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((pt,yt)=>{const{px:gt,py:xt,pz:vt}=pt;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=pt.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(pt=>{if(pt.is0()){if(et.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 xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))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,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).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,nt,yt,gt)}_setWindowSize(yt){mt.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:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),It=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&It}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,It=tt.ZERO,Rt=tt.mul(vt,vt),$t=tt.mul(bt,bt),Nt=tt.mul(Et,Et),Mt=tt.mul(vt,bt);return Mt=tt.add(Mt,Mt),It=tt.mul(vt,Et),It=tt.add(It,It),wt=tt.mul(yt,It),kt=tt.mul(xt,Nt),kt=tt.add(wt,kt),wt=tt.sub($t,kt),kt=tt.add($t,kt),kt=tt.mul(wt,kt),wt=tt.mul(Mt,wt),It=tt.mul(xt,It),Nt=tt.mul(yt,Nt),Mt=tt.sub(Rt,Nt),Mt=tt.mul(yt,Mt),Mt=tt.add(Mt,It),It=tt.add(Rt,Rt),Rt=tt.add(It,Rt),Rt=tt.add(Rt,Nt),Rt=tt.mul(Rt,Mt),kt=tt.add(kt,Rt),Nt=tt.mul(bt,Et),Nt=tt.add(Nt,Nt),Rt=tt.mul(Nt,Mt),wt=tt.sub(wt,Rt),It=tt.mul(Nt,$t),It=tt.add(It,It),It=tt.add(It,It),new ht(wt,kt,It)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,It=tt.ZERO,Rt=tt.ZERO;const $t=et.a,Nt=tt.mul(et.b,_3n$2);let Mt=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Mt,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Mt,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul($t,Yt),kt=tt.mul(Nt,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),It=tt.mul(kt,Rt),Bt=tt.add(Mt,Mt),Bt=tt.add(Bt,Mt),zt=tt.mul($t,zt),Yt=tt.mul(Nt,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Mt,zt),zt=tt.mul($t,zt),Yt=tt.add(Yt,zt),Mt=tt.mul(Bt,Yt),It=tt.add(It,Mt),Mt=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Mt),Mt=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Mt),new ht(kt,It,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,It=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(It=It.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(It=It.negate()),It=new ht(tt.mul(It.px,xt.beta),It.py,It.pz),kt.add(It)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:It}=gt.splitScalar(yt);let{p:Rt,f:$t}=this.wNAF(wt),{p:Nt,f:Mt}=this.wNAF(It);Rt=mt.constTimeNegate(Et,Rt),Nt=mt.constTimeNegate(kt,Nt),Nt=new ht(tt.mul(Nt.px,gt.beta),Nt.py,Nt.pz),vt=Rt.add(Nt),bt=$t.add(Mt)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;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}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const ft=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(ft/2):ft);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Pt;try{Pt=tt.sqrt(qt)}catch(Lt){const Gt=Lt instanceof Error?": "+Lt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Pt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Pt=tt.neg(Pt)),{x:Ut,y:Pt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function ft(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return ft(zt)?it(-zt):zt}const pt=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(pt(Ft,0,Yt),pt(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Pt=Ut===2||Ut===3?Yt+et.n:Yt;if(Pt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Pt)),Lt=st(Pt),Gt=it(-qt*Lt),nn=it(Ht*Lt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return ft(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(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function It(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=$t){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Pt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Pt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Lt=ct(Ft),Gt=[It(Lt),It(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),Tt=at.BASE.multiply(Jt).toAffine(),Dt=it(Tt.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Lt));if(Vt===_0n$3)return;let en=(Tt.x===Dt?0:2)|Number(Tt.y&_1n$5),an=Vt;return qt&&ft(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const $t={lowS:et.lowS,prehash:!1},Nt={lowS:et.lowS,prehash:!1};function Mt(zt,Ft,Yt=$t){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=Nt){var Tt;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Pt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Pt&&(Ft=et.hash(Ft));const{r:Lt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Lt*Wt),Jt=(Tt=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:Tt.toAffine();return Jt?it(Jt.x)===Lt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Mt,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),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=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,ft=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(ft,rt,et)*ft%et,pt=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(pt,st,et)*pt%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*pt%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}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:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.5",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class Rs extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,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 nt=tt.cause instanceof Rs?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof Rs&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` +`),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}walk(et){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,et)}};_BaseError_instances=new WeakSet,_BaseError_walk=function o(et,tt){return tt!=null&&tt(et)?et:et.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",o).call(this,et.cause,tt):et};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:et,connector:tt}){super(`Account "${et}" 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:et,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${et}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${et}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:et}){super(`Connector "${et.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(o,et){var nt;let tt;if(typeof et.connector=="function"?tt=o._internal.connectors.setup(et.connector):tt=et.connector,tt.uid===o.state.current)throw new ConnectorAlreadyConnectedError;try{o.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const rt=await tt.connect({chainId:et.chainId}),ot=rt.accounts;return tt.emitter.off("connect",o._internal.events.connect),tt.emitter.on("change",o._internal.events.change),tt.emitter.on("disconnect",o._internal.events.disconnect),await((nt=o.storage)==null?void 0:nt.setItem("recentConnectorId",tt.id)),o.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:rt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:rt.chainId}}catch(rt){throw o.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),rt}}const size$1=256;let index$3=size$1,buffer$1;function uid$1(o=11){if(!buffer$1||index$3+o>size$1*2){buffer$1="",index$3=0;for(let et=0;et{const xt=gt(yt);for(const bt in mt)delete xt[bt];const vt={...yt,...xt};return Object.assign(vt,{extend:pt(vt)})}}return Object.assign(mt,{extend:pt(mt)})}function createTransport({key:o,name:et,request:tt,retryCount:nt=3,retryDelay:rt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:o,name:et,request:tt,retryCount:nt,retryDelay:rt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:nt,retryDelay:rt,uid:at}),value:st}}function custom(o,et={}){const{key:tt="custom",name:nt="Custom Provider",retryDelay:rt}=et;return({retryCount:ot})=>createTransport({key:tt,name:nt,request:o.request.bind(o),retryCount:et.retryCount??ot,retryDelay:rt,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(o,et={}){const{batch:tt,fetchOptions:nt,key:rt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=et;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:ft=0}=typeof tt=="object"?tt:{},mt=et.retryCount??lt,pt=dt??et.timeout??1e4,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{fetchOptions:nt,onRequest:it,onResponse:st,timeout:pt});return createTransport({key:rt,name:ot,async request({method:xt,params:vt}){const bt={method:xt,params:vt},{schedule:Et}=createBatchScheduler({id:yt,wait:ft,shouldSplitBatch(Rt){return Rt.length>ht},fn:Rt=>gt.request({body:Rt}),sort:(Rt,$t)=>Rt.id-$t.id}),wt=async Rt=>tt?Et(Rt):[await gt.request({body:Rt})],[{error:kt,result:It}]=await wt(bt);if(kt)throw new RpcRequestError({body:bt,error:kt,url:yt});return It},retryCount:mt,retryDelay:at,timeout:pt,type:"http"},{fetchOptions:nt,url:yt})}}async function getConnectorClient(o,et={}){let tt;if(et.connector){const{connector:ct}=et;if(o.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=o.state.connections.get(o.state.current);if(!tt)throw new ConnectorNotConnectedError;const nt=et.chainId??tt.chainId,rt=await tt.connector.getChainId();if(rt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:rt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:nt});const it=parseAccount(et.account??tt.accounts[0]);if(it.address=getAddress(it.address),et.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=o.chains.find(ct=>ct.id===nt),at=await tt.connector.getProvider({chainId:nt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom(at)({...ct,retryCount:0})})}async function disconnect(o,et={}){var rt,ot;let tt;if(et.connector)tt=et.connector;else{const{connections:it,current:st}=o.state,at=it.get(st);tt=at==null?void 0:at.connector}const nt=o.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",o._internal.events.change),tt.emitter.off("disconnect",o._internal.events.disconnect),tt.emitter.on("connect",o._internal.events.connect),nt.delete(tt.uid)),o.setState(it=>{if(nt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=nt.values().next().value;return{...it,connections:new Map(nt),current:st.connector.uid}});{const it=o.state.current;if(!it)return;const st=(rt=o.state.connections.get(it))==null?void 0:rt.connector;if(!st)return;await((ot=o.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(o){return typeof o=="number"?o:o==="wei"?0:Math.abs(weiUnits[o])}function getAccount(o){const et=o.state.current,tt=o.state.connections.get(et),nt=tt==null?void 0:tt.accounts,rt=nt==null?void 0:nt[0],ot=o.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=o.state.status;switch(it){case"connected":return{address:rt,addresses:nt,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:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!rt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:rt,addresses:nt,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(o,et){const{allowFailure:tt=!0,chainId:nt,contracts:rt,...ot}=et,it=o.getClient({chainId:nt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:rt,...ot})}function readContract(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,readContract$1,"readContract")(nt)}async function readContracts(o,et){var st;const{allowFailure:tt=!0,blockNumber:nt,blockTag:rt,...ot}=et,it=et.contracts;try{const at={};for(const[ht,ft]of it.entries()){const mt=ft.chainId??o.state.chainId;at[mt]||(at[mt]=[]),(st=at[mt])==null||st.push({contract:ft,index:ht})}const ct=()=>Object.entries(at).map(([ht,ft])=>multicall(o,{...ot,allowFailure:tt,blockNumber:nt,blockTag:rt,chainId:Number.parseInt(ht),contracts:ft.map(({contract:mt})=>mt)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:ft})=>ft));return lt.reduce((ht,ft,mt)=>(ht&&(ht[dt[mt]]=ft),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(o,{...lt,blockNumber:nt,blockTag:rt}));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(o,et){const{address:tt,blockNumber:nt,blockTag:rt,chainId:ot,token:it,unit:st="ether"}=et;if(it)try{return await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht.name==="ContractFunctionExecutionError"){const ft=await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),mt=hexToString(trim$1(ft.symbol,{dir:"right"}));return{...ft,symbol:mt}}throw ht}const at=o.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(nt?{address:tt,blockNumber:nt}:{address:tt,blockTag:rt}),dt=o.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(o,et){const{balanceAddress:tt,chainId:nt,symbolType:rt,tokenAddress:ot,unit:it}=et,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:rt}]}],address:ot},[at,ct,lt]=await readContracts(o,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:nt},{...st,functionName:"decimals",chainId:nt},{...st,functionName:"symbol",chainId:nt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(o,et={}){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getBlockNumber$1,"getBlockNumber")(nt)}function getChainId(o){return o.state.chainId}function deepEqual(o,et){if(o===et)return!0;if(o&&et&&typeof o=="object"&&typeof et=="object"){if(o.constructor!==et.constructor)return!1;let tt,nt;if(Array.isArray(o)&&Array.isArray(et)){if(tt=o.length,tt!==et.length)return!1;for(nt=tt;nt--!==0;)if(!deepEqual(o[nt],et[nt]))return!1;return!0}if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===et.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===et.toString();const rt=Object.keys(o);if(tt=rt.length,tt!==Object.keys(et).length)return!1;for(nt=tt;nt--!==0;)if(!Object.prototype.hasOwnProperty.call(et,rt[nt]))return!1;for(nt=tt;nt--!==0;){const ot=rt[nt];if(ot&&!deepEqual(o[ot],et[ot]))return!1}return!0}return o!==o&&et!==et}let previousChains=[];function getChains(o){const et=o.chains;return deepEqual(previousChains,et)?previousChains:(previousChains=et,et)}let previousConnections=[];function getConnections(o){const et=[...o.state.connections.values()];return o.state.status==="reconnecting"||deepEqual(previousConnections,et)?previousConnections:(previousConnections=et,et)}let previousConnectors=[];function getConnectors(o){const et=o.connectors;return deepEqual(previousConnectors,et)?previousConnectors:(previousConnectors=et,et)}function getEnsAddress(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAddress$1,"getEnsAddress")(nt)}function getEnsAvatar(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAvatar$1,"getEnsAvatar")(nt)}function getEnsName(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsName$1,"getEnsName")(nt)}let isReconnecting=!1;async function reconnect(o,et={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,o.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=et.connectors)!=null&&ct.length)for(const dt of et.connectors){let ht;typeof dt=="function"?ht=o._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...o.connectors);let nt;try{nt=await((lt=o.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const rt={};for(const[,dt]of o.state.connections)rt[dt.connector.id]=1;nt&&(rt[nt]=0);const ot=Object.keys(rt).length>0?[...tt].sort((dt,ht)=>(rt[dt.id]??10)-(rt[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 mt=await dt.connect({isReconnecting:!0}).catch(()=>null);mt&&(dt.emitter.off("connect",o._internal.events.connect),dt.emitter.on("change",o._internal.events.change),dt.emitter.on("disconnect",o._internal.events.disconnect),o.setState(pt=>{const yt=new Map(it?pt.connections:new Map).set(dt.uid,{accounts:mt.accounts,chainId:mt.chainId,connector:dt});return{...pt,current:it?pt.current:dt.uid,connections:yt}}),st.push({accounts:mt.accounts,chainId:mt.chainId,connector:dt}),at.push(ht),it=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(it?o.setState(dt=>({...dt,status:"connected"})):o.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(o,et){const{account:tt,connector:nt,...rt}=et;let ot;return typeof tt=="object"&&tt.type==="local"?ot=o.getClient():ot=await getConnectorClient(o,{account:tt,connector:nt}),getAction(ot,signMessage$1,"signMessage")({...rt,...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:et}){super(`"${et.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(o,et){var it;const{addEthereumChainParameter:tt,chainId:nt}=et,rt=o.state.connections.get(((it=et.connector)==null?void 0:it.uid)??o.state.current);if(rt){const st=rt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:nt})}const ot=o.chains.find(st=>st.id===nt);if(!ot)throw new ChainNotConfiguredError;return o.setState(st=>({...st,chainId:nt})),ot}function watchAccount(o,et){const{onChange:tt}=et;return o.subscribe(()=>getAccount(o),tt,{equalityFn(nt,rt){const{connector:ot,...it}=nt,{connector:st,...at}=rt;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(o,et){const{syncConnectedChain:tt=o._internal.syncConnectedChain,...nt}=et;let rt;const ot=at=>{rt&&rt();const ct=o.getClient({chainId:at});return rt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(nt),rt},it=ot(et.chainId);let st;return tt&&!et.chainId&&(st=o.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(o,et){const{onChange:tt}=et;return o.subscribe(nt=>nt.chainId,tt)}function watchConnections(o,et){const{onChange:tt}=et;return o.subscribe(()=>getConnections(o),tt,{equalityFn:deepEqual})}function watchConnectors(o,et){const{onChange:tt}=et;return o._internal.connectors.subscribe((nt,rt)=>{tt(Object.values(nt),rt)})}function createConnector(o){return o}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(o={}){const{shimDisconnect:et=!0,unstable_shimAsyncInject:tt}=o;function nt(){const at=o.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 rt,ot,it,st;return at=>({get icon(){return nt().icon},get id(){return nt().id},get name(){return nt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&o.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)))},async connect({chainId:ct,isReconnecting:lt}={}){var ft,mt,pt,yt,gt,xt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(et)try{ht=(yt=(pt=(mt=(ft=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:ft.caveats)==null?void 0:mt[0])==null?void 0:pt.value)==null?void 0:yt.map(bt=>getAddress(bt)),ht.length>0&&(ht=await this.getAccounts())}catch(vt){const bt=vt;if(bt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(bt);if(bt.code===ResourceUnavailableRpcError.code)throw bt}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),rt||(rt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let vt=await this.getChainId();if(ct&&vt!==ct){const bt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:vt}});vt=(bt==null?void 0:bt.id)??vt}return et&&await((gt=at.storage)==null?void 0:gt.removeItem(`${this.id}.disconnected`)),o.target||await((xt=at.storage)==null?void 0:xt.setItem("injected.connected",!0)),{accounts:ht,chainId:vt}}catch(vt){const bt=vt;throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):bt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(bt):bt}},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{}et&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),o.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=nt();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(et&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!o.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 mt=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",mt),!!await this.getProvider()),pt=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(gt=>window.addEventListener("ethereum#initialized",()=>gt(mt()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(mt()),pt))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,pt,yt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(xt=>xt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);const ft=new Promise(xt=>{const vt=bt=>{"chainId"in bt&&bt.chainId===lt&&(at.emitter.off("change",vt),xt())};at.emitter.on("change",vt)});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})}),ft]),ht}catch(xt){const vt=xt;if(vt.code===4902||((pt=(mt=vt==null?void 0:vt.data)==null?void 0:mt.originalError)==null?void 0:pt.code)===4902)try{const{default:bt,...Et}=ht.blockExplorers??{};let wt;ct!=null&&ct.blockExplorerUrls?wt=ct.blockExplorerUrls:bt&&(wt=[bt.url,...Object.values(Et).map(Rt=>Rt.url)]);let kt;(yt=ct==null?void 0:ct.rpcUrls)!=null&&yt.length?kt=ct.rpcUrls:kt=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const It={blockExplorerUrls:wt,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:kt};return await Promise.all([dt.request({method:"wallet_addEthereumChain",params:[It]}).then(async()=>{if(await this.getChainId()===lt)at.emitter.emit("change",{chainId:lt});else throw new UserRejectedRequestError(new Error("User rejected switch after adding network."))}),ft]),ht}catch(bt){throw new UserRejectedRequestError(bt)}throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):new SwitchChainError(vt)}},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}),et&&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),rt||(rt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",rt)),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))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o!=null&&o.coinbaseWalletExtension?o.coinbaseWalletExtension:findProvider(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return findProvider(o,et=>{if(!et.isMetaMask||et.isBraveWallet&&!et._events&&!et._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const nt of tt)if(et[nt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){var et,tt;return(et=o==null?void 0:o.phantom)!=null&&et.ethereum?(tt=o.phantom)==null?void 0:tt.ethereum:findProvider(o,"isPhantom")}}};function findProvider(o,et){function tt(rt){return typeof et=="function"?et(rt):typeof et=="string"?rt[et]:!0}const nt=o.ethereum;if(nt!=null&&nt.providers)return nt.providers.find(rt=>tt(rt));if(nt&&tt(nt))return nt}function requestProviders(o){if(typeof window>"u")return;const et=tt=>o(tt.detail);return window.addEventListener("eip6963:announceProvider",et),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",et)}function createStore$1(){const o=new Set;let et=[];const tt=()=>requestProviders(rt=>{et.some(({info:ot})=>ot.uuid===rt.info.uuid)||(et=[...et,rt],o.forEach(ot=>ot(et,{added:[rt]})))});let nt=tt();return{_listeners(){return o},clear(){o.forEach(rt=>rt([],{removed:[...et]})),et=[]},destroy(){this.clear(),o.clear(),nt==null||nt()},findProvider({rdns:rt}){return et.find(ot=>ot.info.rdns===rt)},getProviders(){return et},reset(){this.clear(),nt==null||nt(),nt=tt()},subscribe(rt,{emitImmediately:ot}={}){return o.add(rt),ot&&rt(et,{added:et}),()=>o.delete(rt)}}}const subscribeWithSelectorImpl=o=>(et,tt,nt)=>{const rt=nt.subscribe;return nt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(nt.getState());ct=ht=>{const ft=it(ht);if(!lt(dt,ft)){const mt=dt;st(dt=ft,mt)}},at!=null&&at.fireImmediately&&st(dt,dt)}return rt(ct)},o(et,tt,nt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(o,et){let tt;try{tt=o()}catch{return}return{getItem:rt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(rt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(rt,ot)=>tt.setItem(rt,JSON.stringify(ot,void 0)),removeItem:rt=>tt.removeItem(rt)}}const toThenable=o=>et=>{try{const tt=o(et);return tt instanceof Promise?tt:{then(nt){return toThenable(nt)(tt)},catch(nt){return this}}}catch(tt){return{then(nt){return this},catch(nt){return toThenable(nt)(tt)}}}},persistImpl=(o,et)=>(tt,nt,rt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:pt=>pt,version:0,merge:(pt,yt)=>({...yt,...pt}),...et},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return o((...pt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...pt)},nt,rt);const lt=()=>{const pt=ot.partialize({...nt()});return ct.setItem(ot.name,{state:pt,version:ot.version})},dt=rt.setState;rt.setState=(pt,yt)=>{dt(pt,yt),lt()};const ht=o((...pt)=>{tt(...pt),lt()},nt,rt);rt.getInitialState=()=>ht;let ft;const mt=()=>{var pt,yt;if(!ct)return;it=!1,st.forEach(xt=>{var vt;return xt((vt=nt())!=null?vt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.call(ot,(pt=nt())!=null?pt:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(xt=>{if(xt)if(typeof xt.version=="number"&&xt.version!==ot.version){if(ot.migrate)return[!0,ot.migrate(xt.state,xt.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,xt.state];return[!1,void 0]}).then(xt=>{var vt;const[bt,Et]=xt;if(ft=ot.merge(Et,(vt=nt())!=null?vt:ht),tt(ft,!0),bt)return lt()}).then(()=>{gt==null||gt(ft,void 0),ft=nt(),it=!0,at.forEach(xt=>xt(ft))}).catch(xt=>{gt==null||gt(void 0,xt)})};return rt.persist={setOptions:pt=>{ot={...ot,...pt},pt.storage&&(ct=pt.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>mt(),hasHydrated:()=>it,onHydrate:pt=>(st.add(pt),()=>{st.delete(pt)}),onFinishHydration:pt=>(at.add(pt),()=>{at.delete(pt)})},ot.skipHydration||mt(),ft||ht},persist=persistImpl,createStoreImpl=o=>{let et;const tt=new Set,nt=(ct,lt)=>{const dt=typeof ct=="function"?ct(et):ct;if(!Object.is(dt,et)){const ht=et;et=lt??(typeof dt!="object"||dt===null)?dt:Object.assign({},et,dt),tt.forEach(ft=>ft(et,ht))}},rt=()=>et,st={setState:nt,getState:rt,getInitialState:()=>at,subscribe:ct=>(tt.add(ct),()=>tt.delete(ct))},at=et=o(nt,rt,st);return st},createStore=o=>o?createStoreImpl(o):createStoreImpl;var eventemitter3={exports:{}};(function(o){var et=Object.prototype.hasOwnProperty,tt="~";function nt(){}Object.create&&(nt.prototype=Object.create(null),new nt().__proto__||(tt=!1));function rt(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 ft=new rt(lt,dt||at,ht),mt=tt?tt+ct:ct;return at._events[mt]?at._events[mt].fn?at._events[mt]=[at._events[mt],ft]:at._events[mt].push(ft):(at._events[mt]=ft,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new nt:delete at._events[ct]}function st(){this._events=new nt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)et.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,ft=dt.length,mt=new Array(ft);ht{let rt=nt;return(rt==null?void 0:rt.__type)==="bigint"&&(rt=BigInt(rt.value)),(rt==null?void 0:rt.__type)==="Map"&&(rt=new Map(rt.value)),(et==null?void 0:et(tt,rt))??rt})}function getReferenceKey(o,et){return o.slice(0,et).join(".")||"."}function getCutoff(o,et){const{length:tt}=o;for(let nt=0;nt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(et==null?void 0:et(rt,it))??it},nt),tt??void 0)}function createStorage(o){const{deserialize:et=deserialize$1,key:tt="wagmi",serialize:nt=serialize$1,storage:rt=noopStorage}=o;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...rt,key:tt,async getItem(it,st){const at=rt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?et(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(rt.removeItem(at)):await ot(rt.setItem(at,nt(st)))},async removeItem(it){await ot(rt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer;function uid(o=11){if(!buffer||index$2+o>size*2){buffer="",index$2=0;for(let et=0;etot.chains),at=createStore(()=>{const Et=[],wt=new Set;for(const kt of ot.connectors??[]){const It=ct(kt);Et.push(It),!rt&&It.rdns&&wt.add(It.rdns)}if(!rt&&it){const kt=it.getProviders();for(const It of kt)wt.has(It.info.rdns)||Et.push(ct(lt(It)))}return Et});function ct(Et){var It;const wt=createEmitter(uid()),kt={...Et({emitter:wt,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:wt,uid:wt.uid};return wt.on("connect",vt),(It=kt.setup)==null||It.call(kt),kt}function lt(Et){const{info:wt}=Et,kt=Et.provider;return injected({target:{...wt,id:wt.rdns,provider:kt}})}const dt=new Map;function ht(Et={}){const wt=Et.chainId??yt.getState().chainId,kt=st.getState().find(Rt=>Rt.id===wt);if(Et.chainId&&!kt)throw new ChainNotConfiguredError;{const Rt=dt.get(yt.getState().chainId);if(Rt&&!kt)return Rt;if(!kt)throw new ChainNotConfiguredError}{const Rt=dt.get(wt);if(Rt)return Rt}let It;if(ot.client)It=ot.client({chain:kt});else{const Rt=kt.id,$t=st.getState().map(Bt=>Bt.id),Nt={},Mt=Object.entries(ot);for(const[Bt,zt]of Mt)if(!(Bt==="chains"||Bt==="client"||Bt==="connectors"||Bt==="transports"))if(typeof zt=="object")if(Rt in zt)Nt[Bt]=zt[Rt];else{if($t.some(Yt=>Yt in zt))continue;Nt[Bt]=zt}else Nt[Bt]=zt;It=createClient({...Nt,chain:kt,batch:Nt.batch??{multicall:!0},transport:Bt=>ot.transports[Rt]({...Bt,connectors:at})})}return dt.set(wt,It),It}function ft(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let mt;const pt="0.0.0-canary-";version$6.startsWith(pt)?mt=Number.parseInt(version$6.replace(pt,"")):mt=Number.parseInt(version$6.split(".")[0]??"0");const yt=createStore(subscribeWithSelector(tt?persist(ft,{migrate(Et,wt){if(wt===mt)return Et;const kt=ft(),It=gt(Et,kt.chainId);return{...kt,chainId:It}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([wt,kt])=>{const{id:It,name:Rt,type:$t,uid:Nt}=kt.connector;return[wt,{...kt,connector:{id:It,name:Rt,type:$t,uid:Nt}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,wt){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const kt=gt(Et,wt.chainId);return{...wt,...Et,chainId:kt}},skipHydration:rt,storage:tt,version:mt}):ft));yt.setState(ft());function gt(Et,wt){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(kt=>kt.id===Et.chainId)?Et.chainId:wt}nt&&yt.subscribe(({connections:Et,current:wt})=>{var kt;return wt?(kt=Et.get(wt))==null?void 0:kt.chainId:void 0},Et=>{if(st.getState().some(kt=>kt.id===Et))return yt.setState(kt=>({...kt,chainId:Et??kt.chainId}))}),it==null||it.subscribe(Et=>{const wt=new Set,kt=new Set;for(const Rt of at.getState())wt.add(Rt.id),Rt.rdns&&kt.add(Rt.rdns);const It=[];for(const Rt of Et){if(kt.has(Rt.info.rdns))continue;const $t=ct(lt(Rt));wt.has($t.id)||It.push($t)}tt&&!yt.persist.hasHydrated()||at.setState(Rt=>[...Rt,...It],!0)});function xt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);return kt?{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts??kt.accounts,chainId:Et.chainId??kt.chainId,connector:kt.connector})}:wt})}function vt(Et){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.setState(wt=>{const kt=at.getState().find(It=>It.uid===Et.uid);return kt?(kt.emitter.listenerCount("connect")&&kt.emitter.off("connect",xt),kt.emitter.listenerCount("change")||kt.emitter.on("change",xt),kt.emitter.listenerCount("disconnect")||kt.emitter.on("disconnect",bt),{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:kt}),current:Et.uid,status:"connected"}):wt})}function bt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);if(kt){const Rt=kt.connector;Rt.emitter.listenerCount("change")&&kt.connector.emitter.off("change",xt),Rt.emitter.listenerCount("disconnect")&&kt.connector.emitter.off("disconnect",bt),Rt.emitter.listenerCount("connect")||kt.connector.emitter.on("connect",vt)}if(wt.connections.delete(Et.uid),wt.connections.size===0)return{...wt,connections:new Map,current:null,status:"disconnected"};const It=wt.connections.values().next().value;return{...wt,connections:new Map(wt.connections),current:It.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 wt;typeof Et=="function"?wt=Et(yt.getState()):wt=Et;const kt=ft();typeof wt!="object"&&(wt=kt),Object.keys(kt).some(Rt=>!(Rt in wt))&&(wt=kt),yt.setState(wt,!0)},subscribe(Et,wt,kt){return yt.subscribe(Et,wt,kt?{...kt,fireImmediately:kt.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,ssr:!!rt,syncConnectedChain:nt,transports:ot.transports,chains:{setState(Et){const wt=typeof Et=="function"?Et(st.getState()):Et;if(wt.length!==0)return st.setState(wt,!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:xt,connect:vt,disconnect:bt}}}}function hydrate(o,et){const{initialState:tt,reconnectOnMount:nt}=et;return tt&&!o._internal.store.persist.hasHydrated()&&o.setState({...tt,chainId:o.chains.some(rt=>rt.id===tt.chainId)?tt.chainId:o.chains[0].id,connections:nt?tt.connections:new Map,status:nt?"reconnecting":"disconnected"}),{async onMount(){o._internal.ssr&&(await o._internal.store.persist.rehydrate(),o._internal.mipd&&o._internal.connectors.setState(rt=>{var at;const ot=new Set;for(const ct of rt??[])ct.rdns&&ot.add(ct.rdns);const it=[],st=((at=o._internal.mipd)==null?void 0:at.getProviders())??[];for(const ct of st){if(ot.has(ct.info.rdns))continue;const lt=o._internal.connectors.providerDetailToConnector(ct),dt=o._internal.connectors.setup(lt);it.push(dt)}return[...rt,...it]})),nt?reconnect(o):o.storage&&o.setState(rt=>({...rt,connections:new Map}))}}}function extractRpcUrls(o){var ot,it,st;const{chain:et}=o,tt=et.rpcUrls.default.http[0];if(!o.transports)return[tt];const nt=(it=(ot=o.transports)==null?void 0:ot[et.id])==null?void 0:it.call(ot,{chain:et});return(((st=nt==null?void 0:nt.value)==null?void 0:st.transports)||[nt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(o){const{children:et,config:tt,initialState:nt,reconnectOnMount:rt=!0}=o,{onMount:ot}=hydrate(tt,{initialState:nt,reconnectOnMount:rt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),et}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(o){const{children:et,config:tt}=o,nt={value:tt};return reactExports.createElement(Hydrate,o,reactExports.createElement(WagmiContext.Provider,nt,et))}const version$5="2.12.31",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(o={}){const et=o.config??reactExports.useContext(WagmiContext);if(!et)throw new WagmiProviderNotFoundError;return et}function watchChains(o,et){const{onChange:tt}=et;return o._internal.chains.subscribe((nt,rt)=>{tt(nt,rt)})}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(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMes * * 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(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}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(o,et,tt,nt,rt){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(pt){if(!ct){if(ct=!0,lt=pt,pt=nt(pt),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,pt))return dt=mt}return dt=pt}if(mt=dt,q$3(lt,pt))return mt;var ft=nt(pt);return rt!==void 0&&rt(mt,ft)?mt:(lt=pt,dt=ft)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,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=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(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:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,$r,Ds,FocusManager=(Ds=class extends Subscribable{constructor(){super();fn(this,Sr);fn(this,lr);fn(this,$r);un(this,$r,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Mt(this,lr)||this.setEventListener(Mt(this,$r))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,$r,et),(tt=Mt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){Mt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof Mt(this,Sr)=="boolean"?Mt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,$r=new WeakMap,Ds),focusManager=new FocusManager,Or,ur,Mr,Fs,OnlineManager=(Fs=class extends Subscribable{constructor(){super();fn(this,Or,!0);fn(this,ur);fn(this,Mr);un(this,Mr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){Mt(this,ur)||this.setEventListener(Mt(this,Mr))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,Mr,et),(tt=Mt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){Mt(this,Or)!==et&&(un(this,Or,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return Mt(this,Or)}},Or=new WeakMap,ur=new WeakMap,Mr=new WeakMap,Fs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=ft=>{var yt;nt||(ht(new CancelledError(ft)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=ft=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,ft),rt==null||rt(),ot.resolve(ft))},ht=ft=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,ft),rt==null||rt(),ot.reject(ft))},pt=()=>new Promise(ft=>{var yt;rt=gt=>{(nt||ct())&&ft(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var ft;rt=void 0,nt||(ft=o.onContinue)==null||ft.call(o)}),mt=()=>{if(nt)return;let ft;const yt=tt===0?o.initialPromise:void 0;try{ft=yt??o.fn()}catch(gt){ft=Promise.reject(gt)}Promise.resolve(ft).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:pt()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():pt().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Us,Removable=(Us=class{constructor(){fn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Mt(this,kr)&&(clearTimeout(Mt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Us),Br,Dr,Un,jn,no,Ar,Hn,tr,zs,Query=(zs=class extends Removable{constructor(et){super();fn(this,Hn);fn(this,Br);fn(this,Dr);fn(this,Un);fn(this,jn);fn(this,no);fn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??Mt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=Mt(this,jn))==null?void 0:et.promise}setOptions(et){this.options={...Mt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Mt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=Mt(this,jn))==null?void 0:nt.promise;return(rt=Mt(this,jn))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Mt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.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(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,jn))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,jn))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),Mt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(Mt(this,jn)&&(Mt(this,Ar)?Mt(this,jn).cancel({revert:!0}):Mt(this,jn).cancelRetry()),this.scheduleGc()),Mt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,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(Mt(this,jn))return Mt(this,jn).continueRetry(),Mt(this,jn).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!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};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,pt,mt,ft;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((pt=(ht=Mt(this,Un).config).onError)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,jn,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,pt,mt,ft;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(pt=(ht=Mt(this,Un).config).onSuccess)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Mt(this,jn).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,jn=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&Mt(this,Dr)?{...Mt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),Mt(this,Un).notify({query:this,type:"updated",action:et})})},zs);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Vs,QueryCache=(Vs=class extends Subscribable{constructor(et={}){super();fn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){Mt(this,Wn).has(et.queryHash)||(Mt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=Mt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&Mt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return Mt(this,Wn).get(et)}getAll(){return[...Mt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Vs),Gn,$n,Rr,qn,ar,Hs,Mutation=(Hs=class extends Removable{constructor(et){super();fn(this,qn);fn(this,Gn);fn(this,$n);fn(this,Rr);this.mutationId=et.mutationId,un(this,$n,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){Mt(this,Gn).includes(et)||(Mt(this,Gn).push(et),this.clearGcTimeout(),Mt(this,$n).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,Mt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),Mt(this,$n).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){Mt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():Mt(this,$n).remove(this))}continue(){var et;return((et=Mt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(It,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:It,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Mt(this,$n).canRun(this)}));const tt=this.state.status==="pending",nt=!Mt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=Mt(this,$n).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const It=await Mt(this,Rr).start();return await((ct=(at=Mt(this,$n).config).onSuccess)==null?void 0:ct.call(at,It,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,It,et,this.state.context)),await((pt=(ht=Mt(this,$n).config).onSettled)==null?void 0:pt.call(ht,It,null,this.state.variables,this.state.context,this)),await((ft=(mt=this.options).onSettled)==null?void 0:ft.call(mt,It,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:It}),It}catch(It){try{throw await((gt=(yt=Mt(this,$n).config).onError)==null?void 0:gt.call(yt,It,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,It,et,this.state.context)),await((Et=(bt=Mt(this,$n).config).onSettled)==null?void 0:Et.call(bt,void 0,It,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,It,et,this.state.context)),It}finally{gn(this,qn,ar).call(this,{type:"error",error:It})}}finally{Mt(this,$n).runNext(this)}}},Gn=new WeakMap,$n=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{Mt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),Mt(this,$n).notify({mutation:this,type:"updated",action:et})})},Hs);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 Fn,ro,Ws,MutationCache=(Ws=class extends Subscribable{constructor(et={}){super();fn(this,Fn);fn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=Mt(this,Fn).get(tt)??[];nt.push(et),Mt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(Mt(this,Fn).has(tt)){const rt=(nt=Mt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?Mt(this,Fn).delete(tt):Mt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...Mt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ws);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,pt,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((pt=et.state.data)==null?void 0:pt.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let ft=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?ft=!0:et.signal.addEventListener("abort",()=>{ft=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(ft)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:It}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,It),pageParams:Rt(vt.pageParams,bt,It)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var ft,yt;return(yt=(ft=et.options).persister)==null?void 0:yt.call(ft,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Nn,dr,hr,Fr,Ur,pr,zr,Vr,Gs,QueryClient=(Gs=class{constructor(o={}){fn(this,Nn);fn(this,dr);fn(this,hr);fn(this,Fr);fn(this,Ur);fn(this,pr);fn(this,zr);fn(this,Vr);un(this,Nn,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,pr,0)}mount(){br(this,pr)._++,Mt(this,pr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onOnline())})))}unmount(){var o,et;br(this,pr)._--,Mt(this,pr)===0&&((o=Mt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=Mt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return Mt(this,Nn).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return Mt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=Mt(this,Nn).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return Mt(this,Nn).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=Mt(this,Nn).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return Mt(this,Nn).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=Mt(this,Nn);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=Mt(this,Nn),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(Mt(this,Nn).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=Mt(this,Nn).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?Mt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return Mt(this,Nn)}getMutationCache(){return Mt(this,dr)}getDefaultOptions(){return Mt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){Mt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...Mt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){Mt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...Mt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...Mt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...Mt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){Mt(this,Nn).clear(),Mt(this,dr).clear()}},Nn=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,pr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Gs),Mn,Sn,oo,On,_r,Hr,fr,Kn,io,Wr,Gr,Ir,Tr,mr,qr,In,to,Rs,_s,Is,Ts,Ps,Ls,Ns,Ql,qs,QueryObserver=(qs=class extends Subscribable{constructor(et,tt){super();fn(this,In);fn(this,Mn);fn(this,Sn);fn(this,oo);fn(this,On);fn(this,_r);fn(this,Hr);fn(this,fr);fn(this,Kn);fn(this,io);fn(this,Wr);fn(this,Gr);fn(this,Ir);fn(this,Tr);fn(this,mr);fn(this,qr,new Set);this.options=tt,un(this,Mn,et),un(this,Kn,null),un(this,fr,pendingThenable()),this.options.experimental_prefetchInRender||Mt(this,fr).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&&(Mt(this,Sn).addObserver(this),shouldFetchOnMount(Mt(this,Sn),this.options)?gn(this,In,to).call(this):this.updateResult(),gn(this,In,Ts).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,In,Ps).call(this),gn(this,In,Ls).call(this),Mt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=Mt(this,Sn);if(this.options=Mt(this,Mn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Mt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,In,Ns).call(this),Mt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&Mt(this,Mn).getQueryCache().notify({type:"observerOptionsUpdated",query:Mt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Mt(this,Sn),rt,this.options,nt)&&gn(this,In,to).call(this),this.updateResult(tt),ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||resolveStaleTime(this.options.staleTime,Mt(this,Sn))!==resolveStaleTime(nt.staleTime,Mt(this,Sn)))&&gn(this,In,Rs).call(this);const it=gn(this,In,_s).call(this);ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||it!==Mt(this,mr))&&gn(this,In,Is).call(this,it)}getOptimisticResult(et){const tt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,On,nt),un(this,Hr,this.options),un(this,_r,Mt(this,Sn).state)),nt}getCurrentResult(){return Mt(this,On)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){Mt(this,qr).add(et)}getCurrentQuery(){return Mt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=Mt(this,Mn).defaultQueryOptions(et),nt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,In,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),Mt(this,On)))}createResult(et,tt){var It;const nt=Mt(this,Sn),rt=this.options,ot=Mt(this,On),it=Mt(this,_r),st=Mt(this,Hr),ct=et!==nt?et.state:Mt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,pt;if(tt._optimisticResults){const Rt=this.hasListeners(),Pt=!Rt&&shouldFetchOnMount(et,tt),jt=Rt&&shouldFetchOptionally(et,nt,tt,rt);(Pt||jt)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:ft,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Mt(this,io))pt=Mt(this,Wr);else try{un(this,io,tt.select),pt=tt.select(dt.data),pt=replaceData(ot==null?void 0:ot.data,pt,tt),un(this,Wr,pt),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else pt=dt.data;if(tt.placeholderData!==void 0&&pt===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((It=Mt(this,Gr))==null?void 0:It.state.data,Mt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch(Pt){un(this,Kn,Pt)}Rt!==void 0&&(yt="success",pt=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}Mt(this,Kn)&&(mt=Mt(this,Kn),pt=Mt(this,Wr),ft=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=pt!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:pt,dataUpdatedAt:dt.dataUpdatedAt,error:mt,errorUpdatedAt:ft,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&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:Mt(this,fr)};if(this.options.experimental_prefetchInRender){const Rt=Ot=>{kt.status==="error"?Ot.reject(kt.error):kt.data!==void 0&&Ot.resolve(kt.data)},Pt=()=>{const Ot=un(this,fr,kt.promise=pendingThenable());Rt(Ot)},jt=Mt(this,fr);switch(jt.status){case"pending":et.queryHash===nt.queryHash&&Rt(jt);break;case"fulfilled":(kt.status==="error"||kt.data!==jt.value)&&Pt();break;case"rejected":(kt.status!=="error"||kt.error!==jt.reason)&&Pt();break}}return kt}updateResult(et){const tt=Mt(this,On),nt=this.createResult(Mt(this,Sn),this.options);if(un(this,_r,Mt(this,Sn).state),un(this,Hr,this.options),Mt(this,_r).data!==void 0&&un(this,Gr,Mt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,On,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!Mt(this,qr).size)return!0;const at=new Set(st??Mt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(Mt(this,On)).some(ct=>{const lt=ct;return Mt(this,On)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,In,Ql).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,In,Ts).call(this)}},Mn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,On=new WeakMap,_r=new WeakMap,Hr=new WeakMap,fr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ir=new WeakMap,Tr=new WeakMap,mr=new WeakMap,qr=new WeakMap,In=new WeakSet,to=function(et){gn(this,In,Ns).call(this);let tt=Mt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Rs=function(){gn(this,In,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,Mt(this,Sn));if(isServer||Mt(this,On).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(Mt(this,On).dataUpdatedAt,et)+1;un(this,Ir,setTimeout(()=>{Mt(this,On).isStale||this.updateResult()},nt))},_s=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Mt(this,Sn)):this.options.refetchInterval)??!1},Is=function(et){gn(this,In,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,Mt(this,Sn))===!1||!isValidTimeout(Mt(this,mr))||Mt(this,mr)===0)&&un(this,Tr,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,In,to).call(this)},Mt(this,mr)))},Ts=function(){gn(this,In,Rs).call(this),gn(this,In,Is).call(this,gn(this,In,_s).call(this))},Ps=function(){Mt(this,Ir)&&(clearTimeout(Mt(this,Ir)),un(this,Ir,void 0))},Ls=function(){Mt(this,Tr)&&(clearInterval(Mt(this,Tr)),un(this,Tr,void 0))},Ns=function(){const et=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),this.options);if(et===Mt(this,Sn))return;const tt=Mt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Ql=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(Mt(this,On))}),Mt(this,Mn).getQueryCache().notify({query:Mt(this,Sn),type:"observerResultsUpdated"})})},qs);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,js,Ks,MutationObserver$1=(Ks=class extends Subscribable{constructor(tt,nt){super();fn(this,sr);fn(this,gr);fn(this,yr);fn(this,Bn);fn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=Mt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||Mt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Mt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=Mt(this,Bn))==null?void 0:rt.state.status)==="pending"&&Mt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Mt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,js).call(this,tt)}getCurrentResult(){return Mt(this,yr)}reset(){var tt;(tt=Mt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,js).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=Mt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,Mt(this,gr).getMutationCache().build(Mt(this,gr),this.options)),Mt(this,Bn).addObserver(this),Mt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=Mt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},js=function(tt){notifyManager.batch(()=>{var nt,rt,ot,it,st,at,ct,lt;if(Mt(this,rr)&&this.hasListeners()){const dt=Mt(this,yr).variables,ht=Mt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=Mt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=Mt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Mt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Mt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Mt(this,yr))})})},Ks);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:pt,retryDelay:mt,structuralSharing:ft,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:It,refetchOnMount:Rt,refetchOnReconnect:Pt,refetchOnWindowFocus:jt,retryOnMount:Ot,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Lt}=o;return Lt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,pt,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(ft=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(ft));return at.updateResult(),yt},[at,rt]),()=>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:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((pt=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||pt.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const ft=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;ft==null||ft.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,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(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});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(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.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));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),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();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=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 at=await __vitePreload(()=>import("./index-BhnqxX7Q.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,pt,mt;const ct=it.chains.find(ft=>ft.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(ft){if(ft.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;(pt=st==null?void 0:st.rpcUrls)!=null&&pt.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={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:[xt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(ft)}},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();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,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));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),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(pt=>{if(pt.code===UserRejectedRequestError.code)throw pt;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();rt&&(at.removeListener("accountsChanged",rt),rt=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(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:ft}=await import("./index-BE2r4h4L.js").then(yt=>yt.i);return{default:ft}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),pt=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(pt,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,pt,mt,ft;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?[(pt=lt.blockExplorers)==null?void 0:pt.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((ft=lt.rpcUrls.default)==null?void 0:ft.http[0])??""];const vt={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:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),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();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({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 nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.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;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.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-Ctx71FWU.js");return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-DskNhwDJ.js").then(dt=>dt.i),__vite__mapDeps([5,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();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 et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="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,...pt}={}){var mt,ft;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((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.id===Et.chainId)?gt=Et.chainId:gt=(ft=dt.chains[0])==null?void 0:ft.id}if(!gt)throw new Error("No chains found on connector.");const xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in pt?{pairingTopic:pt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=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:vt,chainId:bt}}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(pt){if(!/No matching key/i.test(pt.message))throw pt}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(pt=>getAddress(pt))},async getProvider({chainId:ht}={}){var mt;async function pt(){const ft=dt.chains.map(gt=>gt.id);if(!ft.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-BwINMB1n.js");return{EthereumProvider:gt}},__vite__mapDeps([6,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:ft,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=pt()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,pt]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&pt.session?(await pt.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:pt}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const ft=dt.chains.find(vt=>vt.id===pt);if(!ft)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===pt&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(pt)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,pt]),ft}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(yt=ft.blockExplorers)!=null&&yt.default.url?[(gt=ft.blockExplorers)==null?void 0:gt.default.url]:[];let wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...ft.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(pt),chainName:(ht==null?void 0:ht.chainName)??ft.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??ft.nativeCurrency,rpcUrls:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const It=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...It,pt]),ft}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(pt=>getAddress(pt))})},onChainChanged(ht){const pt=Number(ht);dt.emitter.emit("change",{chainId:pt})},async onConnect(ht){const pt=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:pt})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const pt=await this.getProvider();ot&&(pt.removeListener("accountsChanged",ot),ot=void 0),it&&(pt.removeListener("chainChanged",it),it=void 0),lt&&(pt.removeListener("disconnect",lt),lt=void 0),ct&&(pt.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),pt.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var pt,mt,ft;return tt?((ft=(mt=(pt=tt.session)==null?void 0:pt.namespaces[rt])==null?void 0:mt.accounts)==null?void 0:ft.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(!et)return!1;const ht=dt.chains.map(ft=>ft.id),pt=this.getNamespaceChainsIds();if(pt.length&&!pt.some(ft=>ht.includes(ft)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(ft=>mt.includes(ft))},async setRequestedChainsIds(ht){var pt;await((pt=dt.storage)==null?void 0:pt.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(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,pt=tt.length-1;pt>=0;pt--){var mt={};for(var ft in nt)mt[ft]=ft==="access"?{}:nt[ft];for(var ft in nt.access)mt.access[ft]=nt.access[ft];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[pt])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);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))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(pt,ft)})},mt&&(rt[pt]=mt(rt[pt])))}function at(pt,mt){try{ct(nt[pt](mt))}catch(ft){ht(ot[0][3],ft)}}function ct(pt){pt.value instanceof __await?Promise.resolve(pt.value.v).then(lt,dt):ht(ot[0][2],pt)}function lt(pt){at("next",pt)}function dt(pt){at("throw",pt)}function ht(pt,mt){pt(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[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(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}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(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,pt=0;pttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,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(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});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(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var pt in et){var mt=et[pt];if(isCSSVariable$1(pt)){it[pt]=mt;continue}var ft=numberValueTypes[pt],yt=getValueAsType(mt,ft);if(isTransformProp(pt)){if(lt=!0,st[pt]=yt,at.push(pt),!ht)continue;mt!==((rt=ft.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(pt)?(ct[pt]=yt,dt=!0):ot[pt]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}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(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,pt=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,pt,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,ft=o.style,yt=o.dimensions;mt.transform&&(yt&&(ft.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||ft.transform)&&(ft.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.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(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,pt=ht?ct:at;if(pt&&typeof pt!="boolean"&&!isAnimationControls(pt)){var mt=Array.isArray(pt)?pt:[pt];mt.forEach(function(ft){var yt=resolveVariantFromProps(o,ft);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?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(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,pt=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/pt*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,pt=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),ft=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-pt)*mt)/ft}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),pt=zero$1,mt=zero$1;function ft(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);pt=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)pt=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);pt=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return ft(),{next:yt=>{const gt=pt(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],ft()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(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=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),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=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);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>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:pt,onUpdate:mt}=o,ft=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=ft,gt,xt=0,vt=ft.duration,bt,Et=!1,wt=!0,kt;const It=detectAnimationFromOptions(ft);!((tt=(et=It).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=It(Object.assign(Object.assign({},ft),{from:nt,to:yt}));function Pt(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,pt&&pt()}function jt(){gt.stop(),ht&&ht()}function Ot(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:pt}){let mt;function ft(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:pt}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(ft(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const It=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};function lt(){var ft;(ft=at.current)===null||ft===void 0||ft.call(at),at.current=null}function dt(){var ft;return lt(),st.current=!1,(ft=ot.animationState)===null||ft===void 0||ft.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(ft,yt){dt()&&(isNodeOrChild(ot.getInstance(),ft.target)?et==null||et(ft,yt):nt==null||nt(ft,yt))}function pt(ft,yt){dt()&&(nt==null||nt(ft,yt))}function mt(ft,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",pt,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(ft,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,pt=dt.isIntersecting;if(et.isInView!==pt&&(et.isInView=pt,!(at&&!pt&&et.hasEnteredView))){pt&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,pt);var mt=tt.getProps(),ft=pt?mt.onViewportEnter:mt.onViewportLeave;ft==null||ft(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),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 o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&jt,Yt=Array.isArray(Pt)?Pt:[Pt],Ht=Yt.reduce(ot,{});Ot===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Lt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Lt){var Nt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Nt!==Gt?isKeyframesTarget(Nt)&&isKeyframesTarget(Gt)?!shallowCompare(Nt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Nt!==void 0?Zt(Qt):yt.add(Qt):Nt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=Pt,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&ft.push.apply(ft,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:It},lt)}})),!1))},bt=0;bt=3;if(!(!pt&&!mt)){var ft=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},ft),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;pt||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,pt){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(pt,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,pt);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,pt){rt.end();var mt=rt.handlers,ft=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(pt,rt.transformPagePoint),rt.history);rt.startEvent&&ft&&ft(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==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(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(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 o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],pt=dt[1];o.getValue(ht).set(pt)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(ft){return it.push(ft),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.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 pt=at(st);if(ot){var mt=0;pt=pt.replace(varToken,function(){var ft=it[mt];return mt++,ft})}return pt}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.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},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.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||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}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(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.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=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.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;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},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(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var pt=__values(st.values()),mt=pt.next();!mt.done;mt=pt.next()){var ft=mt.value;if(!ft)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=pt.return)&&ht.call(pt)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.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(),pt=onlyElements(et),mt=pt,ft=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(pt,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),ft.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(It){return reactExports.createElement(PresenceChild,{key:getChildKey(It),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},It)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=pt.map(getChildKey),Et=vt.length,wt=0;wt1&&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,ft.size?mt:mt.map(function(It){return reactExports.cloneElement(It)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** + */var h$3=reactExports,n$2=shimExports;function p$2(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}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(o,et,tt,nt,rt){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(ft){if(!ct){if(ct=!0,lt=ft,ft=nt(ft),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,ft))return dt=mt}return dt=ft}if(mt=dt,q$3(lt,ft))return mt;var pt=nt(ft);return rt!==void 0&&rt(mt,pt)?mt:(lt=ft,dt=pt)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,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=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(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:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,Or,zs,FocusManager=(zs=class extends Subscribable{constructor(){super();pn(this,Sr);pn(this,lr);pn(this,Or);un(this,Or,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){jt(this,lr)||this.setEventListener(jt(this,Or))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,Or,et),(tt=jt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){jt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof jt(this,Sr)=="boolean"?jt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,Or=new WeakMap,zs),focusManager=new FocusManager,Mr,ur,jr,Vs,OnlineManager=(Vs=class extends Subscribable{constructor(){super();pn(this,Mr,!0);pn(this,ur);pn(this,jr);un(this,jr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){jt(this,ur)||this.setEventListener(jt(this,jr))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,jr,et),(tt=jt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){jt(this,Mr)!==et&&(un(this,Mr,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return jt(this,Mr)}},Mr=new WeakMap,ur=new WeakMap,jr=new WeakMap,Vs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=pt=>{var yt;nt||(ht(new CancelledError(pt)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=pt=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,pt),rt==null||rt(),ot.resolve(pt))},ht=pt=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,pt),rt==null||rt(),ot.reject(pt))},ft=()=>new Promise(pt=>{var yt;rt=gt=>{(nt||ct())&&pt(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var pt;rt=void 0,nt||(pt=o.onContinue)==null||pt.call(o)}),mt=()=>{if(nt)return;let pt;const yt=tt===0?o.initialPromise:void 0;try{pt=yt??o.fn()}catch(gt){pt=Promise.reject(gt)}Promise.resolve(pt).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:ft()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():ft().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Hs,Removable=(Hs=class{constructor(){pn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){jt(this,kr)&&(clearTimeout(jt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Hs),Br,Dr,Un,Nn,no,Ar,Hn,tr,Ws,Query=(Ws=class extends Removable{constructor(et){super();pn(this,Hn);pn(this,Br);pn(this,Dr);pn(this,Un);pn(this,Nn);pn(this,no);pn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??jt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=jt(this,Nn))==null?void 0:et.promise}setOptions(et){this.options={...jt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&jt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=jt(this,Nn))==null?void 0:nt.promise;return(rt=jt(this,Nn))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(jt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.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(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),jt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(jt(this,Nn)&&(jt(this,Ar)?jt(this,Nn).cancel({revert:!0}):jt(this,Nn).cancelRetry()),this.scheduleGc()),jt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,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(jt(this,Nn))return jt(this,Nn).continueRetry(),jt(this,Nn).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!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};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,ft,mt,pt;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((ft=(ht=jt(this,Un).config).onError)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,Nn,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,ft,mt,pt;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(ft=(ht=jt(this,Un).config).onSuccess)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),jt(this,Nn).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,Nn=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&jt(this,Dr)?{...jt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),jt(this,Un).notify({query:this,type:"updated",action:et})})},Ws);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Gs,QueryCache=(Gs=class extends Subscribable{constructor(et={}){super();pn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){jt(this,Wn).has(et.queryHash)||(jt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=jt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&jt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return jt(this,Wn).get(et)}getAll(){return[...jt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Gs),Gn,On,Rr,qn,ar,qs,Mutation=(qs=class extends Removable{constructor(et){super();pn(this,qn);pn(this,Gn);pn(this,On);pn(this,Rr);this.mutationId=et.mutationId,un(this,On,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){jt(this,Gn).includes(et)||(jt(this,Gn).push(et),this.clearGcTimeout(),jt(this,On).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,jt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),jt(this,On).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){jt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():jt(this,On).remove(this))}continue(){var et;return((et=jt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(It,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:It,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>jt(this,On).canRun(this)}));const tt=this.state.status==="pending",nt=!jt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=jt(this,On).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const It=await jt(this,Rr).start();return await((ct=(at=jt(this,On).config).onSuccess)==null?void 0:ct.call(at,It,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,It,et,this.state.context)),await((ft=(ht=jt(this,On).config).onSettled)==null?void 0:ft.call(ht,It,null,this.state.variables,this.state.context,this)),await((pt=(mt=this.options).onSettled)==null?void 0:pt.call(mt,It,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:It}),It}catch(It){try{throw await((gt=(yt=jt(this,On).config).onError)==null?void 0:gt.call(yt,It,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,It,et,this.state.context)),await((Et=(bt=jt(this,On).config).onSettled)==null?void 0:Et.call(bt,void 0,It,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,It,et,this.state.context)),It}finally{gn(this,qn,ar).call(this,{type:"error",error:It})}}finally{jt(this,On).runNext(this)}}},Gn=new WeakMap,On=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{jt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),jt(this,On).notify({mutation:this,type:"updated",action:et})})},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 Fn,ro,Ks,MutationCache=(Ks=class extends Subscribable{constructor(et={}){super();pn(this,Fn);pn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=jt(this,Fn).get(tt)??[];nt.push(et),jt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(jt(this,Fn).has(tt)){const rt=(nt=jt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?jt(this,Fn).delete(tt):jt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...jt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ks);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,ft,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((ft=et.state.data)==null?void 0:ft.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let pt=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?pt=!0:et.signal.addEventListener("abort",()=>{pt=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(pt)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:It}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,It),pageParams:Rt(vt.pageParams,bt,It)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var pt,yt;return(yt=(pt=et.options).persister)==null?void 0:yt.call(pt,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Ln,dr,hr,Fr,Ur,fr,zr,Vr,Qs,QueryClient=(Qs=class{constructor(o={}){pn(this,Ln);pn(this,dr);pn(this,hr);pn(this,Fr);pn(this,Ur);pn(this,fr);pn(this,zr);pn(this,Vr);un(this,Ln,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,fr,0)}mount(){br(this,fr)._++,jt(this,fr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onOnline())})))}unmount(){var o,et;br(this,fr)._--,jt(this,fr)===0&&((o=jt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=jt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return jt(this,Ln).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return jt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=jt(this,Ln).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return jt(this,Ln).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=jt(this,Ln).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return jt(this,Ln).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>jt(this,Ln).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=jt(this,Ln);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=jt(this,Ln),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(jt(this,Ln).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=jt(this,Ln).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?jt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return jt(this,Ln)}getMutationCache(){return jt(this,dr)}getDefaultOptions(){return jt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){jt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...jt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){jt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...jt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...jt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...jt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){jt(this,Ln).clear(),jt(this,dr).clear()}},Ln=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,fr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Qs),jn,Sn,oo,Mn,Tr,Hr,pr,Kn,io,Wr,Gr,Ir,_r,mr,qr,In,to,Ts,Is,_s,$s,Ps,Ls,Ns,Xl,Ys,QueryObserver=(Ys=class extends Subscribable{constructor(et,tt){super();pn(this,In);pn(this,jn);pn(this,Sn);pn(this,oo);pn(this,Mn);pn(this,Tr);pn(this,Hr);pn(this,pr);pn(this,Kn);pn(this,io);pn(this,Wr);pn(this,Gr);pn(this,Ir);pn(this,_r);pn(this,mr);pn(this,qr,new Set);this.options=tt,un(this,jn,et),un(this,Kn,null),un(this,pr,pendingThenable()),this.options.experimental_prefetchInRender||jt(this,pr).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&&(jt(this,Sn).addObserver(this),shouldFetchOnMount(jt(this,Sn),this.options)?gn(this,In,to).call(this):this.updateResult(),gn(this,In,$s).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,In,Ps).call(this),gn(this,In,Ls).call(this),jt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=jt(this,Sn);if(this.options=jt(this,jn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,jt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,In,Ns).call(this),jt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&jt(this,jn).getQueryCache().notify({type:"observerOptionsUpdated",query:jt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(jt(this,Sn),rt,this.options,nt)&&gn(this,In,to).call(this),this.updateResult(tt),ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||resolveStaleTime(this.options.staleTime,jt(this,Sn))!==resolveStaleTime(nt.staleTime,jt(this,Sn)))&&gn(this,In,Ts).call(this);const it=gn(this,In,Is).call(this);ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||it!==jt(this,mr))&&gn(this,In,_s).call(this,it)}getOptimisticResult(et){const tt=jt(this,jn).getQueryCache().build(jt(this,jn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,Mn,nt),un(this,Hr,this.options),un(this,Tr,jt(this,Sn).state)),nt}getCurrentResult(){return jt(this,Mn)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){jt(this,qr).add(et)}getCurrentQuery(){return jt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=jt(this,jn).defaultQueryOptions(et),nt=jt(this,jn).getQueryCache().build(jt(this,jn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,In,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),jt(this,Mn)))}createResult(et,tt){var It;const nt=jt(this,Sn),rt=this.options,ot=jt(this,Mn),it=jt(this,Tr),st=jt(this,Hr),ct=et!==nt?et.state:jt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,ft;if(tt._optimisticResults){const Rt=this.hasListeners(),$t=!Rt&&shouldFetchOnMount(et,tt),Nt=Rt&&shouldFetchOptionally(et,nt,tt,rt);($t||Nt)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:pt,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===jt(this,io))ft=jt(this,Wr);else try{un(this,io,tt.select),ft=tt.select(dt.data),ft=replaceData(ot==null?void 0:ot.data,ft,tt),un(this,Wr,ft),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else ft=dt.data;if(tt.placeholderData!==void 0&&ft===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((It=jt(this,Gr))==null?void 0:It.state.data,jt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch($t){un(this,Kn,$t)}Rt!==void 0&&(yt="success",ft=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}jt(this,Kn)&&(mt=jt(this,Kn),ft=jt(this,Wr),pt=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=ft!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:ft,dataUpdatedAt:dt.dataUpdatedAt,error:mt,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&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:jt(this,pr)};if(this.options.experimental_prefetchInRender){const Rt=Mt=>{kt.status==="error"?Mt.reject(kt.error):kt.data!==void 0&&Mt.resolve(kt.data)},$t=()=>{const Mt=un(this,pr,kt.promise=pendingThenable());Rt(Mt)},Nt=jt(this,pr);switch(Nt.status){case"pending":et.queryHash===nt.queryHash&&Rt(Nt);break;case"fulfilled":(kt.status==="error"||kt.data!==Nt.value)&&$t();break;case"rejected":(kt.status!=="error"||kt.error!==Nt.reason)&&$t();break}}return kt}updateResult(et){const tt=jt(this,Mn),nt=this.createResult(jt(this,Sn),this.options);if(un(this,Tr,jt(this,Sn).state),un(this,Hr,this.options),jt(this,Tr).data!==void 0&&un(this,Gr,jt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,Mn,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!jt(this,qr).size)return!0;const at=new Set(st??jt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(jt(this,Mn)).some(ct=>{const lt=ct;return jt(this,Mn)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,In,Xl).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,In,$s).call(this)}},jn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,Mn=new WeakMap,Tr=new WeakMap,Hr=new WeakMap,pr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ir=new WeakMap,_r=new WeakMap,mr=new WeakMap,qr=new WeakMap,In=new WeakSet,to=function(et){gn(this,In,Ns).call(this);let tt=jt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Ts=function(){gn(this,In,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,jt(this,Sn));if(isServer||jt(this,Mn).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(jt(this,Mn).dataUpdatedAt,et)+1;un(this,Ir,setTimeout(()=>{jt(this,Mn).isStale||this.updateResult()},nt))},Is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(jt(this,Sn)):this.options.refetchInterval)??!1},_s=function(et){gn(this,In,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,jt(this,Sn))===!1||!isValidTimeout(jt(this,mr))||jt(this,mr)===0)&&un(this,_r,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,In,to).call(this)},jt(this,mr)))},$s=function(){gn(this,In,Ts).call(this),gn(this,In,_s).call(this,gn(this,In,Is).call(this))},Ps=function(){jt(this,Ir)&&(clearTimeout(jt(this,Ir)),un(this,Ir,void 0))},Ls=function(){jt(this,_r)&&(clearInterval(jt(this,_r)),un(this,_r,void 0))},Ns=function(){const et=jt(this,jn).getQueryCache().build(jt(this,jn),this.options);if(et===jt(this,Sn))return;const tt=jt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Xl=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(jt(this,Mn))}),jt(this,jn).getQueryCache().notify({query:jt(this,Sn),type:"observerResultsUpdated"})})},Ys);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,Os,Zs,MutationObserver$1=(Zs=class extends Subscribable{constructor(tt,nt){super();pn(this,sr);pn(this,gr);pn(this,yr);pn(this,Bn);pn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=jt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||jt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:jt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=jt(this,Bn))==null?void 0:rt.state.status)==="pending"&&jt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=jt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this,tt)}getCurrentResult(){return jt(this,yr)}reset(){var tt;(tt=jt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=jt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,jt(this,gr).getMutationCache().build(jt(this,gr),this.options)),jt(this,Bn).addObserver(this),jt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=jt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...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 nt,rt,ot,it,st,at,ct,lt;if(jt(this,rr)&&this.hasListeners()){const dt=jt(this,yr).variables,ht=jt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=jt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=jt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=jt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=jt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(jt(this,yr))})})},Zs);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:ft,retryDelay:mt,structuralSharing:pt,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:It,refetchOnMount:Rt,refetchOnReconnect:$t,refetchOnWindowFocus:Nt,retryOnMount:Mt,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Pt}=o;return Pt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,ft,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(pt=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),yt},[at,rt]),()=>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:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((ft=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||ft.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const pt=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;pt==null||pt.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,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(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});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(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.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));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),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();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=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 at=await __vitePreload(()=>import("./index-yzjEDxfO.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,ft,mt;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;(ft=st==null?void 0:st.rpcUrls)!=null&&ft.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={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:[xt]}),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();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,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));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),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(ft=>{if(ft.code===UserRejectedRequestError.code)throw ft;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();rt&&(at.removeListener("accountsChanged",rt),rt=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(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:pt}=await import("./index-CTvXdnRL.js").then(yt=>yt.i);return{default:pt}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),ft=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(ft,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,ft,mt,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?[(ft=lt.blockExplorers)==null?void 0:ft.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((pt=lt.rpcUrls.default)==null?void 0:pt.http[0])??""];const vt={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:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),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();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({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 nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.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;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.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-s1Uh1I2b.js").then(dt=>dt.e);return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-Drc-C73D.js").then(dt=>dt.i),__vite__mapDeps([5,6,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();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 et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="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,...ft}={}){var mt,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((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.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 xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in ft?{pairingTopic:ft.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=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:vt,chainId:bt}}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(ft){if(!/No matching key/i.test(ft.message))throw ft}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(ft=>getAddress(ft))},async getProvider({chainId:ht}={}){var mt;async function ft(){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-D5UVwycq.js");return{EthereumProvider:gt}},__vite__mapDeps([7,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:pt,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=ft()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,ft]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&ft.session?(await ft.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:ft}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const pt=dt.chains.find(vt=>vt.id===ft);if(!pt)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===ft&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ft)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,ft]),pt}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);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 wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...pt.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(ft),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:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const It=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...It,ft]),pt}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(ft=>getAddress(ft))})},onChainChanged(ht){const ft=Number(ht);dt.emitter.emit("change",{chainId:ft})},async onConnect(ht){const ft=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:ft})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const ft=await this.getProvider();ot&&(ft.removeListener("accountsChanged",ot),ot=void 0),it&&(ft.removeListener("chainChanged",it),it=void 0),lt&&(ft.removeListener("disconnect",lt),lt=void 0),ct&&(ft.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),ft.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var ft,mt,pt;return tt?((pt=(mt=(ft=tt.session)==null?void 0:ft.namespaces[rt])==null?void 0:mt.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(!et)return!1;const ht=dt.chains.map(pt=>pt.id),ft=this.getNamespaceChainsIds();if(ft.length&&!ft.some(pt=>ht.includes(pt)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(pt=>mt.includes(pt))},async setRequestedChainsIds(ht){var ft;await((ft=dt.storage)==null?void 0:ft.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(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,ft=tt.length-1;ft>=0;ft--){var mt={};for(var pt in nt)mt[pt]=pt==="access"?{}:nt[pt];for(var pt in nt.access)mt.access[pt]=nt.access[pt];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[ft])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);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))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(ft,pt)})},mt&&(rt[ft]=mt(rt[ft])))}function at(ft,mt){try{ct(nt[ft](mt))}catch(pt){ht(ot[0][3],pt)}}function ct(ft){ft.value instanceof __await?Promise.resolve(ft.value.v).then(lt,dt):ht(ot[0][2],ft)}function lt(ft){at("next",ft)}function dt(ft){at("throw",ft)}function ht(ft,mt){ft(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[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(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}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(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,ft=0;fttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,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(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});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(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var ft in et){var mt=et[ft];if(isCSSVariable$1(ft)){it[ft]=mt;continue}var pt=numberValueTypes[ft],yt=getValueAsType(mt,pt);if(isTransformProp(ft)){if(lt=!0,st[ft]=yt,at.push(ft),!ht)continue;mt!==((rt=pt.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(ft)?(ct[ft]=yt,dt=!0):ot[ft]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}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(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,ft=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,ft,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,pt=o.style,yt=o.dimensions;mt.transform&&(yt&&(pt.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||pt.transform)&&(pt.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.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(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,ft=ht?ct:at;if(ft&&typeof ft!="boolean"&&!isAnimationControls(ft)){var mt=Array.isArray(ft)?ft:[ft];mt.forEach(function(pt){var yt=resolveVariantFromProps(o,pt);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?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(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,ft=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/ft*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,ft=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),pt=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-ft)*mt)/pt}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),ft=zero$1,mt=zero$1;function pt(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);ft=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)ft=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);ft=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return pt(),{next:yt=>{const gt=ft(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],pt()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(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=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),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=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);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>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:ft,onUpdate:mt}=o,pt=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=pt,gt,xt=0,vt=pt.duration,bt,Et=!1,wt=!0,kt;const It=detectAnimationFromOptions(pt);!((tt=(et=It).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=It(Object.assign(Object.assign({},pt),{from:nt,to:yt}));function $t(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,ft&&ft()}function Nt(){gt.stop(),ht&&ht()}function Mt(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:ft}){let mt;function pt(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:ft}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(pt(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const It=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};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)?et==null||et(pt,yt):nt==null||nt(pt,yt))}function ft(pt,yt){dt()&&(nt==null||nt(pt,yt))}function mt(pt,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",ft,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(pt,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,ft=dt.isIntersecting;if(et.isInView!==ft&&(et.isInView=ft,!(at&&!ft&&et.hasEnteredView))){ft&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,ft);var mt=tt.getProps(),pt=ft?mt.onViewportEnter:mt.onViewportLeave;pt==null||pt(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),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 o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&Nt,Yt=Array.isArray($t)?$t:[$t],Ht=Yt.reduce(ot,{});Mt===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Pt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Pt){var Lt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Lt!==Gt?isKeyframesTarget(Lt)&&isKeyframesTarget(Gt)?!shallowCompare(Lt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Lt!==void 0?Zt(Qt):yt.add(Qt):Lt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=$t,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&pt.push.apply(pt,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:It},lt)}})),!1))},bt=0;bt=3;if(!(!ft&&!mt)){var pt=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},pt),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;ft||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,ft){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(ft,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,ft);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,ft){rt.end();var mt=rt.handlers,pt=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(ft,rt.transformPagePoint),rt.history);rt.startEvent&&pt&&pt(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==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(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(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 o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],ft=dt[1];o.getValue(ht).set(ft)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(pt){return it.push(pt),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.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 ft=at(st);if(ot){var mt=0;ft=ft.replace(varToken,function(){var pt=it[mt];return mt++,pt})}return ft}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.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},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.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||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}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(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.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=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.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;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},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(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var ft=__values(st.values()),mt=ft.next();!mt.done;mt=ft.next()){var pt=mt.value;if(!pt)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=ft.return)&&ht.call(ft)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.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(),ft=onlyElements(et),mt=ft,pt=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(ft,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),pt.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(It){return reactExports.createElement(PresenceChild,{key:getChildKey(It),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},It)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=ft.map(getChildKey),Et=vt.length,wt=0;wt1&&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?mt:mt.map(function(It){return reactExports.cloneElement(It)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** * @license React * react-is.production.min.js * @@ -100,7 +100,7 @@ ${prettyStateOverride(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMes * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var b$2=Symbol.for("react.element"),c$1=Symbol.for("react.portal"),d$2=Symbol.for("react.fragment"),e$1=Symbol.for("react.strict_mode"),f$1=Symbol.for("react.profiler"),g$2=Symbol.for("react.provider"),h$2=Symbol.for("react.context"),k$2=Symbol.for("react.server_context"),l$1=Symbol.for("react.forward_ref"),m$3=Symbol.for("react.suspense"),n$1=Symbol.for("react.suspense_list"),p$1=Symbol.for("react.memo"),q$2=Symbol.for("react.lazy"),t$1=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");function v$2(o){if(typeof o=="object"&&o!==null){var et=o.$$typeof;switch(et){case b$2:switch(o=o.type,o){case d$2:case f$1:case e$1:case m$3:case n$1:return o;default:switch(o=o&&o.$$typeof,o){case k$2:case h$2:case l$1:case q$2:case p$1:case g$2:return o;default:return et}}case c$1:return et}}}reactIs_production_min$1.ContextConsumer=h$2;reactIs_production_min$1.ContextProvider=g$2;reactIs_production_min$1.Element=b$2;reactIs_production_min$1.ForwardRef=l$1;reactIs_production_min$1.Fragment=d$2;reactIs_production_min$1.Lazy=q$2;reactIs_production_min$1.Memo=p$1;reactIs_production_min$1.Portal=c$1;reactIs_production_min$1.Profiler=f$1;reactIs_production_min$1.StrictMode=e$1;reactIs_production_min$1.Suspense=m$3;reactIs_production_min$1.SuspenseList=n$1;reactIs_production_min$1.isAsyncMode=function(){return!1};reactIs_production_min$1.isConcurrentMode=function(){return!1};reactIs_production_min$1.isContextConsumer=function(o){return v$2(o)===h$2};reactIs_production_min$1.isContextProvider=function(o){return v$2(o)===g$2};reactIs_production_min$1.isElement=function(o){return typeof o=="object"&&o!==null&&o.$$typeof===b$2};reactIs_production_min$1.isForwardRef=function(o){return v$2(o)===l$1};reactIs_production_min$1.isFragment=function(o){return v$2(o)===d$2};reactIs_production_min$1.isLazy=function(o){return v$2(o)===q$2};reactIs_production_min$1.isMemo=function(o){return v$2(o)===p$1};reactIs_production_min$1.isPortal=function(o){return v$2(o)===c$1};reactIs_production_min$1.isProfiler=function(o){return v$2(o)===f$1};reactIs_production_min$1.isStrictMode=function(o){return v$2(o)===e$1};reactIs_production_min$1.isSuspense=function(o){return v$2(o)===m$3};reactIs_production_min$1.isSuspenseList=function(o){return v$2(o)===n$1};reactIs_production_min$1.isValidElementType=function(o){return typeof o=="string"||typeof o=="function"||o===d$2||o===f$1||o===e$1||o===m$3||o===n$1||o===t$1||typeof o=="object"&&o!==null&&(o.$$typeof===q$2||o.$$typeof===p$1||o.$$typeof===g$2||o.$$typeof===h$2||o.$$typeof===l$1||o.$$typeof===u||o.getModuleId!==void 0)};reactIs_production_min$1.typeOf=v$2;reactIs$2.exports=reactIs_production_min$1;var reactIsExports$1=reactIs$2.exports;function stylis_min(o){function et(Qt,Nt,Gt,nn,Wt){for(var hn=0,Xt=0,Jt=0,tn=0,_t,Dt,Vt=0,en=0,an,dn=an=_t=0,ln=0,pn=0,kn=0,mn=0,wn=Gt.length,Tn=wn-1,Pn,yn="",En="",on="",Tt="",St;ln_t)&&(mn=(yn=yn.replace(" ",":")).length),0nn&&(nn=(Nt=Nt.trim()).charCodeAt(0)),nn){case 38:return Nt.replace(gt,"$1"+Qt.trim());case 58:return Qt.trim()+Nt.replace(gt,"$1"+Qt.trim());default:if(0<1*Gt&&0Xt.charCodeAt(8))break;case 115:Wt=Wt.replace(Xt,"-webkit-"+Xt)+";"+Wt;break;case 207:case 102:Wt=Wt.replace(Xt,"-webkit-"+(102Gt.charCodeAt(0)&&(Gt=Gt.trim()),Zt=Gt,Gt=[Zt],0Tt)&&(mn=(yn=yn.replace(" ",":")).length),0nn&&(nn=(Lt=Lt.trim()).charCodeAt(0)),nn){case 38:return Lt.replace(gt,"$1"+Qt.trim());case 58:return Qt.trim()+Lt.replace(gt,"$1"+Qt.trim());default:if(0<1*Gt&&0Xt.charCodeAt(8))break;case 115:Wt=Wt.replace(Xt,"-webkit-"+Xt)+";"+Wt;break;case 207:case 102:Wt=Wt.replace(Xt,"-webkit-"+(102Gt.charCodeAt(0)&&(Gt=Gt.trim()),Zt=Gt,Gt=[Zt],01?et-1:0),nt=1;nt0?" Args: "+tt.join(", "):""))}var j=function(){function o(tt){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=tt}var et=o.prototype;return et.indexOfGroup=function(tt){for(var nt=0,rt=0;rt=this.groupSizes.length){for(var rt=this.groupSizes,ot=rt.length,it=ot;tt>=it;)(it<<=1)<0&&D(16,""+tt);this.groupSizes=new Uint32Array(it),this.groupSizes.set(rt),this.length=it;for(var st=ot;st=this.length||this.groupSizes[tt]===0)return nt;for(var rt=this.groupSizes[tt],ot=this.indexOfGroup(tt),it=ot+rt,st=ot;st=k&&(k=et+1),T.set(o,et),x.set(et,o)},M="style["+N+'][data-styled-version="5.3.11"]',G=new RegExp("^"+N+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),L=function(o,et,tt){for(var nt,rt=tt.split(","),ot=0,it=rt.length;ot=0;ct--){var lt=at[ct];if(lt&<.nodeType===1&<.hasAttribute(N))return lt}}(tt),ot=rt!==void 0?rt.nextSibling:null;nt.setAttribute(N,"active"),nt.setAttribute("data-styled-version","5.3.11");var it=Y();return it&&nt.setAttribute("nonce",it),tt.insertBefore(nt,ot),nt},H=function(){function o(tt){var nt=this.element=q(tt);nt.appendChild(document.createTextNode("")),this.sheet=function(rt){if(rt.sheet)return rt.sheet;for(var ot=document.styleSheets,it=0,st=ot.length;it=0){var rt=document.createTextNode(nt),ot=this.nodes[tt];return this.element.insertBefore(rt,ot||null),this.length++,!0}return!1},et.deleteRule=function(tt){this.element.removeChild(this.nodes[tt]),this.length--},et.getRule=function(tt){return tt0&&(dt+=ht+",")}),ot+=""+ct+lt+'{content:"'+dt+`"}/*!sc*/ -`}}}return ot}(this)},o}(),Z=/(a)(d)/gi,K=function(o){return String.fromCharCode(o+(o>25?39:97))};function Q(o){var et,tt="";for(et=Math.abs(o);et>52;et=et/52|0)tt=K(et%52)+tt;return(K(et%52)+tt).replace(Z,"$1-$2")}var ee=function(o,et){for(var tt=et.length;tt;)o=33*o^et.charCodeAt(--tt);return o},te=function(o){return ee(5381,o)};function ne(o){for(var et=0;et>>0);if(!tt.hasNameForId(rt,st)){var at=nt(it,"."+st,void 0,rt);tt.insertRules(rt,st,at)}ot.push(st),this.staticRulesId=st}else{for(var ct=this.rules.length,lt=ee(this.baseHash,nt.hash),dt="",ht=0;ht>>0);if(!tt.hasNameForId(rt,yt)){var gt=nt(dt,"."+yt,void 0,rt);tt.insertRules(rt,yt,gt)}ot.push(yt)}}return ot.join(" ")},o}(),se=/^\s*\/\/.*$/gm,ie=[":","[",".","#"];function ae(o){var et,tt,nt,rt,ot=w$1,it=ot.options,st=it===void 0?w$1:it,at=ot.plugins,ct=at===void 0?S:at,lt=new stylis_min(st),dt=[],ht=function(ft){function yt(gt){if(gt)try{ft(gt+"}")}catch{}}return function(gt,xt,vt,bt,Et,wt,kt,It,Rt,Pt){switch(gt){case 1:if(Rt===0&&xt.charCodeAt(0)===64)return ft(xt+";"),"";break;case 2:if(It===0)return xt+"/*|*/";break;case 3:switch(It){case 102:case 112:return ft(vt[0]+xt),"";default:return xt+(Pt===0?"/*|*/":"")}case-2:xt.split("/*|*/}").forEach(yt)}}}(function(ft){dt.push(ft)}),pt=function(ft,yt,gt){return yt===0&&ie.indexOf(gt[tt.length])!==-1||gt.match(rt)?ft:"."+et};function mt(ft,yt,gt,xt){xt===void 0&&(xt="&");var vt=ft.replace(se,""),bt=yt&>?gt+" "+yt+" { "+vt+" }":vt;return et=xt,tt=yt,nt=new RegExp("\\"+tt+"\\b","g"),rt=new RegExp("(\\"+tt+"\\b){2,}"),lt(gt||!yt?"":yt,bt)}return lt.use([].concat(ct,[function(ft,yt,gt){ft===2&>.length&>[0].lastIndexOf(tt)>0&&(gt[0]=gt[0].replace(nt,pt))},ht,function(ft){if(ft===-2){var yt=dt;return dt=[],yt}}])),mt.hash=ct.length?ct.reduce(function(ft,yt){return yt.name||D(15),ee(ft,yt.name)},5381).toString():"",mt}var ce=React.createContext();ce.Consumer;var le=React.createContext(),de=(le.Consumer,new X),he=ae();function pe(){return reactExports.useContext(ce)||de}function fe(){return reactExports.useContext(le)||he}var ye=function(){function o(et,tt){var nt=this;this.inject=function(rt,ot){ot===void 0&&(ot=he);var it=nt.name+ot.hash;rt.hasNameForId(nt.id,it)||rt.insertRules(nt.id,it,ot(nt.rules,it,"@keyframes"))},this.toString=function(){return D(12,String(nt.name))},this.name=et,this.id="sc-keyframes-"+et,this.rules=tt}return o.prototype.getName=function(et){return et===void 0&&(et=he),this.name+et.hash},o}(),ve=/([A-Z])/,ge=/([A-Z])/g,Se=/^ms-/,we=function(o){return"-"+o.toLowerCase()};function Ee(o){return ve.test(o)?o.replace(ge,we).replace(Se,"-ms-"):o}var be=function(o){return o==null||o===!1||o===""};function _e(o,et,tt,nt){if(Array.isArray(o)){for(var rt,ot=[],it=0,st=o.length;it1?et-1:0),nt=1;nt?@[\\\]^`{|}~-]+/g,De=/(^-|-$)/g;function je(o){return o.replace(Re,"-").replace(De,"")}var Te=function(o){return Q(te(o)>>>0)};function xe(o){return typeof o=="string"&&!0}var ke=function(o){return typeof o=="function"||typeof o=="object"&&o!==null&&!Array.isArray(o)},Ve=function(o){return o!=="__proto__"&&o!=="constructor"&&o!=="prototype"};function Be(o,et,tt){var nt=o[tt];ke(et)&&ke(nt)?ze(nt,et):o[tt]=et}function ze(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt=0||(Pt[It]=wt[It]);return Pt}(et,["componentId"]),Et=vt&&vt+"-"+(xe(xt)?xt:je(b(xt)));return Ye(xt,y$1({},bt,{attrs:ht,componentId:Et}),tt)},Object.defineProperty(mt,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(xt){this._foldedDefaultProps=nt?ze({},o.defaultProps,xt):xt}}),Object.defineProperty(mt,"toString",{value:function(){return"."+mt.styledComponentId}}),rt&&m$1(mt,o,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),mt}var qe=function(o){return function et(tt,nt,rt){if(rt===void 0&&(rt=w$1),!reactIsExports$1.isValidElementType(nt))return D(1,String(nt));var ot=function(){return tt(nt,rt,Ae.apply(void 0,arguments))};return ot.withConfig=function(it){return et(tt,nt,y$1({},rt,{},it))},ot.attrs=function(it){return et(tt,nt,y$1({},rt,{attrs:Array.prototype.concat(rt.attrs,it).filter(Boolean)}))},ot}(Ye,o)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(o){qe[o]=qe(o)});function We(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt>--at&1}const dt=31,ht=2**dt,pt=ht>>>1,mt=pt>>1,ft=ht-1;let yt=0;for(let Et=0;Et1;){let Pt=wt+kt>>>1;Et>>1|lt(),It=It<<1^pt,Rt=(Rt^pt)<<1|pt|1;xt=It,vt=1+Rt-It}let bt=nt-4;return gt.map(Et=>{switch(Et-bt){case 3:return bt+65792+(o[st++]<<16|o[st++]<<8|o[st++]);case 2:return bt+256+(o[st++]<<8|o[st++]);case 1:return bt+o[st++];default:return Et-1}})}function read_payload(o){let et=0;return()=>o[et++]}function read_compressed_payload(o){return read_payload(decode_arithmetic(unsafe_atob(o)))}function unsafe_atob(o){let et=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((rt,ot)=>et[rt.charCodeAt(0)]=ot);let tt=o.length,nt=new Uint8Array(6*tt>>3);for(let rt=0,ot=0,it=0,st=0;rt=8&&(nt[ot++]=st>>(it-=8));return nt}function signed(o){return o&1?~o>>1:o>>1}function read_deltas(o,et){let tt=Array(o);for(let nt=0,rt=0;nt{let et=read_sorted(o);if(et.length)return et})}function read_mapped(o){let et=[];for(;;){let tt=o();if(tt==0)break;et.push(read_linear_table(tt,o))}for(;;){let tt=o()-1;if(tt<0)break;et.push(read_replacement_table(tt,o))}return et.flat()}function read_array_while(o){let et=[];for(;;){let tt=o(et.length);if(!tt)break;et.push(tt)}return et}function read_transposed(o,et,tt){let nt=Array(o).fill().map(()=>[]);for(let rt=0;rtnt[it].push(ot));return nt}function read_linear_table(o,et){let tt=1+et(),nt=et(),rt=read_array_while(et);return read_transposed(rt.length,1+o,et).flatMap((it,st)=>{let[at,...ct]=it;return Array(rt[st]).fill().map((lt,dt)=>{let ht=dt*nt;return[at+dt*tt,ct.map(pt=>pt+ht)]})})}function read_replacement_table(o,et){let tt=1+et();return read_transposed(tt,1+o,et).map(rt=>[rt[0],rt.slice(1)])}function read_trie(o){let et=[],tt=read_sorted(o);return rt(nt([]),[]),et;function nt(ot){let it=o(),st=read_array_while(()=>{let at=read_sorted(o).map(ct=>tt[ct]);if(at.length)return nt(at)});return{S:it,B:st,Q:ot}}function rt({S:ot,B:it},st,at){if(!(ot&4&&at===st[st.length-1])){ot&2&&(at=st[st.length-1]),ot&1&&et.push(st);for(let ct of it)for(let lt of ct.Q)rt(ct,[...st,lt],at)}}}function hex_cp(o){return o.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(o){return`{${hex_cp(o)}}`}function explode_cp(o){let et=[];for(let tt=0,nt=o.length;tt>24&255}function unpack_cp(o){return o&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let o=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(o).flatMap((et,tt)=>et.map(nt=>[nt,tt+1<<24]))),EXCLUSIONS=new Set(read_sorted(o)),DECOMP=new Map,RECOMP=new Map;for(let[et,tt]of read_mapped(o)){if(!EXCLUSIONS.has(et)&&tt.length==2){let[nt,rt]=tt,ot=RECOMP.get(nt);ot||(ot=new Map,RECOMP.set(nt,ot)),ot.set(rt,et)}DECOMP.set(et,tt.reverse())}}function is_hangul(o){return o>=S0&&o=L0&&o=V0&&etT0&&et0&&rt(T0+ct)}else{let it=DECOMP.get(ot);it?tt.push(...it):rt(ot)}if(!tt.length)break;ot=tt.pop()}if(nt&&et.length>1){let ot=unpack_cc(et[0]);for(let it=1;it0&&rt>=it)it==0?(et.push(nt,...tt),tt.length=0,nt=st):tt.push(st),rt=it;else{let at=compose_pair(nt,st);at>=0?nt=at:rt==0&&it==0?(et.push(nt),nt=st):(tt.push(st),rt=it)}}return nt>=0&&et.push(nt,...tt),et}function nfd(o){return decomposed(o).map(unpack_cp)}function nfc(o){return composed_from_decomposed(decomposed(o))}const HYPHEN=45,STOP_CH=".",FE0F=65039,UNIQUE_PH=1,Array_from=o=>Array.from(o);function group_has_cp(o,et){return o.P.has(et)||o.Q.has(et)}class Emoji extends Array{get is_emoji(){return!0}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let o=read_compressed_payload(COMPRESSED$1);const et=()=>read_sorted(o),tt=()=>new Set(et()),nt=(lt,dt)=>dt.forEach(ht=>lt.add(ht));MAPPED=new Map(read_mapped(o)),IGNORED=tt(),CM=et(),NSM=new Set(et().map(lt=>CM[lt])),CM=new Set(CM),ESCAPE=tt(),tt();let rt=read_sorted_arrays(o),ot=o();const it=()=>{let lt=new Set;return et().forEach(dt=>nt(lt,rt[dt])),nt(lt,et()),lt};GROUPS=read_array_while(lt=>{let dt=read_array_while(o).map(ht=>ht+96);if(dt.length){let ht=lt>=ot;dt[0]-=32,dt=str_from_cps(dt),ht&&(dt=`Restricted[${dt}]`);let pt=it(),mt=it(),ft=!o();return{N:dt,P:pt,Q:mt,M:ft,R:ht}}}),WHOLE_VALID=tt(),WHOLE_MAP=new Map;let st=et().concat(Array_from(WHOLE_VALID)).sort((lt,dt)=>lt-dt);st.forEach((lt,dt)=>{let ht=o(),pt=st[dt]=ht?st[dt-ht]:{V:[],M:new Map};pt.V.push(lt),WHOLE_VALID.has(lt)||WHOLE_MAP.set(lt,pt)});for(let{V:lt,M:dt}of new Set(WHOLE_MAP.values())){let ht=[];for(let mt of lt){let ft=GROUPS.filter(gt=>group_has_cp(gt,mt)),yt=ht.find(({G:gt})=>ft.some(xt=>gt.has(xt)));yt||(yt={G:new Set,V:[]},ht.push(yt)),yt.V.push(mt),nt(yt.G,ft)}let pt=ht.flatMap(mt=>Array_from(mt.G));for(let{G:mt,V:ft}of ht){let yt=new Set(pt.filter(gt=>!mt.has(gt)));for(let gt of ft)dt.set(gt,yt)}}VALID=new Set;let at=new Set;const ct=lt=>VALID.has(lt)?at.add(lt):VALID.add(lt);for(let lt of GROUPS){for(let dt of lt.P)ct(dt);for(let dt of lt.Q)ct(dt)}for(let lt of VALID)!WHOLE_MAP.has(lt)&&!at.has(lt)&&WHOLE_MAP.set(lt,UNIQUE_PH);nt(VALID,nfd(VALID)),EMOJI_LIST=read_trie(o).map(lt=>Emoji.from(lt)).sort(compare_arrays),EMOJI_ROOT=new Map;for(let lt of EMOJI_LIST){let dt=[EMOJI_ROOT];for(let ht of lt){let pt=dt.map(mt=>{let ft=mt.get(ht);return ft||(ft=new Map,mt.set(ht,ft)),ft});ht===FE0F?dt.push(...pt):dt=pt}for(let ht of dt)ht.V=lt}}function quoted_cp(o){return(should_escape(o)?"":`${bidi_qq(safe_str_from_cps([o]))} `)+quote_cp(o)}function bidi_qq(o){return`"${o}"‎`}function check_label_extension(o){if(o.length>=4&&o[2]==HYPHEN&&o[3]==HYPHEN)throw new Error(`invalid label extension: "${str_from_cps(o.slice(0,4))}"`)}function check_leading_underscore(o){for(let tt=o.lastIndexOf(95);tt>0;)if(o[--tt]!==95)throw new Error("underscore allowed only at start")}function check_fenced(o){let et=o[0],tt=FENCED.get(et);if(tt)throw error_placement(`leading ${tt}`);let nt=o.length,rt=-1;for(let ot=1;otet&&(et>>=1,o=[...o.slice(0,et),8230,...o.slice(-et)]);let rt=0,ot=o.length;for(let it=0;it{let ot=explode_cp(rt),it={input:ot,offset:nt};nt+=ot.length+1;try{let st=it.tokens=tokens_from_str(ot,et,tt),at=st.length,ct;if(!at)throw new Error("empty label");let lt=it.output=st.flat();if(check_leading_underscore(lt),!(it.emoji=at>1||st[0].is_emoji)&<.every(ht=>ht<128))check_label_extension(lt),ct="ASCII";else{let ht=st.flatMap(pt=>pt.is_emoji?[]:pt);if(!ht.length)ct="Emoji";else{if(CM.has(lt[0]))throw error_placement("leading combining mark");for(let ft=1;ftit.has(st)):Array_from(it),!tt.length)return}else nt.push(rt)}if(tt){for(let rt of tt)if(nt.every(ot=>group_has_cp(rt,ot)))throw new Error(`whole-script confusable: ${o.N}/${rt.N}`)}}function determine_group(o){let et=GROUPS;for(let tt of o){let nt=et.filter(rt=>group_has_cp(rt,tt));if(!nt.length)throw GROUPS.some(rt=>group_has_cp(rt,tt))?error_group_member(et[0],tt):error_disallowed(tt);if(et=nt,nt.length==1)break}return et}function flatten$1(o){return o.map(({input:et,error:tt,output:nt})=>{if(tt){let rt=tt.message;throw new Error(o.length==1?rt:`Invalid label ${bidi_qq(safe_str_from_cps(et,63))}: ${rt}`)}return str_from_cps(nt)}).join(STOP_CH)}function error_disallowed(o){return new Error(`disallowed character: ${quoted_cp(o)}`)}function error_group_member(o,et){let tt=quoted_cp(et),nt=GROUPS.find(rt=>rt.P.has(et));return nt&&(tt=`${nt.N} ${tt}`),new Error(`illegal mixture: ${o.N} + ${tt}`)}function error_placement(o){return new Error(`illegal placement: ${o}`)}function check_group(o,et){for(let tt of et)if(!group_has_cp(o,tt))throw error_group_member(o,tt);if(o.M){let tt=nfd(et);for(let nt=1,rt=tt.length;ntNSM_MAX)throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(tt.slice(nt-1,ot)))} (${ot-nt}/${NSM_MAX})`);nt=ot}}}function tokens_from_str(o,et,tt){let nt=[],rt=[];for(o=o.slice().reverse();o.length;){let ot=consume_emoji_reversed(o);if(ot)rt.length&&(nt.push(et(rt)),rt=[]),nt.push(tt(ot));else{let it=o.pop();if(VALID.has(it))rt.push(it);else{let st=MAPPED.get(it);if(st)rt.push(...st);else if(!IGNORED.has(it))throw error_disallowed(it)}}}return rt.length&&nt.push(et(rt)),nt}function filter_fe0f(o){return o.filter(et=>et!=FE0F)}function consume_emoji_reversed(o,et){let tt=EMOJI_ROOT,nt,rt=o.length;for(;rt&&(tt=tt.get(o[--rt]),!!tt);){let{V:ot}=tt;ot&&(nt=ot,o.length=rt)}return nt}const[SHA512_Kh,SHA512_Kl]=u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),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:et,Al:tt,Bh:nt,Bl:rt,Ch:ot,Cl:it,Dh:st,Dl:at,Eh:ct,El:lt,Fh:dt,Fl:ht,Gh:pt,Gl:mt,Hh:ft,Hl:yt}=this;return[et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt]}set(et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt){this.Ah=et|0,this.Al=tt|0,this.Bh=nt|0,this.Bl=rt|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=pt|0,this.Gl=mt|0,this.Hh=ft|0,this.Hl=yt|0}process(et,tt){for(let vt=0;vt<16;vt++,tt+=4)SHA512_W_H[vt]=et.getUint32(tt),SHA512_W_L[vt]=et.getUint32(tt+=4);for(let vt=16;vt<80;vt++){const bt=SHA512_W_H[vt-15]|0,Et=SHA512_W_L[vt-15]|0,wt=u64.rotrSH(bt,Et,1)^u64.rotrSH(bt,Et,8)^u64.shrSH(bt,Et,7),kt=u64.rotrSL(bt,Et,1)^u64.rotrSL(bt,Et,8)^u64.shrSL(bt,Et,7),It=SHA512_W_H[vt-2]|0,Rt=SHA512_W_L[vt-2]|0,Pt=u64.rotrSH(It,Rt,19)^u64.rotrBH(It,Rt,61)^u64.shrSH(It,Rt,6),jt=u64.rotrSL(It,Rt,19)^u64.rotrBL(It,Rt,61)^u64.shrSL(It,Rt,6),Ot=u64.add4L(kt,jt,SHA512_W_L[vt-7],SHA512_W_L[vt-16]),Bt=u64.add4H(Ot,wt,Pt,SHA512_W_H[vt-7],SHA512_W_H[vt-16]);SHA512_W_H[vt]=Bt|0,SHA512_W_L[vt]=Ot|0}let{Ah:nt,Al:rt,Bh:ot,Bl:it,Ch:st,Cl:at,Dh:ct,Dl:lt,Eh:dt,El:ht,Fh:pt,Fl:mt,Gh:ft,Gl:yt,Hh:gt,Hl:xt}=this;for(let vt=0;vt<80;vt++){const bt=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),wt=dt&pt^~dt&ft,kt=ht&mt^~ht&yt,It=u64.add5L(xt,Et,kt,SHA512_Kl[vt],SHA512_W_L[vt]),Rt=u64.add5H(It,gt,bt,wt,SHA512_Kh[vt],SHA512_W_H[vt]),Pt=It|0,jt=u64.rotrSH(nt,rt,28)^u64.rotrBH(nt,rt,34)^u64.rotrBH(nt,rt,39),Ot=u64.rotrSL(nt,rt,28)^u64.rotrBL(nt,rt,34)^u64.rotrBL(nt,rt,39),Bt=nt&ot^nt&st^ot&st,zt=rt&it^rt&at^it&at;gt=ft|0,xt=yt|0,ft=pt|0,yt=mt|0,pt=dt|0,mt=ht|0,{h:dt,l:ht}=u64.add(ct|0,lt|0,Rt|0,Pt|0),ct=st|0,lt=at|0,st=ot|0,at=it|0,ot=nt|0,it=rt|0;const Ft=u64.add3L(Pt,Ot,zt);nt=u64.add3H(Ft,Rt,jt,Bt),rt=Ft|0}({h:nt,l:rt}=u64.add(this.Ah|0,this.Al|0,nt|0,rt|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:pt,l:mt}=u64.add(this.Fh|0,this.Fl|0,pt|0,mt|0),{h:ft,l:yt}=u64.add(this.Gh|0,this.Gl|0,ft|0,yt|0),{h:gt,l:xt}=u64.add(this.Hh|0,this.Hl|0,gt|0,xt|0),this.set(nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt)}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);function normalize$3(o){return ens_normalize(o)}normalize$3.parseError=o=>o;function normalize$2(o){return normalize$3(o)}function debounce$1(o,et,tt){var nt,rt,ot,it,st;et==null&&(et=100);function at(){var lt=Date.now()-it;lt=0?nt=setTimeout(at,et-lt):(nt=null,tt||(st=o.apply(ot,rt),ot=rt=null))}var ct=function(){ot=this,rt=arguments,it=Date.now();var lt=tt&&!nt;return nt||(nt=setTimeout(at,et)),lt&&(st=o.apply(ot,rt),ot=rt=null),st};return ct.clear=function(){nt&&(clearTimeout(nt),nt=null)},ct.flush=function(){nt&&(st=o.apply(ot,rt),ot=rt=null,clearTimeout(nt),nt=null)},ct}debounce$1.debounce=debounce$1;var debounce_1=debounce$1;const createDebounce=getDefaultExportFromCjs(debounce_1);function useMeasure(o){let{debounce:et,scroll:tt,polyfill:nt,offsetSize:rt}=o===void 0?{debounce:0,scroll:!1,offsetSize:!1}:o;const ot=nt||(typeof window>"u"?class{}:window.ResizeObserver);if(!ot)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[it,st]=reactExports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),at=reactExports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:it}),ct=et?typeof et=="number"?et:et.scroll:null,lt=et?typeof et=="number"?et:et.resize:null,dt=reactExports.useRef(!1);reactExports.useEffect(()=>(dt.current=!0,()=>void(dt.current=!1)));const[ht,pt,mt]=reactExports.useMemo(()=>{const xt=()=>{if(!at.current.element)return;const{left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:Pt}=at.current.element.getBoundingClientRect(),jt={left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:Pt};at.current.element instanceof HTMLElement&&rt&&(jt.height=at.current.element.offsetHeight,jt.width=at.current.element.offsetWidth),Object.freeze(jt),dt.current&&!areBoundsEqual(at.current.lastBounds,jt)&&st(at.current.lastBounds=jt)};return[xt,lt?createDebounce(xt,lt):xt,ct?createDebounce(xt,ct):xt]},[st,rt,ct,lt]);function ft(){at.current.scrollContainers&&(at.current.scrollContainers.forEach(xt=>xt.removeEventListener("scroll",mt,!0)),at.current.scrollContainers=null),at.current.resizeObserver&&(at.current.resizeObserver.disconnect(),at.current.resizeObserver=null)}function yt(){at.current.element&&(at.current.resizeObserver=new ot(mt),at.current.resizeObserver.observe(at.current.element),tt&&at.current.scrollContainers&&at.current.scrollContainers.forEach(xt=>xt.addEventListener("scroll",mt,{capture:!0,passive:!0})))}const gt=xt=>{!xt||xt===at.current.element||(ft(),at.current.element=xt,at.current.scrollContainers=findScrollContainers(xt),yt())};return useOnWindowScroll(mt,!!tt),useOnWindowResize(pt),reactExports.useEffect(()=>{ft(),yt()},[tt,mt,pt]),reactExports.useEffect(()=>ft,[]),[gt,it,ht]}function useOnWindowResize(o){reactExports.useEffect(()=>{const et=o;return window.addEventListener("resize",et),()=>void window.removeEventListener("resize",et)},[o])}function useOnWindowScroll(o,et){reactExports.useEffect(()=>{if(et){const tt=o;return window.addEventListener("scroll",tt,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",tt,!0)}},[o,et])}function findScrollContainers(o){const et=[];if(!o||o===document.body)return et;const{overflow:tt,overflowX:nt,overflowY:rt}=window.getComputedStyle(o);return[tt,nt,rt].some(ot=>ot==="auto"||ot==="scroll")&&et.push(o),[...et,...findScrollContainers(o.parentElement)]}const keys$1=["x","y","top","bottom","left","right","width","height"],areBoundsEqual=(o,et)=>keys$1.every(tt=>o[tt]===et[tt]);var MapShim=function(){if(typeof Map<"u")return Map;function o(et,tt){var nt=-1;return et.some(function(rt,ot){return rt[0]===tt?(nt=ot,!0):!1}),nt}return function(){function et(){this.__entries__=[]}return Object.defineProperty(et.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),et.prototype.get=function(tt){var nt=o(this.__entries__,tt),rt=this.__entries__[nt];return rt&&rt[1]},et.prototype.set=function(tt,nt){var rt=o(this.__entries__,tt);~rt?this.__entries__[rt][1]=nt:this.__entries__.push([tt,nt])},et.prototype.delete=function(tt){var nt=this.__entries__,rt=o(nt,tt);~rt&&nt.splice(rt,1)},et.prototype.has=function(tt){return!!~o(this.__entries__,tt)},et.prototype.clear=function(){this.__entries__.splice(0)},et.prototype.forEach=function(tt,nt){nt===void 0&&(nt=null);for(var rt=0,ot=this.__entries__;rt0},o.prototype.connect_=function(){!isBrowser$2||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},o.prototype.disconnect_=function(){!isBrowser$2||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},o.prototype.onTransitionEnd_=function(et){var tt=et.propertyName,nt=tt===void 0?"":tt,rt=transitionKeys.some(function(ot){return!!~nt.indexOf(ot)});rt&&this.refresh()},o.getInstance=function(){return this.instance_||(this.instance_=new o),this.instance_},o.instance_=null,o}(),defineConfigurable=function(o,et){for(var tt=0,nt=Object.keys(et);tt"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)||(tt.set(et,new ResizeObservation(et)),this.controller_.addObserver(this),this.controller_.refresh())}},o.prototype.unobserve=function(et){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)&&(tt.delete(et),tt.size||this.controller_.removeObserver(this))}},o.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},o.prototype.gatherActive=function(){var et=this;this.clearActive(),this.observations_.forEach(function(tt){tt.isActive()&&et.activeObservations_.push(tt)})},o.prototype.broadcastActive=function(){if(this.hasActive()){var et=this.callbackCtx_,tt=this.activeObservations_.map(function(nt){return new ResizeObserverEntry(nt.target,nt.broadcastRect())});this.callback_.call(et,tt,et),this.clearActive()}},o.prototype.clearActive=function(){this.activeObservations_.splice(0)},o.prototype.hasActive=function(){return this.activeObservations_.length>0},o}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function o(et){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var tt=ResizeObserverController.getInstance(),nt=new ResizeObserverSPI(et,tt,this);observers.set(this,nt)}return o}();["observe","unobserve","disconnect"].forEach(function(o){ResizeObserver$1.prototype[o]=function(){var et;return(et=observers.get(this))[o].apply(et,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}(),browser$1={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$2={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$2.getSymbolSize=function(et){if(!et)throw new Error('"version" cannot be null or undefined');if(et<1||et>40)throw new Error('"version" should be in range from 1 to 40');return et*4+17};utils$2.getSymbolTotalCodewords=function(et){return CODEWORDS_COUNT[et]};utils$2.getBCHDigit=function(o){let et=0;for(;o!==0;)et++,o>>>=1;return et};utils$2.setToSJISFunction=function(et){if(typeof et!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=et};utils$2.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$2.toSJIS=function(et){return toSJISFunction(et)};var errorCorrectionLevel={};(function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function et(tt){if(typeof tt!="string")throw new Error("Param is not a string");switch(tt.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+tt)}}o.isValid=function(nt){return nt&&typeof nt.bit<"u"&&nt.bit>=0&&nt.bit<4},o.from=function(nt,rt){if(o.isValid(nt))return nt;try{return et(nt)}catch{return rt}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(o){const et=Math.floor(o/8);return(this.buffer[et]>>>7-o%8&1)===1},put:function(o,et){for(let tt=0;tt>>et-tt-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const et=Math.floor(this.length/8);this.buffer.length<=et&&this.buffer.push(0),o&&(this.buffer[et]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}BitMatrix$1.prototype.set=function(o,et,tt,nt){const rt=o*this.size+et;this.data[rt]=tt,nt&&(this.reservedBit[rt]=!0)};BitMatrix$1.prototype.get=function(o,et){return this.data[o*this.size+et]};BitMatrix$1.prototype.xor=function(o,et,tt){this.data[o*this.size+et]^=tt};BitMatrix$1.prototype.isReserved=function(o,et){return this.reservedBit[o*this.size+et]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(o){const et=utils$2.getSymbolSize;o.getRowColCoords=function(nt){if(nt===1)return[];const rt=Math.floor(nt/7)+2,ot=et(nt),it=ot===145?26:Math.ceil((ot-13)/(2*rt-2))*2,st=[ot-7];for(let at=1;at=0&&rt<=7},o.from=function(rt){return o.isValid(rt)?parseInt(rt,10):void 0},o.getPenaltyN1=function(rt){const ot=rt.size;let it=0,st=0,at=0,ct=null,lt=null;for(let dt=0;dt=5&&(it+=et.N1+(st-5)),ct=pt,st=1),pt=rt.get(ht,dt),pt===lt?at++:(at>=5&&(it+=et.N1+(at-5)),lt=pt,at=1)}st>=5&&(it+=et.N1+(st-5)),at>=5&&(it+=et.N1+(at-5))}return it},o.getPenaltyN2=function(rt){const ot=rt.size;let it=0;for(let st=0;st=10&&(st===1488||st===93)&&it++,at=at<<1&2047|rt.get(lt,ct),lt>=10&&(at===1488||at===93)&&it++}return it*et.N3},o.getPenaltyN4=function(rt){let ot=0;const it=rt.data.length;for(let at=0;at=0;){const it=ot[0];for(let at=0;at0){const ot=new Uint8Array(this.degree);return ot.set(nt,rt),ot}return nt};var reedSolomonEncoder=ReedSolomonEncoder$1,version$4={},mode$1={},versionCheck={};versionCheck.isValid=function(et){return!isNaN(et)&&et>=1&&et<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r -]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(et){return TEST_KANJI.test(et)};regex.testNumeric=function(et){return TEST_NUMERIC.test(et)};regex.testAlphanumeric=function(et){return TEST_ALPHANUMERIC.test(et)};(function(o){const et=versionCheck,tt=regex;o.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},o.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},o.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},o.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},o.MIXED={bit:-1},o.getCharCountIndicator=function(ot,it){if(!ot.ccBits)throw new Error("Invalid mode: "+ot);if(!et.isValid(it))throw new Error("Invalid version: "+it);return it>=1&&it<10?ot.ccBits[0]:it<27?ot.ccBits[1]:ot.ccBits[2]},o.getBestModeForData=function(ot){return tt.testNumeric(ot)?o.NUMERIC:tt.testAlphanumeric(ot)?o.ALPHANUMERIC:tt.testKanji(ot)?o.KANJI:o.BYTE},o.toString=function(ot){if(ot&&ot.id)return ot.id;throw new Error("Invalid mode")},o.isValid=function(ot){return ot&&ot.bit&&ot.ccBits};function nt(rt){if(typeof rt!="string")throw new Error("Param is not a string");switch(rt.toLowerCase()){case"numeric":return o.NUMERIC;case"alphanumeric":return o.ALPHANUMERIC;case"kanji":return o.KANJI;case"byte":return o.BYTE;default:throw new Error("Unknown mode: "+rt)}}o.from=function(ot,it){if(o.isValid(ot))return ot;try{return nt(ot)}catch{return it}}})(mode$1);(function(o){const et=utils$2,tt=errorCorrectionCode,nt=errorCorrectionLevel,rt=mode$1,ot=versionCheck,it=7973,st=et.getBCHDigit(it);function at(ht,pt,mt){for(let ft=1;ft<=40;ft++)if(pt<=o.getCapacity(ft,mt,ht))return ft}function ct(ht,pt){return rt.getCharCountIndicator(ht,pt)+4}function lt(ht,pt){let mt=0;return ht.forEach(function(ft){const yt=ct(ft.mode,pt);mt+=yt+ft.getBitsLength()}),mt}function dt(ht,pt){for(let mt=1;mt<=40;mt++)if(lt(ht,mt)<=o.getCapacity(mt,pt,rt.MIXED))return mt}o.from=function(pt,mt){return ot.isValid(pt)?parseInt(pt,10):mt},o.getCapacity=function(pt,mt,ft){if(!ot.isValid(pt))throw new Error("Invalid QR Code version");typeof ft>"u"&&(ft=rt.BYTE);const yt=et.getSymbolTotalCodewords(pt),gt=tt.getTotalCodewordsCount(pt,mt),xt=(yt-gt)*8;if(ft===rt.MIXED)return xt;const vt=xt-ct(ft,pt);switch(ft){case rt.NUMERIC:return Math.floor(vt/10*3);case rt.ALPHANUMERIC:return Math.floor(vt/11*2);case rt.KANJI:return Math.floor(vt/13);case rt.BYTE:default:return Math.floor(vt/8)}},o.getBestVersionForData=function(pt,mt){let ft;const yt=nt.from(mt,nt.M);if(Array.isArray(pt)){if(pt.length>1)return dt(pt,yt);if(pt.length===0)return 1;ft=pt[0]}else ft=pt;return at(ft.mode,ft.getLength(),yt)},o.getEncodedBits=function(pt){if(!ot.isValid(pt)||pt<7)throw new Error("Invalid QR Code version");let mt=pt<<12;for(;et.getBCHDigit(mt)-st>=0;)mt^=it<=0;)rt^=G15<0&&(nt=this.data.substr(tt),rt=parseInt(nt,10),et.put(rt,ot*3+1))};var numericData=NumericData;const Mode$3=mode$1,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(o){this.mode=Mode$3.ALPHANUMERIC,this.data=o}AlphanumericData.getBitsLength=function(et){return 11*Math.floor(et/2)+6*(et%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(et){let tt;for(tt=0;tt+2<=this.data.length;tt+=2){let nt=ALPHA_NUM_CHARS.indexOf(this.data[tt])*45;nt+=ALPHA_NUM_CHARS.indexOf(this.data[tt+1]),et.put(nt,11)}this.data.length%2&&et.put(ALPHA_NUM_CHARS.indexOf(this.data[tt]),6)};var alphanumericData=AlphanumericData;const Mode$2=mode$1;function ByteData(o){this.mode=Mode$2.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}ByteData.getBitsLength=function(et){return et*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(o){for(let et=0,tt=this.data.length;et=33088&&tt<=40956)tt-=33088;else if(tt>=57408&&tt<=60351)tt-=49472;else throw new Error("Invalid SJIS character: "+this.data[et]+` -Make sure your charset is UTF-8`);tt=(tt>>>8&255)*192+(tt&255),o.put(tt,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(o){var et={single_source_shortest_paths:function(tt,nt,rt){var ot={},it={};it[nt]=0;var st=et.PriorityQueue.make();st.push(nt,0);for(var at,ct,lt,dt,ht,pt,mt,ft,yt;!st.empty();){at=st.pop(),ct=at.value,dt=at.cost,ht=tt[ct]||{};for(lt in ht)ht.hasOwnProperty(lt)&&(pt=ht[lt],mt=dt+pt,ft=it[lt],yt=typeof it[lt]>"u",(yt||ft>mt)&&(it[lt]=mt,st.push(lt,mt),ot[lt]=ct))}if(typeof rt<"u"&&typeof it[rt]>"u"){var gt=["Could not find a path from ",nt," to ",rt,"."].join("");throw new Error(gt)}return ot},extract_shortest_path_from_predecessor_list:function(tt,nt){for(var rt=[],ot=nt;ot;)rt.push(ot),tt[ot],ot=tt[ot];return rt.reverse(),rt},find_path:function(tt,nt,rt){var ot=et.single_source_shortest_paths(tt,nt,rt);return et.extract_shortest_path_from_predecessor_list(ot,rt)},PriorityQueue:{make:function(tt){var nt=et.PriorityQueue,rt={},ot;tt=tt||{};for(ot in nt)nt.hasOwnProperty(ot)&&(rt[ot]=nt[ot]);return rt.queue=[],rt.sorter=tt.sorter||nt.default_sorter,rt},default_sorter:function(tt,nt){return tt.cost-nt.cost},push:function(tt,nt){var rt={value:tt,cost:nt};this.queue.push(rt),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=et})(dijkstra);var dijkstraExports=dijkstra.exports;(function(o){const et=mode$1,tt=numericData,nt=alphanumericData,rt=byteData,ot=kanjiData,it=regex,st=utils$2,at=dijkstraExports;function ct(gt){return unescape(encodeURIComponent(gt)).length}function lt(gt,xt,vt){const bt=[];let Et;for(;(Et=gt.exec(vt))!==null;)bt.push({data:Et[0],index:Et.index,mode:xt,length:Et[0].length});return bt}function dt(gt){const xt=lt(it.NUMERIC,et.NUMERIC,gt),vt=lt(it.ALPHANUMERIC,et.ALPHANUMERIC,gt);let bt,Et;return st.isKanjiModeEnabled()?(bt=lt(it.BYTE,et.BYTE,gt),Et=lt(it.KANJI,et.KANJI,gt)):(bt=lt(it.BYTE_KANJI,et.BYTE,gt),Et=[]),xt.concat(vt,bt,Et).sort(function(kt,It){return kt.index-It.index}).map(function(kt){return{data:kt.data,mode:kt.mode,length:kt.length}})}function ht(gt,xt){switch(xt){case et.NUMERIC:return tt.getBitsLength(gt);case et.ALPHANUMERIC:return nt.getBitsLength(gt);case et.KANJI:return ot.getBitsLength(gt);case et.BYTE:return rt.getBitsLength(gt)}}function pt(gt){return gt.reduce(function(xt,vt){const bt=xt.length-1>=0?xt[xt.length-1]:null;return bt&&bt.mode===vt.mode?(xt[xt.length-1].data+=vt.data,xt):(xt.push(vt),xt)},[])}function mt(gt){const xt=[];for(let vt=0;vt=0&&st<=6&&(at===0||at===6)||at>=0&&at<=6&&(st===0||st===6)||st>=2&&st<=4&&at>=2&&at<=4?o.set(ot+st,it+at,!0,!0):o.set(ot+st,it+at,!1,!0))}}function setupTimingPattern(o){const et=o.size;for(let tt=8;tt>st&1)===1,o.set(rt,ot,it,!0),o.set(ot,rt,it,!0)}function setupFormatInfo(o,et,tt){const nt=o.size,rt=FormatInfo.getEncodedBits(et,tt);let ot,it;for(ot=0;ot<15;ot++)it=(rt>>ot&1)===1,ot<6?o.set(ot,8,it,!0):ot<8?o.set(ot+1,8,it,!0):o.set(nt-15+ot,8,it,!0),ot<8?o.set(8,nt-ot-1,it,!0):ot<9?o.set(8,15-ot-1+1,it,!0):o.set(8,15-ot-1,it,!0);o.set(nt-8,8,1,!0)}function setupData(o,et){const tt=o.size;let nt=-1,rt=tt-1,ot=7,it=0;for(let st=tt-1;st>0;st-=2)for(st===6&&st--;;){for(let at=0;at<2;at++)if(!o.isReserved(rt,st-at)){let ct=!1;it>>ot&1)===1),o.set(rt,st-at,ct),ot--,ot===-1&&(it++,ot=7)}if(rt+=nt,rt<0||tt<=rt){rt-=nt,nt=-nt;break}}}function createData(o,et,tt){const nt=new BitBuffer;tt.forEach(function(at){nt.put(at.mode.bit,4),nt.put(at.getLength(),Mode.getCharCountIndicator(at.mode,o)),at.write(nt)});const rt=Utils$1.getSymbolTotalCodewords(o),ot=ECCode.getTotalCodewordsCount(o,et),it=(rt-ot)*8;for(nt.getLengthInBits()+4<=it&&nt.put(0,4);nt.getLengthInBits()%8!==0;)nt.putBit(0);const st=(it-nt.getLengthInBits())/8;for(let at=0;at25?39:97))};function Q(o){var et,tt="";for(et=Math.abs(o);et>52;et=et/52|0)tt=K(et%52)+tt;return(K(et%52)+tt).replace(Z,"$1-$2")}var ee=function(o,et){for(var tt=et.length;tt;)o=33*o^et.charCodeAt(--tt);return o},te=function(o){return ee(5381,o)};function ne(o){for(var et=0;et>>0);if(!tt.hasNameForId(rt,st)){var at=nt(it,"."+st,void 0,rt);tt.insertRules(rt,st,at)}ot.push(st),this.staticRulesId=st}else{for(var ct=this.rules.length,lt=ee(this.baseHash,nt.hash),dt="",ht=0;ht>>0);if(!tt.hasNameForId(rt,yt)){var gt=nt(dt,"."+yt,void 0,rt);tt.insertRules(rt,yt,gt)}ot.push(yt)}}return ot.join(" ")},o}(),se=/^\s*\/\/.*$/gm,ie=[":","[",".","#"];function ae(o){var et,tt,nt,rt,ot=w$1,it=ot.options,st=it===void 0?w$1:it,at=ot.plugins,ct=at===void 0?S:at,lt=new stylis_min(st),dt=[],ht=function(pt){function yt(gt){if(gt)try{pt(gt+"}")}catch{}}return function(gt,xt,vt,bt,Et,wt,kt,It,Rt,$t){switch(gt){case 1:if(Rt===0&&xt.charCodeAt(0)===64)return pt(xt+";"),"";break;case 2:if(It===0)return xt+"/*|*/";break;case 3:switch(It){case 102:case 112:return pt(vt[0]+xt),"";default:return xt+($t===0?"/*|*/":"")}case-2:xt.split("/*|*/}").forEach(yt)}}}(function(pt){dt.push(pt)}),ft=function(pt,yt,gt){return yt===0&&ie.indexOf(gt[tt.length])!==-1||gt.match(rt)?pt:"."+et};function mt(pt,yt,gt,xt){xt===void 0&&(xt="&");var vt=pt.replace(se,""),bt=yt&>?gt+" "+yt+" { "+vt+" }":vt;return et=xt,tt=yt,nt=new RegExp("\\"+tt+"\\b","g"),rt=new RegExp("(\\"+tt+"\\b){2,}"),lt(gt||!yt?"":yt,bt)}return lt.use([].concat(ct,[function(pt,yt,gt){pt===2&>.length&>[0].lastIndexOf(tt)>0&&(gt[0]=gt[0].replace(nt,ft))},ht,function(pt){if(pt===-2){var yt=dt;return dt=[],yt}}])),mt.hash=ct.length?ct.reduce(function(pt,yt){return yt.name||D(15),ee(pt,yt.name)},5381).toString():"",mt}var ce=React.createContext();ce.Consumer;var le=React.createContext(),de=(le.Consumer,new X),he=ae();function pe(){return reactExports.useContext(ce)||de}function fe(){return reactExports.useContext(le)||he}var ye=function(){function o(et,tt){var nt=this;this.inject=function(rt,ot){ot===void 0&&(ot=he);var it=nt.name+ot.hash;rt.hasNameForId(nt.id,it)||rt.insertRules(nt.id,it,ot(nt.rules,it,"@keyframes"))},this.toString=function(){return D(12,String(nt.name))},this.name=et,this.id="sc-keyframes-"+et,this.rules=tt}return o.prototype.getName=function(et){return et===void 0&&(et=he),this.name+et.hash},o}(),ve=/([A-Z])/,ge=/([A-Z])/g,Se=/^ms-/,we=function(o){return"-"+o.toLowerCase()};function Ee(o){return ve.test(o)?o.replace(ge,we).replace(Se,"-ms-"):o}var be=function(o){return o==null||o===!1||o===""};function _e(o,et,tt,nt){if(Array.isArray(o)){for(var rt,ot=[],it=0,st=o.length;it1?et-1:0),nt=1;nt?@[\\\]^`{|}~-]+/g,De=/(^-|-$)/g;function je(o){return o.replace(Re,"-").replace(De,"")}var Te=function(o){return Q(te(o)>>>0)};function xe(o){return typeof o=="string"&&!0}var ke=function(o){return typeof o=="function"||typeof o=="object"&&o!==null&&!Array.isArray(o)},Ve=function(o){return o!=="__proto__"&&o!=="constructor"&&o!=="prototype"};function Be(o,et,tt){var nt=o[tt];ke(et)&&ke(nt)?ze(nt,et):o[tt]=et}function ze(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt=0||($t[It]=wt[It]);return $t}(et,["componentId"]),Et=vt&&vt+"-"+(xe(xt)?xt:je(b(xt)));return Ye(xt,y$1({},bt,{attrs:ht,componentId:Et}),tt)},Object.defineProperty(mt,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(xt){this._foldedDefaultProps=nt?ze({},o.defaultProps,xt):xt}}),Object.defineProperty(mt,"toString",{value:function(){return"."+mt.styledComponentId}}),rt&&m$1(mt,o,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),mt}var qe=function(o){return function et(tt,nt,rt){if(rt===void 0&&(rt=w$1),!reactIsExports$1.isValidElementType(nt))return D(1,String(nt));var ot=function(){return tt(nt,rt,Ae.apply(void 0,arguments))};return ot.withConfig=function(it){return et(tt,nt,y$1({},rt,{},it))},ot.attrs=function(it){return et(tt,nt,y$1({},rt,{attrs:Array.prototype.concat(rt.attrs,it).filter(Boolean)}))},ot}(Ye,o)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(o){qe[o]=qe(o)});function We(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt>--at&1}const dt=31,ht=2**dt,ft=ht>>>1,mt=ft>>1,pt=ht-1;let yt=0;for(let Et=0;Et1;){let $t=wt+kt>>>1;Et>>1|lt(),It=It<<1^ft,Rt=(Rt^ft)<<1|ft|1;xt=It,vt=1+Rt-It}let bt=nt-4;return gt.map(Et=>{switch(Et-bt){case 3:return bt+65792+(o[st++]<<16|o[st++]<<8|o[st++]);case 2:return bt+256+(o[st++]<<8|o[st++]);case 1:return bt+o[st++];default:return Et-1}})}function read_payload(o){let et=0;return()=>o[et++]}function read_compressed_payload(o){return read_payload(decode_arithmetic(unsafe_atob(o)))}function unsafe_atob(o){let et=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((rt,ot)=>et[rt.charCodeAt(0)]=ot);let tt=o.length,nt=new Uint8Array(6*tt>>3);for(let rt=0,ot=0,it=0,st=0;rt=8&&(nt[ot++]=st>>(it-=8));return nt}function signed(o){return o&1?~o>>1:o>>1}function read_deltas(o,et){let tt=Array(o);for(let nt=0,rt=0;nt{let et=read_sorted(o);if(et.length)return et})}function read_mapped(o){let et=[];for(;;){let tt=o();if(tt==0)break;et.push(read_linear_table(tt,o))}for(;;){let tt=o()-1;if(tt<0)break;et.push(read_replacement_table(tt,o))}return et.flat()}function read_array_while(o){let et=[];for(;;){let tt=o(et.length);if(!tt)break;et.push(tt)}return et}function read_transposed(o,et,tt){let nt=Array(o).fill().map(()=>[]);for(let rt=0;rtnt[it].push(ot));return nt}function read_linear_table(o,et){let tt=1+et(),nt=et(),rt=read_array_while(et);return read_transposed(rt.length,1+o,et).flatMap((it,st)=>{let[at,...ct]=it;return Array(rt[st]).fill().map((lt,dt)=>{let ht=dt*nt;return[at+dt*tt,ct.map(ft=>ft+ht)]})})}function read_replacement_table(o,et){let tt=1+et();return read_transposed(tt,1+o,et).map(rt=>[rt[0],rt.slice(1)])}function read_trie(o){let et=[],tt=read_sorted(o);return rt(nt([]),[]),et;function nt(ot){let it=o(),st=read_array_while(()=>{let at=read_sorted(o).map(ct=>tt[ct]);if(at.length)return nt(at)});return{S:it,B:st,Q:ot}}function rt({S:ot,B:it},st,at){if(!(ot&4&&at===st[st.length-1])){ot&2&&(at=st[st.length-1]),ot&1&&et.push(st);for(let ct of it)for(let lt of ct.Q)rt(ct,[...st,lt],at)}}}function hex_cp(o){return o.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(o){return`{${hex_cp(o)}}`}function explode_cp(o){let et=[];for(let tt=0,nt=o.length;tt>24&255}function unpack_cp(o){return o&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let o=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(o).flatMap((et,tt)=>et.map(nt=>[nt,tt+1<<24]))),EXCLUSIONS=new Set(read_sorted(o)),DECOMP=new Map,RECOMP=new Map;for(let[et,tt]of read_mapped(o)){if(!EXCLUSIONS.has(et)&&tt.length==2){let[nt,rt]=tt,ot=RECOMP.get(nt);ot||(ot=new Map,RECOMP.set(nt,ot)),ot.set(rt,et)}DECOMP.set(et,tt.reverse())}}function is_hangul(o){return o>=S0&&o=L0&&o=V0&&etT0&&et0&&rt(T0+ct)}else{let it=DECOMP.get(ot);it?tt.push(...it):rt(ot)}if(!tt.length)break;ot=tt.pop()}if(nt&&et.length>1){let ot=unpack_cc(et[0]);for(let it=1;it0&&rt>=it)it==0?(et.push(nt,...tt),tt.length=0,nt=st):tt.push(st),rt=it;else{let at=compose_pair(nt,st);at>=0?nt=at:rt==0&&it==0?(et.push(nt),nt=st):(tt.push(st),rt=it)}}return nt>=0&&et.push(nt,...tt),et}function nfd(o){return decomposed(o).map(unpack_cp)}function nfc(o){return composed_from_decomposed(decomposed(o))}const HYPHEN=45,STOP_CH=".",FE0F=65039,UNIQUE_PH=1,Array_from=o=>Array.from(o);function group_has_cp(o,et){return o.P.has(et)||o.Q.has(et)}class Emoji extends Array{get is_emoji(){return!0}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let o=read_compressed_payload(COMPRESSED$1);const et=()=>read_sorted(o),tt=()=>new Set(et()),nt=(lt,dt)=>dt.forEach(ht=>lt.add(ht));MAPPED=new Map(read_mapped(o)),IGNORED=tt(),CM=et(),NSM=new Set(et().map(lt=>CM[lt])),CM=new Set(CM),ESCAPE=tt(),tt();let rt=read_sorted_arrays(o),ot=o();const it=()=>{let lt=new Set;return et().forEach(dt=>nt(lt,rt[dt])),nt(lt,et()),lt};GROUPS=read_array_while(lt=>{let dt=read_array_while(o).map(ht=>ht+96);if(dt.length){let ht=lt>=ot;dt[0]-=32,dt=str_from_cps(dt),ht&&(dt=`Restricted[${dt}]`);let ft=it(),mt=it(),pt=!o();return{N:dt,P:ft,Q:mt,M:pt,R:ht}}}),WHOLE_VALID=tt(),WHOLE_MAP=new Map;let st=et().concat(Array_from(WHOLE_VALID)).sort((lt,dt)=>lt-dt);st.forEach((lt,dt)=>{let ht=o(),ft=st[dt]=ht?st[dt-ht]:{V:[],M:new Map};ft.V.push(lt),WHOLE_VALID.has(lt)||WHOLE_MAP.set(lt,ft)});for(let{V:lt,M:dt}of new Set(WHOLE_MAP.values())){let ht=[];for(let mt of lt){let pt=GROUPS.filter(gt=>group_has_cp(gt,mt)),yt=ht.find(({G:gt})=>pt.some(xt=>gt.has(xt)));yt||(yt={G:new Set,V:[]},ht.push(yt)),yt.V.push(mt),nt(yt.G,pt)}let ft=ht.flatMap(mt=>Array_from(mt.G));for(let{G:mt,V:pt}of ht){let yt=new Set(ft.filter(gt=>!mt.has(gt)));for(let gt of pt)dt.set(gt,yt)}}VALID=new Set;let at=new Set;const ct=lt=>VALID.has(lt)?at.add(lt):VALID.add(lt);for(let lt of GROUPS){for(let dt of lt.P)ct(dt);for(let dt of lt.Q)ct(dt)}for(let lt of VALID)!WHOLE_MAP.has(lt)&&!at.has(lt)&&WHOLE_MAP.set(lt,UNIQUE_PH);nt(VALID,nfd(VALID)),EMOJI_LIST=read_trie(o).map(lt=>Emoji.from(lt)).sort(compare_arrays),EMOJI_ROOT=new Map;for(let lt of EMOJI_LIST){let dt=[EMOJI_ROOT];for(let ht of lt){let ft=dt.map(mt=>{let pt=mt.get(ht);return pt||(pt=new Map,mt.set(ht,pt)),pt});ht===FE0F?dt.push(...ft):dt=ft}for(let ht of dt)ht.V=lt}}function quoted_cp(o){return(should_escape(o)?"":`${bidi_qq(safe_str_from_cps([o]))} `)+quote_cp(o)}function bidi_qq(o){return`"${o}"‎`}function check_label_extension(o){if(o.length>=4&&o[2]==HYPHEN&&o[3]==HYPHEN)throw new Error(`invalid label extension: "${str_from_cps(o.slice(0,4))}"`)}function check_leading_underscore(o){for(let tt=o.lastIndexOf(95);tt>0;)if(o[--tt]!==95)throw new Error("underscore allowed only at start")}function check_fenced(o){let et=o[0],tt=FENCED.get(et);if(tt)throw error_placement(`leading ${tt}`);let nt=o.length,rt=-1;for(let ot=1;otet&&(et>>=1,o=[...o.slice(0,et),8230,...o.slice(-et)]);let rt=0,ot=o.length;for(let it=0;it{let ot=explode_cp(rt),it={input:ot,offset:nt};nt+=ot.length+1;try{let st=it.tokens=tokens_from_str(ot,et,tt),at=st.length,ct;if(!at)throw new Error("empty label");let lt=it.output=st.flat();if(check_leading_underscore(lt),!(it.emoji=at>1||st[0].is_emoji)&<.every(ht=>ht<128))check_label_extension(lt),ct="ASCII";else{let ht=st.flatMap(ft=>ft.is_emoji?[]:ft);if(!ht.length)ct="Emoji";else{if(CM.has(lt[0]))throw error_placement("leading combining mark");for(let pt=1;ptit.has(st)):Array_from(it),!tt.length)return}else nt.push(rt)}if(tt){for(let rt of tt)if(nt.every(ot=>group_has_cp(rt,ot)))throw new Error(`whole-script confusable: ${o.N}/${rt.N}`)}}function determine_group(o){let et=GROUPS;for(let tt of o){let nt=et.filter(rt=>group_has_cp(rt,tt));if(!nt.length)throw GROUPS.some(rt=>group_has_cp(rt,tt))?error_group_member(et[0],tt):error_disallowed(tt);if(et=nt,nt.length==1)break}return et}function flatten$1(o){return o.map(({input:et,error:tt,output:nt})=>{if(tt){let rt=tt.message;throw new Error(o.length==1?rt:`Invalid label ${bidi_qq(safe_str_from_cps(et,63))}: ${rt}`)}return str_from_cps(nt)}).join(STOP_CH)}function error_disallowed(o){return new Error(`disallowed character: ${quoted_cp(o)}`)}function error_group_member(o,et){let tt=quoted_cp(et),nt=GROUPS.find(rt=>rt.P.has(et));return nt&&(tt=`${nt.N} ${tt}`),new Error(`illegal mixture: ${o.N} + ${tt}`)}function error_placement(o){return new Error(`illegal placement: ${o}`)}function check_group(o,et){for(let tt of et)if(!group_has_cp(o,tt))throw error_group_member(o,tt);if(o.M){let tt=nfd(et);for(let nt=1,rt=tt.length;ntNSM_MAX)throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(tt.slice(nt-1,ot)))} (${ot-nt}/${NSM_MAX})`);nt=ot}}}function tokens_from_str(o,et,tt){let nt=[],rt=[];for(o=o.slice().reverse();o.length;){let ot=consume_emoji_reversed(o);if(ot)rt.length&&(nt.push(et(rt)),rt=[]),nt.push(tt(ot));else{let it=o.pop();if(VALID.has(it))rt.push(it);else{let st=MAPPED.get(it);if(st)rt.push(...st);else if(!IGNORED.has(it))throw error_disallowed(it)}}}return rt.length&&nt.push(et(rt)),nt}function filter_fe0f(o){return o.filter(et=>et!=FE0F)}function consume_emoji_reversed(o,et){let tt=EMOJI_ROOT,nt,rt=o.length;for(;rt&&(tt=tt.get(o[--rt]),!!tt);){let{V:ot}=tt;ot&&(nt=ot,o.length=rt)}return nt}const[SHA512_Kh,SHA512_Kl]=u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),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:et,Al:tt,Bh:nt,Bl:rt,Ch:ot,Cl:it,Dh:st,Dl:at,Eh:ct,El:lt,Fh:dt,Fl:ht,Gh:ft,Gl:mt,Hh:pt,Hl:yt}=this;return[et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt]}set(et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt){this.Ah=et|0,this.Al=tt|0,this.Bh=nt|0,this.Bl=rt|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=ft|0,this.Gl=mt|0,this.Hh=pt|0,this.Hl=yt|0}process(et,tt){for(let vt=0;vt<16;vt++,tt+=4)SHA512_W_H[vt]=et.getUint32(tt),SHA512_W_L[vt]=et.getUint32(tt+=4);for(let vt=16;vt<80;vt++){const bt=SHA512_W_H[vt-15]|0,Et=SHA512_W_L[vt-15]|0,wt=u64.rotrSH(bt,Et,1)^u64.rotrSH(bt,Et,8)^u64.shrSH(bt,Et,7),kt=u64.rotrSL(bt,Et,1)^u64.rotrSL(bt,Et,8)^u64.shrSL(bt,Et,7),It=SHA512_W_H[vt-2]|0,Rt=SHA512_W_L[vt-2]|0,$t=u64.rotrSH(It,Rt,19)^u64.rotrBH(It,Rt,61)^u64.shrSH(It,Rt,6),Nt=u64.rotrSL(It,Rt,19)^u64.rotrBL(It,Rt,61)^u64.shrSL(It,Rt,6),Mt=u64.add4L(kt,Nt,SHA512_W_L[vt-7],SHA512_W_L[vt-16]),Bt=u64.add4H(Mt,wt,$t,SHA512_W_H[vt-7],SHA512_W_H[vt-16]);SHA512_W_H[vt]=Bt|0,SHA512_W_L[vt]=Mt|0}let{Ah:nt,Al:rt,Bh:ot,Bl:it,Ch:st,Cl:at,Dh:ct,Dl:lt,Eh:dt,El:ht,Fh:ft,Fl:mt,Gh:pt,Gl:yt,Hh:gt,Hl:xt}=this;for(let vt=0;vt<80;vt++){const bt=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),wt=dt&ft^~dt&pt,kt=ht&mt^~ht&yt,It=u64.add5L(xt,Et,kt,SHA512_Kl[vt],SHA512_W_L[vt]),Rt=u64.add5H(It,gt,bt,wt,SHA512_Kh[vt],SHA512_W_H[vt]),$t=It|0,Nt=u64.rotrSH(nt,rt,28)^u64.rotrBH(nt,rt,34)^u64.rotrBH(nt,rt,39),Mt=u64.rotrSL(nt,rt,28)^u64.rotrBL(nt,rt,34)^u64.rotrBL(nt,rt,39),Bt=nt&ot^nt&st^ot&st,zt=rt&it^rt&at^it&at;gt=pt|0,xt=yt|0,pt=ft|0,yt=mt|0,ft=dt|0,mt=ht|0,{h:dt,l:ht}=u64.add(ct|0,lt|0,Rt|0,$t|0),ct=st|0,lt=at|0,st=ot|0,at=it|0,ot=nt|0,it=rt|0;const Ft=u64.add3L($t,Mt,zt);nt=u64.add3H(Ft,Rt,Nt,Bt),rt=Ft|0}({h:nt,l:rt}=u64.add(this.Ah|0,this.Al|0,nt|0,rt|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:ft,l:mt}=u64.add(this.Fh|0,this.Fl|0,ft|0,mt|0),{h:pt,l:yt}=u64.add(this.Gh|0,this.Gl|0,pt|0,yt|0),{h:gt,l:xt}=u64.add(this.Hh|0,this.Hl|0,gt|0,xt|0),this.set(nt,rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt,gt,xt)}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);function normalize$3(o){return ens_normalize(o)}normalize$3.parseError=o=>o;function normalize$2(o){return normalize$3(o)}function debounce$1(o,et,tt){var nt,rt,ot,it,st;et==null&&(et=100);function at(){var lt=Date.now()-it;lt=0?nt=setTimeout(at,et-lt):(nt=null,tt||(st=o.apply(ot,rt),ot=rt=null))}var ct=function(){ot=this,rt=arguments,it=Date.now();var lt=tt&&!nt;return nt||(nt=setTimeout(at,et)),lt&&(st=o.apply(ot,rt),ot=rt=null),st};return ct.clear=function(){nt&&(clearTimeout(nt),nt=null)},ct.flush=function(){nt&&(st=o.apply(ot,rt),ot=rt=null,clearTimeout(nt),nt=null)},ct}debounce$1.debounce=debounce$1;var debounce_1=debounce$1;const createDebounce=getDefaultExportFromCjs(debounce_1);function useMeasure(o){let{debounce:et,scroll:tt,polyfill:nt,offsetSize:rt}=o===void 0?{debounce:0,scroll:!1,offsetSize:!1}:o;const ot=nt||(typeof window>"u"?class{}:window.ResizeObserver);if(!ot)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[it,st]=reactExports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),at=reactExports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:it}),ct=et?typeof et=="number"?et:et.scroll:null,lt=et?typeof et=="number"?et:et.resize:null,dt=reactExports.useRef(!1);reactExports.useEffect(()=>(dt.current=!0,()=>void(dt.current=!1)));const[ht,ft,mt]=reactExports.useMemo(()=>{const xt=()=>{if(!at.current.element)return;const{left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:$t}=at.current.element.getBoundingClientRect(),Nt={left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:$t};at.current.element instanceof HTMLElement&&rt&&(Nt.height=at.current.element.offsetHeight,Nt.width=at.current.element.offsetWidth),Object.freeze(Nt),dt.current&&!areBoundsEqual(at.current.lastBounds,Nt)&&st(at.current.lastBounds=Nt)};return[xt,lt?createDebounce(xt,lt):xt,ct?createDebounce(xt,ct):xt]},[st,rt,ct,lt]);function pt(){at.current.scrollContainers&&(at.current.scrollContainers.forEach(xt=>xt.removeEventListener("scroll",mt,!0)),at.current.scrollContainers=null),at.current.resizeObserver&&(at.current.resizeObserver.disconnect(),at.current.resizeObserver=null)}function yt(){at.current.element&&(at.current.resizeObserver=new ot(mt),at.current.resizeObserver.observe(at.current.element),tt&&at.current.scrollContainers&&at.current.scrollContainers.forEach(xt=>xt.addEventListener("scroll",mt,{capture:!0,passive:!0})))}const gt=xt=>{!xt||xt===at.current.element||(pt(),at.current.element=xt,at.current.scrollContainers=findScrollContainers(xt),yt())};return useOnWindowScroll(mt,!!tt),useOnWindowResize(ft),reactExports.useEffect(()=>{pt(),yt()},[tt,mt,ft]),reactExports.useEffect(()=>pt,[]),[gt,it,ht]}function useOnWindowResize(o){reactExports.useEffect(()=>{const et=o;return window.addEventListener("resize",et),()=>void window.removeEventListener("resize",et)},[o])}function useOnWindowScroll(o,et){reactExports.useEffect(()=>{if(et){const tt=o;return window.addEventListener("scroll",tt,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",tt,!0)}},[o,et])}function findScrollContainers(o){const et=[];if(!o||o===document.body)return et;const{overflow:tt,overflowX:nt,overflowY:rt}=window.getComputedStyle(o);return[tt,nt,rt].some(ot=>ot==="auto"||ot==="scroll")&&et.push(o),[...et,...findScrollContainers(o.parentElement)]}const keys$1=["x","y","top","bottom","left","right","width","height"],areBoundsEqual=(o,et)=>keys$1.every(tt=>o[tt]===et[tt]);var MapShim=function(){if(typeof Map<"u")return Map;function o(et,tt){var nt=-1;return et.some(function(rt,ot){return rt[0]===tt?(nt=ot,!0):!1}),nt}return function(){function et(){this.__entries__=[]}return Object.defineProperty(et.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),et.prototype.get=function(tt){var nt=o(this.__entries__,tt),rt=this.__entries__[nt];return rt&&rt[1]},et.prototype.set=function(tt,nt){var rt=o(this.__entries__,tt);~rt?this.__entries__[rt][1]=nt:this.__entries__.push([tt,nt])},et.prototype.delete=function(tt){var nt=this.__entries__,rt=o(nt,tt);~rt&&nt.splice(rt,1)},et.prototype.has=function(tt){return!!~o(this.__entries__,tt)},et.prototype.clear=function(){this.__entries__.splice(0)},et.prototype.forEach=function(tt,nt){nt===void 0&&(nt=null);for(var rt=0,ot=this.__entries__;rt0},o.prototype.connect_=function(){!isBrowser$2||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},o.prototype.disconnect_=function(){!isBrowser$2||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},o.prototype.onTransitionEnd_=function(et){var tt=et.propertyName,nt=tt===void 0?"":tt,rt=transitionKeys.some(function(ot){return!!~nt.indexOf(ot)});rt&&this.refresh()},o.getInstance=function(){return this.instance_||(this.instance_=new o),this.instance_},o.instance_=null,o}(),defineConfigurable=function(o,et){for(var tt=0,nt=Object.keys(et);tt"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)||(tt.set(et,new ResizeObservation(et)),this.controller_.addObserver(this),this.controller_.refresh())}},o.prototype.unobserve=function(et){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)&&(tt.delete(et),tt.size||this.controller_.removeObserver(this))}},o.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},o.prototype.gatherActive=function(){var et=this;this.clearActive(),this.observations_.forEach(function(tt){tt.isActive()&&et.activeObservations_.push(tt)})},o.prototype.broadcastActive=function(){if(this.hasActive()){var et=this.callbackCtx_,tt=this.activeObservations_.map(function(nt){return new ResizeObserverEntry(nt.target,nt.broadcastRect())});this.callback_.call(et,tt,et),this.clearActive()}},o.prototype.clearActive=function(){this.activeObservations_.splice(0)},o.prototype.hasActive=function(){return this.activeObservations_.length>0},o}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function o(et){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var tt=ResizeObserverController.getInstance(),nt=new ResizeObserverSPI(et,tt,this);observers.set(this,nt)}return o}();["observe","unobserve","disconnect"].forEach(function(o){ResizeObserver$1.prototype[o]=function(){var et;return(et=observers.get(this))[o].apply(et,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}(),browser$1={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$2={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$2.getSymbolSize=function(et){if(!et)throw new Error('"version" cannot be null or undefined');if(et<1||et>40)throw new Error('"version" should be in range from 1 to 40');return et*4+17};utils$2.getSymbolTotalCodewords=function(et){return CODEWORDS_COUNT[et]};utils$2.getBCHDigit=function(o){let et=0;for(;o!==0;)et++,o>>>=1;return et};utils$2.setToSJISFunction=function(et){if(typeof et!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=et};utils$2.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$2.toSJIS=function(et){return toSJISFunction(et)};var errorCorrectionLevel={};(function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function et(tt){if(typeof tt!="string")throw new Error("Param is not a string");switch(tt.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+tt)}}o.isValid=function(nt){return nt&&typeof nt.bit<"u"&&nt.bit>=0&&nt.bit<4},o.from=function(nt,rt){if(o.isValid(nt))return nt;try{return et(nt)}catch{return rt}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(o){const et=Math.floor(o/8);return(this.buffer[et]>>>7-o%8&1)===1},put:function(o,et){for(let tt=0;tt>>et-tt-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const et=Math.floor(this.length/8);this.buffer.length<=et&&this.buffer.push(0),o&&(this.buffer[et]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}BitMatrix$1.prototype.set=function(o,et,tt,nt){const rt=o*this.size+et;this.data[rt]=tt,nt&&(this.reservedBit[rt]=!0)};BitMatrix$1.prototype.get=function(o,et){return this.data[o*this.size+et]};BitMatrix$1.prototype.xor=function(o,et,tt){this.data[o*this.size+et]^=tt};BitMatrix$1.prototype.isReserved=function(o,et){return this.reservedBit[o*this.size+et]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(o){const et=utils$2.getSymbolSize;o.getRowColCoords=function(nt){if(nt===1)return[];const rt=Math.floor(nt/7)+2,ot=et(nt),it=ot===145?26:Math.ceil((ot-13)/(2*rt-2))*2,st=[ot-7];for(let at=1;at=0&&rt<=7},o.from=function(rt){return o.isValid(rt)?parseInt(rt,10):void 0},o.getPenaltyN1=function(rt){const ot=rt.size;let it=0,st=0,at=0,ct=null,lt=null;for(let dt=0;dt=5&&(it+=et.N1+(st-5)),ct=ft,st=1),ft=rt.get(ht,dt),ft===lt?at++:(at>=5&&(it+=et.N1+(at-5)),lt=ft,at=1)}st>=5&&(it+=et.N1+(st-5)),at>=5&&(it+=et.N1+(at-5))}return it},o.getPenaltyN2=function(rt){const ot=rt.size;let it=0;for(let st=0;st=10&&(st===1488||st===93)&&it++,at=at<<1&2047|rt.get(lt,ct),lt>=10&&(at===1488||at===93)&&it++}return it*et.N3},o.getPenaltyN4=function(rt){let ot=0;const it=rt.data.length;for(let at=0;at=0;){const it=ot[0];for(let at=0;at0){const ot=new Uint8Array(this.degree);return ot.set(nt,rt),ot}return nt};var reedSolomonEncoder=ReedSolomonEncoder$1,version$4={},mode$1={},versionCheck={};versionCheck.isValid=function(et){return!isNaN(et)&&et>=1&&et<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r +]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(et){return TEST_KANJI.test(et)};regex.testNumeric=function(et){return TEST_NUMERIC.test(et)};regex.testAlphanumeric=function(et){return TEST_ALPHANUMERIC.test(et)};(function(o){const et=versionCheck,tt=regex;o.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},o.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},o.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},o.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},o.MIXED={bit:-1},o.getCharCountIndicator=function(ot,it){if(!ot.ccBits)throw new Error("Invalid mode: "+ot);if(!et.isValid(it))throw new Error("Invalid version: "+it);return it>=1&&it<10?ot.ccBits[0]:it<27?ot.ccBits[1]:ot.ccBits[2]},o.getBestModeForData=function(ot){return tt.testNumeric(ot)?o.NUMERIC:tt.testAlphanumeric(ot)?o.ALPHANUMERIC:tt.testKanji(ot)?o.KANJI:o.BYTE},o.toString=function(ot){if(ot&&ot.id)return ot.id;throw new Error("Invalid mode")},o.isValid=function(ot){return ot&&ot.bit&&ot.ccBits};function nt(rt){if(typeof rt!="string")throw new Error("Param is not a string");switch(rt.toLowerCase()){case"numeric":return o.NUMERIC;case"alphanumeric":return o.ALPHANUMERIC;case"kanji":return o.KANJI;case"byte":return o.BYTE;default:throw new Error("Unknown mode: "+rt)}}o.from=function(ot,it){if(o.isValid(ot))return ot;try{return nt(ot)}catch{return it}}})(mode$1);(function(o){const et=utils$2,tt=errorCorrectionCode,nt=errorCorrectionLevel,rt=mode$1,ot=versionCheck,it=7973,st=et.getBCHDigit(it);function at(ht,ft,mt){for(let pt=1;pt<=40;pt++)if(ft<=o.getCapacity(pt,mt,ht))return pt}function ct(ht,ft){return rt.getCharCountIndicator(ht,ft)+4}function lt(ht,ft){let mt=0;return ht.forEach(function(pt){const yt=ct(pt.mode,ft);mt+=yt+pt.getBitsLength()}),mt}function dt(ht,ft){for(let mt=1;mt<=40;mt++)if(lt(ht,mt)<=o.getCapacity(mt,ft,rt.MIXED))return mt}o.from=function(ft,mt){return ot.isValid(ft)?parseInt(ft,10):mt},o.getCapacity=function(ft,mt,pt){if(!ot.isValid(ft))throw new Error("Invalid QR Code version");typeof pt>"u"&&(pt=rt.BYTE);const yt=et.getSymbolTotalCodewords(ft),gt=tt.getTotalCodewordsCount(ft,mt),xt=(yt-gt)*8;if(pt===rt.MIXED)return xt;const vt=xt-ct(pt,ft);switch(pt){case rt.NUMERIC:return Math.floor(vt/10*3);case rt.ALPHANUMERIC:return Math.floor(vt/11*2);case rt.KANJI:return Math.floor(vt/13);case rt.BYTE:default:return Math.floor(vt/8)}},o.getBestVersionForData=function(ft,mt){let pt;const yt=nt.from(mt,nt.M);if(Array.isArray(ft)){if(ft.length>1)return dt(ft,yt);if(ft.length===0)return 1;pt=ft[0]}else pt=ft;return at(pt.mode,pt.getLength(),yt)},o.getEncodedBits=function(ft){if(!ot.isValid(ft)||ft<7)throw new Error("Invalid QR Code version");let mt=ft<<12;for(;et.getBCHDigit(mt)-st>=0;)mt^=it<=0;)rt^=G15<0&&(nt=this.data.substr(tt),rt=parseInt(nt,10),et.put(rt,ot*3+1))};var numericData=NumericData;const Mode$3=mode$1,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(o){this.mode=Mode$3.ALPHANUMERIC,this.data=o}AlphanumericData.getBitsLength=function(et){return 11*Math.floor(et/2)+6*(et%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(et){let tt;for(tt=0;tt+2<=this.data.length;tt+=2){let nt=ALPHA_NUM_CHARS.indexOf(this.data[tt])*45;nt+=ALPHA_NUM_CHARS.indexOf(this.data[tt+1]),et.put(nt,11)}this.data.length%2&&et.put(ALPHA_NUM_CHARS.indexOf(this.data[tt]),6)};var alphanumericData=AlphanumericData;const Mode$2=mode$1;function ByteData(o){this.mode=Mode$2.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}ByteData.getBitsLength=function(et){return et*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(o){for(let et=0,tt=this.data.length;et=33088&&tt<=40956)tt-=33088;else if(tt>=57408&&tt<=60351)tt-=49472;else throw new Error("Invalid SJIS character: "+this.data[et]+` +Make sure your charset is UTF-8`);tt=(tt>>>8&255)*192+(tt&255),o.put(tt,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(o){var et={single_source_shortest_paths:function(tt,nt,rt){var ot={},it={};it[nt]=0;var st=et.PriorityQueue.make();st.push(nt,0);for(var at,ct,lt,dt,ht,ft,mt,pt,yt;!st.empty();){at=st.pop(),ct=at.value,dt=at.cost,ht=tt[ct]||{};for(lt in ht)ht.hasOwnProperty(lt)&&(ft=ht[lt],mt=dt+ft,pt=it[lt],yt=typeof it[lt]>"u",(yt||pt>mt)&&(it[lt]=mt,st.push(lt,mt),ot[lt]=ct))}if(typeof rt<"u"&&typeof it[rt]>"u"){var gt=["Could not find a path from ",nt," to ",rt,"."].join("");throw new Error(gt)}return ot},extract_shortest_path_from_predecessor_list:function(tt,nt){for(var rt=[],ot=nt;ot;)rt.push(ot),tt[ot],ot=tt[ot];return rt.reverse(),rt},find_path:function(tt,nt,rt){var ot=et.single_source_shortest_paths(tt,nt,rt);return et.extract_shortest_path_from_predecessor_list(ot,rt)},PriorityQueue:{make:function(tt){var nt=et.PriorityQueue,rt={},ot;tt=tt||{};for(ot in nt)nt.hasOwnProperty(ot)&&(rt[ot]=nt[ot]);return rt.queue=[],rt.sorter=tt.sorter||nt.default_sorter,rt},default_sorter:function(tt,nt){return tt.cost-nt.cost},push:function(tt,nt){var rt={value:tt,cost:nt};this.queue.push(rt),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=et})(dijkstra);var dijkstraExports=dijkstra.exports;(function(o){const et=mode$1,tt=numericData,nt=alphanumericData,rt=byteData,ot=kanjiData,it=regex,st=utils$2,at=dijkstraExports;function ct(gt){return unescape(encodeURIComponent(gt)).length}function lt(gt,xt,vt){const bt=[];let Et;for(;(Et=gt.exec(vt))!==null;)bt.push({data:Et[0],index:Et.index,mode:xt,length:Et[0].length});return bt}function dt(gt){const xt=lt(it.NUMERIC,et.NUMERIC,gt),vt=lt(it.ALPHANUMERIC,et.ALPHANUMERIC,gt);let bt,Et;return st.isKanjiModeEnabled()?(bt=lt(it.BYTE,et.BYTE,gt),Et=lt(it.KANJI,et.KANJI,gt)):(bt=lt(it.BYTE_KANJI,et.BYTE,gt),Et=[]),xt.concat(vt,bt,Et).sort(function(kt,It){return kt.index-It.index}).map(function(kt){return{data:kt.data,mode:kt.mode,length:kt.length}})}function ht(gt,xt){switch(xt){case et.NUMERIC:return tt.getBitsLength(gt);case et.ALPHANUMERIC:return nt.getBitsLength(gt);case et.KANJI:return ot.getBitsLength(gt);case et.BYTE:return rt.getBitsLength(gt)}}function ft(gt){return gt.reduce(function(xt,vt){const bt=xt.length-1>=0?xt[xt.length-1]:null;return bt&&bt.mode===vt.mode?(xt[xt.length-1].data+=vt.data,xt):(xt.push(vt),xt)},[])}function mt(gt){const xt=[];for(let vt=0;vt=0&&st<=6&&(at===0||at===6)||at>=0&&at<=6&&(st===0||st===6)||st>=2&&st<=4&&at>=2&&at<=4?o.set(ot+st,it+at,!0,!0):o.set(ot+st,it+at,!1,!0))}}function setupTimingPattern(o){const et=o.size;for(let tt=8;tt>st&1)===1,o.set(rt,ot,it,!0),o.set(ot,rt,it,!0)}function setupFormatInfo(o,et,tt){const nt=o.size,rt=FormatInfo.getEncodedBits(et,tt);let ot,it;for(ot=0;ot<15;ot++)it=(rt>>ot&1)===1,ot<6?o.set(ot,8,it,!0):ot<8?o.set(ot+1,8,it,!0):o.set(nt-15+ot,8,it,!0),ot<8?o.set(8,nt-ot-1,it,!0):ot<9?o.set(8,15-ot-1+1,it,!0):o.set(8,15-ot-1,it,!0);o.set(nt-8,8,1,!0)}function setupData(o,et){const tt=o.size;let nt=-1,rt=tt-1,ot=7,it=0;for(let st=tt-1;st>0;st-=2)for(st===6&&st--;;){for(let at=0;at<2;at++)if(!o.isReserved(rt,st-at)){let ct=!1;it>>ot&1)===1),o.set(rt,st-at,ct),ot--,ot===-1&&(it++,ot=7)}if(rt+=nt,rt<0||tt<=rt){rt-=nt,nt=-nt;break}}}function createData(o,et,tt){const nt=new BitBuffer;tt.forEach(function(at){nt.put(at.mode.bit,4),nt.put(at.getLength(),Mode.getCharCountIndicator(at.mode,o)),at.write(nt)});const rt=Utils$1.getSymbolTotalCodewords(o),ot=ECCode.getTotalCodewordsCount(o,et),it=(rt-ot)*8;for(nt.getLengthInBits()+4<=it&&nt.put(0,4);nt.getLengthInBits()%8!==0;)nt.putBit(0);const st=(it-nt.getLengthInBits())/8;for(let at=0;at=7&&setupVersionInfo(at,et),setupData(at,it),isNaN(nt)&&(nt=MaskPattern.getBestMask(at,setupFormatInfo.bind(null,at,tt))),MaskPattern.applyMask(nt,at),setupFormatInfo(at,tt,nt),{modules:at,version:et,errorCorrectionLevel:tt,maskPattern:nt,segments:rt}}qrcode.create=function(et,tt){if(typeof et>"u"||et==="")throw new Error("No input text");let nt=ECLevel.M,rt,ot;return typeof tt<"u"&&(nt=ECLevel.from(tt.errorCorrectionLevel,ECLevel.M),rt=Version$1.from(tt.version),ot=MaskPattern.from(tt.maskPattern),tt.toSJISFunc&&Utils$1.setToSJISFunction(tt.toSJISFunc)),createSymbol(et,rt,nt,ot)};var canvas={},utils$1={};(function(o){function et(tt){if(typeof tt=="number"&&(tt=tt.toString()),typeof tt!="string")throw new Error("Color should be defined as hex string");let nt=tt.slice().replace("#","").split("");if(nt.length<3||nt.length===5||nt.length>8)throw new Error("Invalid hex color: "+tt);(nt.length===3||nt.length===4)&&(nt=Array.prototype.concat.apply([],nt.map(function(ot){return[ot,ot]}))),nt.length===6&&nt.push("F","F");const rt=parseInt(nt.join(""),16);return{r:rt>>24&255,g:rt>>16&255,b:rt>>8&255,a:rt&255,hex:"#"+nt.slice(0,6).join("")}}o.getOptions=function(nt){nt||(nt={}),nt.color||(nt.color={});const rt=typeof nt.margin>"u"||nt.margin===null||nt.margin<0?4:nt.margin,ot=nt.width&&nt.width>=21?nt.width:void 0,it=nt.scale||4;return{width:ot,scale:ot?4:it,margin:rt,color:{dark:et(nt.color.dark||"#000000ff"),light:et(nt.color.light||"#ffffffff")},type:nt.type,rendererOpts:nt.rendererOpts||{}}},o.getScale=function(nt,rt){return rt.width&&rt.width>=nt+rt.margin*2?rt.width/(nt+rt.margin*2):rt.scale},o.getImageWidth=function(nt,rt){const ot=o.getScale(nt,rt);return Math.floor((nt+rt.margin*2)*ot)},o.qrToImageData=function(nt,rt,ot){const it=rt.modules.size,st=rt.modules.data,at=o.getScale(it,ot),ct=Math.floor((it+ot.margin*2)*at),lt=ot.margin*at,dt=[ot.color.light,ot.color.dark];for(let ht=0;ht=lt&&pt>=lt&&ht"u"&&(!it||!it.getContext)&&(at=it,it=void 0),it||(ct=nt()),at=et.getOptions(at);const lt=et.getImageWidth(ot.modules.size,at),dt=ct.getContext("2d"),ht=dt.createImageData(lt,lt);return et.qrToImageData(ht.data,ot,at),tt(dt,ct,lt),dt.putImageData(ht,0,0),ct},o.renderToDataURL=function(ot,it,st){let at=st;typeof at>"u"&&(!it||!it.getContext)&&(at=it,it=void 0),at||(at={});const ct=o.render(ot,it,at),lt=at.type||"image/png",dt=at.rendererOpts||{};return ct.toDataURL(lt,dt.quality)}})(canvas);var svgTag={};const Utils=utils$1;function getColorAttrib(o,et){const tt=o.a/255,nt=et+'="'+o.hex+'"';return tt<1?nt+" "+et+'-opacity="'+tt.toFixed(2).slice(1)+'"':nt}function svgCmd(o,et,tt){let nt=o+et;return typeof tt<"u"&&(nt+=" "+tt),nt}function qrToPath(o,et,tt){let nt="",rt=0,ot=!1,it=0;for(let st=0;st0&&at>0&&o[st-1]||(nt+=ot?svgCmd("M",at+tt,.5+ct+tt):svgCmd("m",rt,0),rt=0,ot=!1),at+1':"",ct="',lt='viewBox="0 0 '+st+" "+st+'"',ht=''+at+ct+` -`;return typeof nt=="function"&&nt(null,ht),ht};const canPromise=canPromise$1,QRCode$2=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(o,et,tt,nt,rt){const ot=[].slice.call(arguments,1),it=ot.length,st=typeof ot[it-1]=="function";if(!st&&!canPromise())throw new Error("Callback required as last argument");if(st){if(it<2)throw new Error("Too few arguments provided");it===2?(rt=tt,tt=et,et=nt=void 0):it===3&&(et.getContext&&typeof rt>"u"?(rt=nt,nt=void 0):(rt=nt,nt=tt,tt=et,et=void 0))}else{if(it<1)throw new Error("Too few arguments provided");return it===1?(tt=et,et=nt=void 0):it===2&&!et.getContext&&(nt=tt,tt=et,et=void 0),new Promise(function(at,ct){try{const lt=QRCode$2.create(tt,nt);at(o(lt,et,nt))}catch(lt){ct(lt)}})}try{const at=QRCode$2.create(tt,nt);rt(null,o(at,et,nt))}catch(at){rt(at)}}browser$1.create=QRCode$2.create;browser$1.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$1.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$1.toString=renderCanvas.bind(null,function(o,et,tt){return SvgRenderer.render(o,tt)});var PRE_ENTER=0,ENTERING=1,ENTERED=2,PRE_EXIT=3,EXITING=4,EXITED=5,UNMOUNTED=6,STATES=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],startOrEnd=function(et){return et?UNMOUNTED:EXITED},updateState=function(et,tt,nt,rt,ot){clearTimeout(rt.current),tt(et),nt.current=et,ot&&ot({state:STATES[et]})},useTransition=function(et){var tt=et===void 0?{}:et,nt=tt.enter,rt=nt===void 0?!0:nt,ot=tt.exit,it=ot===void 0?!0:ot,st=tt.preEnter,at=tt.preExit,ct=tt.timeout,lt=tt.initialEntered,dt=tt.mountOnEnter,ht=tt.unmountOnExit,pt=tt.onChange,mt=reactExports.useState(lt?ENTERED:startOrEnd(dt)),ft=mt[0],yt=mt[1],gt=reactExports.useRef(ft),xt=reactExports.useRef(),vt,bt;typeof ct=="object"?(vt=ct.enter,bt=ct.exit):vt=bt=ct;var Et=reactExports.useCallback(function(){var kt;switch(gt.current){case ENTERING:case PRE_ENTER:kt=ENTERED;break;case EXITING:case PRE_EXIT:kt=startOrEnd(ht);break}kt!==void 0&&updateState(kt,yt,gt,xt,pt)},[pt,ht]),wt=reactExports.useCallback(function(kt){var It=function Pt(jt){switch(updateState(jt,yt,gt,xt,pt),jt){case ENTERING:vt>=0&&(xt.current=setTimeout(Et,vt));break;case EXITING:bt>=0&&(xt.current=setTimeout(Et,bt));break;case PRE_ENTER:case PRE_EXIT:xt.current=setTimeout(function(){return Pt(jt+1)},0);break}},Rt=gt.current<=ENTERED;typeof kt!="boolean"&&(kt=!Rt),kt?Rt||It(rt?st?PRE_ENTER:ENTERING:ENTERED):Rt&&It(it?at?PRE_EXIT:EXITING:startOrEnd(ht))},[Et,pt,rt,it,st,at,vt,bt,ht]);return reactExports.useEffect(function(){return function(){return clearTimeout(xt.current)}},[]),[STATES[ft],wt,Et]};const defaultConnectors=({app:o,walletConnectProjectId:et,coinbaseWalletPreference:tt})=>{const nt=o.name&&o.icon&&o.description&&o.url,rt=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,ot=[];return rt&&ot.push(safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})),ot.push(injected({target:"metaMask"}),coinbaseWallet({appName:o.name,appLogoUrl:o.icon,overrideIsMetaMask:!1,preference:tt})),et&&ot.push(walletConnect({showQrModal:!1,projectId:et,metadata:nt?{name:o.name,description:o.description,url:o.url,icons:[o.icon]}:void 0})),ot};let globalAppName,globalAppIcon;const getAppName=()=>globalAppName,getAppIcon=()=>globalAppIcon,defaultConfig=({appName:o="ConnectKit",appIcon:et,appDescription:tt,appUrl:nt,walletConnectProjectId:rt,coinbaseWalletPreference:ot,chains:it=[mainnet,polygon,optimism,arbitrum],client:st,...at})=>{var ct,lt;globalAppName=o,et&&(globalAppIcon=et);const dt=(ct=at==null?void 0:at.transports)!==null&&ct!==void 0?ct:Object.fromEntries(it.map(mt=>[mt.id,http()])),ht=(lt=at==null?void 0:at.connectors)!==null&<!==void 0?lt:defaultConnectors({app:{name:o,icon:et,description:tt,url:nt},walletConnectProjectId:rt,coinbaseWalletPreference:ot});return{...at,chains:it,connectors:ht,transports:dt}},isWalletInstalled=o=>{if(typeof window>"u")return!1;const{ethereum:et}=window;return!!(et!=null&&et[`is${o}`]||et!=null&&et.providers&&(et!=null&&et.providers.find(tt=>tt==null?void 0:tt[`is${o}`])))},isFamily=()=>isWalletInstalled("Family"),isRainbow=()=>isWalletInstalled("Rainbow"),isZerion=()=>isWalletInstalled("Zerion"),Mock=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),Injected=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6505 3.64041C15.6501 3.64062 15.6497 3.64083 15.6493 3.64103L6.05165 8.43985L16.2501 13.5391L26.4484 8.43987L16.8508 3.64103C16.8504 3.64083 16.85 3.64063 16.8496 3.64043C16.6632 3.54806 16.458 3.5 16.25 3.5C16.042 3.5 15.8369 3.54806 15.6505 3.64041ZM28 10.4592L17.5001 15.7091L17.5 28.5205L27.248 23.6465L27.2508 23.6452C27.4757 23.5334 27.665 23.3611 27.7973 23.1477C27.9297 22.9342 27.9999 22.6881 28 22.4369V10.4592ZM15 28.527L15.0001 15.7091L4.50006 10.4591V22.4333C4.49831 22.6849 4.56687 22.9319 4.69807 23.1466C4.82896 23.3608 5.01696 23.5342 5.24095 23.6475C5.24148 23.6477 5.242 23.648 5.24253 23.6483L15 28.527ZM14.5207 31.0824L4.12104 25.8826L4.11759 25.8809C3.47681 25.558 2.93902 25.0625 2.56486 24.4502C2.19154 23.8394 1.99597 23.1365 2.00006 22.4207V10.0486C2.00044 9.33234 2.20062 8.62972 2.5781 8.021C2.95529 7.41274 3.49457 6.92167 4.13537 6.60291C4.13585 6.60267 4.13633 6.60243 4.13681 6.60219L14.534 1.40359L14.5368 1.40221C15.0692 1.13767 15.6556 1 16.25 1C16.8445 1 17.4309 1.13767 17.9633 1.40221L17.966 1.40358L28.3633 6.60219C28.3638 6.60245 28.3643 6.6027 28.3648 6.60295C29.0055 6.92171 29.5448 7.41276 29.922 8.021C30.2994 8.62973 30.4996 9.33168 30.5 10.0479V22.4376C30.4996 23.1538 30.2994 23.8565 29.922 24.4652C29.5448 25.0734 29.0056 25.5644 28.365 25.8831C28.3644 25.8834 28.3638 25.8837 28.3633 25.884L17.9664 31.0824C17.9663 31.0825 17.9665 31.0824 17.9664 31.0824C17.4316 31.3499 16.8415 31.4894 16.2435 31.4894C15.6455 31.4894 15.0554 31.3499 14.5207 31.0824C14.5205 31.0824 14.5208 31.0825 14.5207 31.0824Z",fill:"#CCCCCC"})}),WalletConnect=({background:o=!1,...et})=>jsxRuntimeExports.jsx("svg",{...et,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:o?{background:"var(--ck-brand-walletConnect)"}:void 0,children:jsxRuntimeExports.jsx("path",{d:"M9.58818 11.8556C13.1293 8.31442 18.8706 8.31442 22.4117 11.8556L22.8379 12.2818C23.015 12.4588 23.015 12.7459 22.8379 12.9229L21.3801 14.3808C21.2915 14.4693 21.148 14.4693 21.0595 14.3808L20.473 13.7943C18.0026 11.3239 13.9973 11.3239 11.5269 13.7943L10.8989 14.4223C10.8104 14.5109 10.6668 14.5109 10.5783 14.4223L9.12041 12.9645C8.94336 12.7875 8.94336 12.5004 9.12041 12.3234L9.58818 11.8556ZM25.4268 14.8706L26.7243 16.1682C26.9013 16.3452 26.9013 16.6323 26.7243 16.8093L20.8737 22.6599C20.6966 22.8371 20.4096 22.8371 20.2325 22.6599L16.0802 18.5076C16.0359 18.4634 15.9641 18.4634 15.9199 18.5076L11.7675 22.6599C11.5905 22.8371 11.3034 22.8371 11.1264 22.66C11.1264 22.66 11.1264 22.6599 11.1264 22.6599L5.27561 16.8092C5.09856 16.6322 5.09856 16.3451 5.27561 16.168L6.57313 14.8706C6.75019 14.6934 7.03726 14.6934 7.21431 14.8706L11.3668 19.023C11.411 19.0672 11.4828 19.0672 11.5271 19.023L15.6793 14.8706C15.8563 14.6934 16.1434 14.6934 16.3205 14.8706L20.473 19.023C20.5172 19.0672 20.589 19.0672 20.6332 19.023L24.7856 14.8706C24.9627 14.6935 25.2498 14.6935 25.4268 14.8706Z",fill:o?"white":"var(--ck-brand-walletConnect)"})}),MetaMask=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,style:o?{background:"linear-gradient(0deg, var(--ck-brand-metamask-12), var(--ck-brand-metamask-11))",borderRadius:"27.5%"}:void 0,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M27.2684 4.03027L17.5018 11.2841L19.3079 7.00442L27.2684 4.03027Z",fill:"var(--ck-brand-metamask-02)",stroke:"var(--ck-brand-metamask-02)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M4.7218 4.03027L14.4099 11.3528L12.6921 7.00442L4.7218 4.03027Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.7544 20.8438L21.1532 24.8289L26.7187 26.3602L28.3187 20.9321L23.7544 20.8438Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.69104 20.9321L5.28117 26.3602L10.8467 24.8289L8.24551 20.8438L3.69104 20.9321Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5327 14.1108L8.98181 16.4568L14.5081 16.7022L14.3117 10.7637L10.5327 14.1108Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.4576 14.1111L17.6295 10.6953L17.5018 16.7025L23.0182 16.4571L21.4576 14.1111Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8292L14.1647 23.2096L11.2984 20.9717L10.8469 24.8292Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8257 23.2096L21.1531 24.8292L20.6918 20.9717L17.8257 23.2096Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.1531 24.8296L17.8257 23.21L18.0906 25.3793L18.0612 26.2921L21.1531 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8296L13.9388 26.2921L13.9192 25.3793L14.1647 23.21L10.8469 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M13.9877 19.5389L11.2196 18.7242L13.1729 17.8311L13.9877 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0023 19.5389L18.8171 17.8311L20.7802 18.7242L18.0023 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8468 24.8289L11.3179 20.8438L8.24561 20.9321L10.8468 24.8289Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.6821 20.8438L21.1532 24.8289L23.7544 20.9321L20.6821 20.8438Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.0182 16.4565L17.5018 16.7019L18.0122 19.5387L18.827 17.8308L20.7902 18.7239L23.0182 16.4565Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2198 18.7239L13.1829 17.8308L13.9878 19.5387L14.5081 16.7019L8.98181 16.4565L11.2198 18.7239Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M8.98181 16.4565L11.2983 20.9718L11.2198 18.7239L8.98181 16.4565Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.7901 18.7239L20.6919 20.9718L23.0181 16.4565L20.7901 18.7239Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14.508 16.7021L13.9878 19.5389L14.6356 22.886L14.7828 18.4788L14.508 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5017 16.7021L17.2367 18.4689L17.3545 22.886L18.0121 19.5389L17.5017 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0121 19.5388L17.3545 22.886L17.8257 23.2099L20.6918 20.972L20.79 18.7241L18.0121 19.5388Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2196 18.7241L11.2981 20.972L14.1644 23.2099L14.6355 22.886L13.9877 19.5388L11.2196 18.7241Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0615 26.2917L18.0908 25.3788L17.8455 25.1628H14.145L13.9192 25.3788L13.9388 26.2917L10.8469 24.8291L11.9267 25.7126L14.1155 27.234H17.875L20.0736 25.7126L21.1533 24.8291L18.0615 26.2917Z",fill:"var(--ck-brand-metamask-07)",stroke:"var(--ck-brand-metamask-07)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8258 23.2096L17.3546 22.8857H14.6357L14.1646 23.2096L13.9191 25.379L14.1449 25.163H17.8454L18.0907 25.379L17.8258 23.2096Z",fill:"var(--ck-brand-metamask-04)",stroke:"var(--ck-brand-metamask-04)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M27.6806 11.7552L28.5149 7.75041L27.2683 4.03027L17.8257 11.0387L21.4575 14.1109L26.591 15.6128L27.7296 14.2876L27.2389 13.9342L28.0241 13.2178L27.4156 12.7465L28.2007 12.1478L27.6806 11.7552Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.48486 7.75041L4.3192 11.7552L3.78916 12.1478L4.57441 12.7465L3.97566 13.2178L4.7609 13.9342L4.27012 14.2876L5.39892 15.6128L10.5325 14.1109L14.1644 11.0387L4.72164 4.03027L3.48486 7.75041Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M26.591 15.6122L21.4575 14.1104L23.0181 16.4564L20.6919 20.9716L23.7544 20.9323H28.3186L26.591 15.6122Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5326 14.1104L5.39897 15.6122L3.69104 20.9323H8.24551L11.2982 20.9716L8.98168 16.4564L10.5326 14.1104Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5018 16.7018L17.8258 11.0381L19.3177 7.00391H12.6921L14.1645 11.0381L14.5081 16.7018L14.6258 18.4883L14.6356 22.8856H17.3546L17.3742 18.4883L17.5018 16.7018Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"})]}),Coinbase=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"var(--ck-brand-coinbaseWallet)"}),o&&jsxRuntimeExports.jsx("rect",{rx:"27%",width:"20",height:"20",fill:"var(--ck-brand-coinbaseWallet)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 17C13.8661 17 17.0001 13.866 17.0001 10C17.0001 6.13401 13.8661 3 10.0001 3C6.13413 3 3.00012 6.13401 3.00012 10C3.00012 13.866 6.13413 17 10.0001 17ZM8.25012 7.71429C7.95427 7.71429 7.71441 7.95414 7.71441 8.25V11.75C7.71441 12.0459 7.95427 12.2857 8.25012 12.2857H11.7501C12.046 12.2857 12.2858 12.0459 12.2858 11.75V8.25C12.2858 7.95414 12.046 7.71429 11.7501 7.71429H8.25012Z",fill:"white"})]}),Family=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{backgroundSize:"100% 100%",backgroundImage:'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAABQGlDQ1BzUDNDAAB4nGNgYHyQk5xbzKLAwJCbV1IU5O6kEBEZpcD+iIGZQYSBk4GPQTYxubjAN9gthAEIihPLi5NLinIYUMC3awyMIPqybkZiXopc+xz3pvOzD4rlWyascy2VY8APuFJSi5OB9B8gVkkuKCphYGAEuoZBqbykAMR2AbJFkjMSU4DsCCBbpwjoQCC7BSSeDmHPALGTIOw1IHZRSJAzkH0AyFZIR2InIbFzc0qToW4AuZ4nNS80GEhzALEMQzFDAIMxgzMONWxgNc5AaMCgCAov9HAoTjM2gujicWJgYL33//9nVQYG9skMDH8n/P//e+H////8GBiYZzEwHBBB6G++z8Bgux/EQoh5AfkbzYHBtBUhpmHBwCDIxcBwoqIgsSgRLMQMxExpmQwMn5YzMPBGMjAIXwDqiQYAOQZcLsEClb4AAGmfSURBVHgB1b0J1G3HVR6497n3/98o6Q0anubBludJeAiTbYwd2gGC6UACBFZY7gVNB3CaJEB3VhbQhNW9OtDQkAYSIOkEGhJCGJrEBGzJkrEsT7Jky5JszXrSexqf3qw3/v891TXsvWvvferce/8nyabrvfPfc+rUqdq166u9d+06pwrP+/CHA3AI8RQRmqFxbyRliVdpcSQ9jj27IASwdAVHVxi7l65hcZAn6NlFdOOce4vCgB5Fc5iXdiN1abSFP1/2PrRoUtiYR/Oy9C9Tr7EwNVc4pwojTDFxC0CMI2nH8hwlhX4D5ZOvWwzy9cHlS8FlzhfwZNlyDN2pPlSXwT0VAtd7yTL8+SDuHOvCzzKdyOButIeuj6HfpTXtu8Ew3WD6NpjnALnFuI1IPB9GK0n5ZiCM9H4GyTJhLqAX1GHZMoJK70Etp0tK4nlhLqBfQF08CFnAgPrN8SHMz0N1YmjluYGwNKDnSeV5DEOnttHnpZ7fKBDyuWJWUHnKqWLUsgyaJ4WbjT2nDv56TCWL6gaw0vklrAv/vpD2mNcWrTpAI00+H9G0G5XWU/1gs8fBSCM1gMq/Y/d9BzD3WiqUpS4zQakyBkDQ6k7HQ5uZi4CgQepphJE66DiuC9PM57lcpsU1auA6Ul1Q1S399o6mF1qXFDq5NbyHqi7QoBmZ5wp8wdn+3G6o6qifRV0vQ3QtbxGwPUbT+RSXeEj/NiUyqQwP5BaIOw8Gl94HAwTKS0viXkk1fejeru02k2+jrNb1gE7d4GA7YwtEYYEtHyhN0HWh6/Q7AQV4bmidPwzDaF00rbpdGnHQqI+vh26LoPjNdQCi3XeAlL7zcaA6g5PYCDBqMup70xahvpK2DkMACmjVvc4904EFApL08dJgAAxVUX3OTEIlFcYYigooPi9fZ0nPtCj6fKPr+2MSD+fUARzNDBCJ0yBR9ZT6qjKC8jRImcxfvuf4b84pLXBdsG1bG94pLSL00i0taHpdP4rv6XnoOiut1aDSaCyYI3AV7aM29KAyc1QwNqSyZ5gHdEcM7kbyaAXfmOYg5vaF2MrQxCzFGFZ3Oj9dH98xPc263t0YQKAdPCA0CHxn1CDo+Z4ysSQvrovTPjkksHCdoLYDtOpCaY3AAZgvYBjABFShWdGfjs7VKcepugSiS3dK/6vt80HHUnVfalA4b2CHDROCG1uDmM87dd4Cgy5HiG1I2OB6uwEC9VhOhxosytZrSSAg2nU9dZ2wRT+MaB+mXwdtd7pD6qJA3ENtQCOxAYZ2d6M+Y3w2dQEL9rntQXXSAGOaO2f+zcACGZVwMRJZ5QtULxE+/OvKHAvTFhMs7bZx5XyOVNZg7kAxT0nkTkmNVNFunoRz6rZXKi4xxvR2YhoDm5ntJRxxroJhBMQtIHe+vj6e8muBTMwKJgFqg/eUV0/8aNWnWRfn/QBV/gDUrh2w0Un9PZMv063axEtfXxehn/JhgdNzHRoDQM2fWiU12Hb3OMyV0K3KeDAbadUA8AQsIDqVRqS1VndOOoCuWCBmIavgdE0MI/D2JCl61eAi7RSYWVWO1Rddp9QN7evQAnk5tJyRUgemknQ6rgMfyozyoNHqfTDo1PWAtkQWuhttxveB6lDqpWtQz7XG0HTqw8fNFF3mOWU+5eKcRNYSG6AN6qk2wNHZKWJPkgqQHstSFZxUpvOJZhTlNaHryQig828AwBFzoFQ0MQ8ziDOYMTGhJ6akhq+gnjGoYWjD8YBEQK0GFbrjAYyD2AAhd6KSFQNZQBCcOMDaTj1wfahjgjU5pB7U2B1UbcPqfCDJuC6qzYxWTPGR3xPTBqm9dD1R6gLAHdO2SSDaU6MJX/u+CA3XMWdES0edk6UzUr14nNDxs/QrfnPlANBSnmkKCsNTQ6gGk+r1A3uR47ykggrmibrWcRbQLOGGErEVqkRT6jjm2qtG5/MJAXwGwajApunhB0QODFrTtECd03VWwmk+1QqEobnBEjrTXkDOkjkBYUIgSHGmkyIaST/wCuCQnk4ETW2TBOSBSei1UkMDcJlFkBBPu0mhnwA6I3BO0nlMs574SrydoRt7Qe0A2VRRYDbjKIVRI6kpvpgcaJWjrkCnC8Wh50I3rkhhdT1RQJ5AZaIBNjZUdqOHDtSub2xEB+5YTpSQM2ApUk0PaA0wEF3Du/qBBcBE1Vnbn1wXAKtxuNzg6qCBrTtlp0FO5Zl0YMHMdeBfDUoteSe+ftxhVVov3TWPQNOv24bbIZ33SaOU81mU4h1pmBkdPEBE6rg6yLgIQAb1fvAbPF0UN5hY0b3GxI+AWYOXwTzRYCYglHN7TzPQgDoUM0QTUCUrSzEl4bCaGTOodhoDPEvr9Gwo5kp+tsOB71ZLpPpb6DYN7+qLyBpJaRwYDqiCrouugx8HxLqzNJ5BBbnutMYT4iUoCYNkBhWTCJrmoBU0heaJ/Or2BlUbMjWAgdww9aCAWOoQUnukMgjY8VgHEBM3g5qvCcAz6vxsZg0EkBIOmsfW5OCEKpGW2PMkM/fwdD51gJ4OAA71GfRmS2oAa9MOJxpIMkOpeJZiufGKqVFUNWSmiS2HKObKhJiuxw8AUMtnerDS5U2nOh6gdMD1YL5hFZYChfpbxwDa/scMBLYnRf1C6aCdgF55CAhMpmWx2vBm4Ad2LMNAnrTa1LW/RkVQvz0SqEmbzLDSOyOAI4E4CyqlTGYAYusz9tiG7uhX28/efQsNoFsJ7aTVIjNDwAkV2CsUxyCepgEIn9MzU8VII6mBTZxu0Mm4LxZgFk9HH9hOLoydEUNnGeCJjpAlQxo4zrB6C/TslkhodLYmWM1R60qgRjAdskq5CuiuYkB0pAZzoQVIqiHVAXPdZoE7axBg8AAraFDTL41ATVsyLRMPaAJz4k+HOJDURZr7+tiKsJZhM7AnwTIjzZN+14nvqdz19BsHjetprBH6iq0krWO8ES5OUouzAut7MQxs78qbagaAIV7hSR2+FwuDSBJPiTHTzsalgqY0us73FSgK07vCQG0OKsIDeQuyT0M1fC82clFjEwZ1aphQ8u9j3myKGFCr+gFJBRiRVtV0AiPhJtToDPTKJwvu5KGRupBUyx0T2EYO1VSCamumDjkDZUqxlA7VG1AHuEPtqr0YRiKHInSqhq0dtQ7WM+VO42DtlCylCdgzoT+QidFl4dLFmGw/0zQ3BvqNQM64i/HrDNqgXsrCOkcR9GA4uPc7FKiH73JQZtq3DNBQXQrMGsgGxJHQBOQVD/RScJVwWCUgWEEjhBYGBlHB1b5ij0Yqm+w1sTeBwIDk4bAN4AdTnZNqbFMycLWZNAUwEk1AQLDNT5PNL1PtSH+oSPbozUgDyYAqJliPfzU41sksYcnNklGm+509WQFNNjSoekDxykwRlLSm9KFAll18bIYBtbuRNsjjGDVucQIl//ZdHiCugRWWeZzUB4lc122OzMnqj0elVVEBHxRd1YbGxswSWneOPrRknjgJzQBeSQXEXlriC4jzgWAGi2xf8UBjU6zohaurcPnmzXDhpk2wfTrN6VJYiww4urYGz545HY8z8FQ8nl9fJ3VTGmad6ElgTnlP2FOAIICBUAEFaAFQzQ0w9r4e3IrXgyVYKEp4c6J902a4YssW2BXrcIGifT0mObJ2Fg6ePQvPpuP0aTg163MjBCqnF7o7GkwFMg0YLKTaMZCEZ5+8FUwMYgxBBniTGDPpap0Sz/PAkbr6aqR9T+T3ZYnvkfYdK6uwQoPztShNj6yvwcHI70OR/wfi71oocnKSNVDRmKklspuuLzRnV12H1L4I1P0K3mKesZoQLRAxwQCgvl0Itl49COKNIBLhBM5tJ+2Lbb+z9zUXScUgJRBHBqxgjVtByEcBeKxsVwBfGFmBsDsy7y07dsDrLjgfrti61fiijXoBG1Lc/pOn4LaDB+ELR4/CExHoE6h2bx6ksInCg8v0r3MAgDqZoDutsZs7HhBSJ8y9IsDO1RV4285d8MZI+1WRdmjQPhYeO3kSPnv4MNx97Dg8d/ZMAW/uOB3Z0oX2DBJkSVht7p5MFxYG0oaBtARWLcJ1wcD+4BA73Ap89a6d8NadO+G6bduk8y0KqaxHnj8Bdx45DPcePw6HI8iZ71nDTAqPOnLfFewEKLosZDv6LCIBtmfXjwCbQd0pHgplJJmDaT9Kt+MjHwk8KzaQ0NAYAPJvNicSgK1kLkeXpfCKiqu2NKu3ItleFpn4zgsvhOu3b4ctkwm8kHB6NovgOJLB/cCJE1k6BG50UDNxoQ5okMSz7rzae6HtzokAuaS7LoL37ZH2V5+3HbZON/w1mwlnorS668hR+EwE94PPP0/mRPWArIdgBl3F2xGMXz6HUA2PjqU0qAF3KGB/VaT5a3ftjkDeAdsi7QHOPSS+fz7Sfnuk/eHIdx6j5MkUoj0da3Tocx233vO9XsxGGUuE6n/n+vo3FLOpvDMCWrtl6mDASWMA671g4HYKzPE+S+gVksgrnQI0VKYmc+JvXroHXhGBPO06eDFDqmgCx588+SQ8dupUUUuIakDGDAABM1uKqEAsPmg2LWg0tCNKte+96kp4RQRFt6REWzakBrvv+PPwB/v3Z9Ok0A7i1eBJojqrCKJ1St1BNA2bUEDSOMTEF0VT4u9ccTm8MWrDTS8y35O34gtHj8EHn34q0r5WXHohmYAgIE6/ZxuA1qBOgF4nQK+HOljWM6UMaDZD+Bp33Xxz0CaHnhmc52NOYNbSeVWBd8VdywCQ7Ll3XXQRvOfii7JkaIWNSosxSCVb+2PPHYQ/fvIJksQo7wME9aAfQ0xATUJAsTETs1L811+4G755z55RbfJi0v6JSPtHDhwgW5VnRosZUj02QTSOJyKra3LzrcZn3x35/k2XXAI7VlfgpaT9yNnE9+ci7c/KmCWZSwLoBFqwYD4bO0MaNM76XtLMwIGaB8TpnREqS795mTvurltuCaJuQzBvvlW7y87wMWjT+aoyMzKQs6nRxQFGBfOUpNv2CIIkHb4q2msvBkOXZfDnjhyB33p0b2Za1j7Kfg5gvTnFi6EnWbJ+jwDu4G9dfjm8ddcu+HLSfmek/T/t2x8HjzOlaQqoxdMR9Dsiyk/bFzAngfM9V14B74yA/nLRnvL89KFD8B8j7Wtk+qUB4zowgIskzucB5HyNJHO6z+aKMT+CMrNC48MHA2iwgz8D6K4TG9hIZgEzCLg3sX0NNOqMBe6Oqu6HrrsWLo+j/40GPSgcY+BY4LTPxFH5P7/vfng+AmNKkpols6TDAuKJPFsAcX40MX7k5S+Di6IHwOcbXkKaOSTT41cfeih6SNbFF6xfudQ0VDdnAcN5UYj841dcD5cpvnvazoXmscGuj9sXTb5/8eBDcCJ1yA5zR0yS+GwC9qzPQD4DUCV1qCA+21vTQ3zxLVDT0XkwyygZ3bsWQC4eBOuLJjuT/bJTSsv2cpIS26YT+B8jIOaBOcw5ACzzwxLpfdqLIxj/yateCTsjLezDLrOWoUz6xCN1wNUcTxM+8cGdEcwfePnLDZiXpWEjNM9Lm9x/P3jttdF2n+aIRHv2HvFv5j/Vg/hfbP0p/Nj1L4dLI99btL0QmmHJuOS+/PFXviK6AKcZC0lIVCFZvDlm4goAzNt/+gDCKGITsymY2Vk5x6HbLoOYZv8Q0cyUsSuLz6eB3paKPWwaH/yxCIjdDhAA4yB8oWEsz+TT/tFIy7YotbJ/FoqfXA9icx1K14etUdP8wHXXRdpXR8v5ctCdQgLlD0RQbyVbMQsNHnhD0pQdTV4V03FTbKvUEa9wbkRd1osdxvJMwuSHIh+3RH5mUCczKJDQwzp/IJNYIRiBarCovEwcPE6rVG4k4BlCfmlHu4D8Sy/sh8xqi1Tf9111VXTUb5HWCvqAL++RQmrg74r2JKT3B/o+D/hEYkDxj2fAxOM7or1/6ZbN0lhfrqMfof2yrVvgu6++Kr8TAQQMkWpQ/L1pliIB5TuvuCLWdcuXnfYW3SlcRXzPcQqU5lVWsO/PdAp7nZPMgxluCnV4pG1JgIGETrf1K5R62rcQRUzNPE1+xB7ee8nF0c+5SzLVFQwNTmuwvxghjFy/OQ7s3hcHeOkLizRb1ZG0Tu8cYF80y7suvhjeSIPXVj4vEomjYYz2115wAXxDpC3RWKamifaYgGl/T/RkfG30j4/l81LS7vPX52+LfH9XpCthIwuTAFkay3Q8VN8/v5ZbDmhaDC1wdwMgq0FhzdD2EHnHFqDOygHbL2UgtXtlJYOCy9Ijz6B+5RysGmkBeyMNEUae4eu3RffbxXGKOvFWXm/MXoEeLki077lk8Py5gOFcaB4rj8+/Mfrvz4/2cT8rHbC8OlDAvCvOuL7z4osG+W2E9hdCcyten39LpP3S1U3lDUEynXhsVj+WAPNujFgIjEXKK3umDCaR3zdBaAE7hQ6UkR7Um1dQ3+LStk5ShcmX+LejykvA4AoxOMNYhdGCXqQ6Abtn6Q3LHbAgPvnA33fl5TCLo+9AhfDvt0Xa03sNPh9Ysuxl6Fg2bav8RNu3RA2TrvI3lUR3mtj45ssugy1q5u/FouNc+Qzu/LyIif82mnKJ1uyfCEraOiBrSZzGb4IxJZH1dQG2KlQjXq7pqvYO/Uph8QTwb5J2aaYnzf69Kc5E+RoGOg/+gJGggM00eft7meAZy9evjur7+jjb10dQJ2CvR4l37bbtMf78QVqfz5crjJX/hl074cpol84izcl0Sr9Xb9sGN+zeJWm/krTPK+/1ke/plYdEM7/fzC9KCZC1V0OeVBIZrEbnIINCbTvbN++GtrQBNhFUZqSi37CfwTuiAz+5YzJTcQnGkgTmY9DjvfSmZzY6uHRF5uPN0aY7G8GcfaKR9q+O6ppnE33ar/QB7vyrI5+TPbq2Pst1+Np43QLyV5pWH59ej/jr0aRLUrr40QO9C88vMhG20L71yVhMQeNUBzOZrxN7/Egvol+2oXMhGVTllcH0rsCbd9XB1DKAA1eWGRx6JKrE6MySdm+hNCPlJkm3ParB9HLQjmjbXRslNkC7cb5SoQWQFF5NLxYl2tNk1us03+ErS/uA38Eerzv/fNgZ+Z60S5bSYSg8BWuUZwuT4OI6j3C9iqjpHfyk8QNW8Zu+8k3S+YZoamzuJpaZDqCtwd4ouAFGvR+BEjMjFqVtSY80A/raHTvh9NpaNjW2OvtT/4LLw9/zYUEfW5i2Va4+ki39mgt2RNrX4U27d2fJt0g6Amyc5jAvrQYqzOlMzgmQbOmviTRnKd0HSay/jClvWllvhuDVu+1kzDdyQ//1lCGpB21upJ6WiHt7GmEzfaqiwgBo91h9T38q5cOoaYJDcoNKp6vg6bkhejwSU18f7U//OuY8UMwDzyIwLpMWRtLo+K+6KJlM6/CGSPsi8J4rzfk6WN7XT9nASqAlAueb3HjrNAaQdesIECZbusWYRBwvrJgcPBhEhwh1qW1oLUoLcPpsbqR3Oa7Zus2+orlMMOIYqKcOogwdfHPgs2ZzREVpid2i6Yrt2+DKaGpcFgcqPixdh69QuChO/FwaeZ7q4MMLpd0IHGXmedNg9Hn368PLIs83T8qSDcnlmIM1ksupLgRdMu2hQ2wsY8CJWnlnFcCfvDCxxXZOg5Mr4/RsNufnSEU5H6slMasPrmyowPb0ttKaHsGnrYehfLz7/a98BWyaTJqS8K9K8OSn8+Si++HXvUZo1/LmnGhXHb8lCJfOM7QvjQ0cC0gfdtx19BgNxIORXg0cm3P5rhBqvQfvcmAjgzCH2rKEVcgumEs2bR6kNwM2fQ5O/XFd+grQfA9hYBer7IRWbUMbApwo8WYIh0u3DT+d+qsEZg7ebEjh4q1bBvc3Srsx/RAA8RyedXlou9nPMbBQ27N5c563KFI6qDqotwiDbetyUgnUpE45A6uiw8iKlvy5ePksP3+wG4BeVezzSygepIqmltC00tql5xNDiQNry+LQeQ7UFXeKAYeGQUu8ZVTruaSFBenH6FgE2IV0NDr9WN4BRm4w/9Hauj5/LZUlPQmqHXFwuN6XGc8cJ5KvpA668jqP0OZANTmCRwC6HqJBXpbVKgPR4ktMZsfO6LIbY0aABpBhhOkuk7JiZTud1BXbWTSqpeq0iJBmXxsN55J2o+mXSQtz0hqgIcylKbQyGbFpwlhGMJBBtU2gzNjmla7y6wdxcIjsqXEfwQawcxojKqR+A4X606QqDyxYaPlXypzX880zVfHgT96NdG5wtRJllmVogkrw5/Ix74gEIddKEyXWQqg2dtBV9OmXCBtI+pKl3UhoDZxxUVqvQkbas4X3VnwrTQrJbzyjl9nSnbqVSC2B1zSEUZpraVO9ZpgRYnrWAvVqOQRqqMtQycIuDTUwhmvd+42QNBfjjGlpHNTPeomsymxJa/ldwgTxfWHs2WUat5UNwNDEOJfgeYwNXrQGS0IDQ2OJCmi54mmw5myNSD/5S3bCDkthvY43Y80WhgYAemZX1uXwRJjtD/ggiSrrytFUJS9Ntdb3g3zsicqfajSo7AgnWjakUV9OOiMo6Y3OjgtOKyiEaknuA7rGsDcd6apcHwZAddoE5jy7LMq9jdx8BNtpuYFawqiBfwFmq6eH8WLzvfTuD+Mnf4zc1wWBAjWG4C/Ubwh9EEB7kMivNkEALLAlU6xfIMfrQ2fOwrygwWKkMcVBsCCE0KDNSxmVN5Fd74V2A+j7Uvw825oBho1ygorXtGObJtN/VL76PuCweB1QlTsgtQHkwQCYCup7MJqMXzBbpKX0SQAYdGauc3BpMAyzPr6+Jt9FzqROdUGg1rs9GZshGHwyn6ZjBGu+lAWoSwHF7KjL2aaIQIXuP3lCAGEc8uAq54HrCmaws1aQ4FoX1X2fDUtIkZbqIS2dg6s8qvOA7lmwwJdrBa65aVs0jKQfpNW9YSRt0M+4zqo7aRPgUPntaWNBpNtM918tBExnVcW0tG+i8eDpM/myeMxC9p7NNNbQdSLXiX2Y2loHVwt+URTM7J9soQCgtkwL8PCxYzZ3lrrQICLYiqP8aUgc5rCTKMF3UXAA1M/qcnF4v2VqoEqLwdanNXtViXb5jkk8Fy9pcTytpFEAb3ouNPhCOy8BH47w3AHID/SDa191a3BtOmX9gX0nnidMlQ8VeACY41AJR6jxY9u7pTynLL7NGryZWDRiP73SVwqoawLnRbiB4xAeTUtYETe0lOW6hFYtVY8HJ0m1JNeSkxvJ8XyYt6LBgEpJHANULdl0owebdlAejv9ii8hGPSUtzEkHVnJL3Rp5SRZhPEsxl9x90xah/SxHDPgPDUHUCEWDB7jr0GGpOO/XUsZpYCS0frfHrO+dC6x77ph3OXSFmkcI5uWU+hJRaeWT6zP40tGjlWBVcZM5MyOoHti6Vs9YOmqcgF3HaSkL4xJSD/JETTcaEjXQwdWlBdRBy4/ELUqLjfLcuQGzT9voOIYVaNvItEGjOAN0V2xwYNHtxGj05Dx8/Hgcd52Bmiw4XLmX0EKbxRrYHYQxTquKgj3MwuEApJbLikS3PP1UW2L6YlABERxjW+USsz1t6PI22l9JNX101H99fOvFG7nm3wD23V2+9s/jgrRjecNIOWP0wkjeisd8H4iPqPjX7Bz+NrWFFgAtkOnnTMBKiw4f3L+/rBFNpq3BWAB5+V+RaPvpYGYo1Hc5Br0xhCaIZcX5YFe+LEtsdfCnjz1e1mv2EgOlzLoCaF/j+De4Hu4ldx+cNACwkhpUgxIgOK2Ol3vQAAo4oIzdw0baMPIcNs7DAqAvQ4dLq4OPF0VsUNEGS4ARgOs2ChbUrUOeDWDGYQkjH3v6aUCqgDYtZgrIjDcWnB6bPgxXS5TBoAO3KhChuurqCv8F1M+cOg23PPkUfOtVV7KWg3pSOaMlMmgm4zDeMFeBeHRgFm8eiAPUX/uvN8Itd98Ljzz9bHmJnAYdQHUCfW5Y0GKVC75OX4GAjgGI6pdGl3yetNLVl1wE3/yWr4L3//V3wJ6dO5qg5mphcKBs1FU/Y9pUxfPGR3oskU4/8sST0YlwHLZu2SQTI7LhKNTtLVodRM65/VT81NOq24l3nLITLOU9Dl54G4mxefPytIfKpIM/2/84vPuyS2HTpLG6KDa4xyBtiASHU0D9S8/pdk2ndzyyF3783/4ePPzMgbL1wuoq1YfBqlbsDB7AwXSa5cKLhWzceCqsMSztUF3n866k2H/4KPzGh2+Gm+66B37m7/4teMdrXmUpZyk6B+iDENrxnkYvqz74+OMZK2kfFiD8yC6yAAN7uXo6lM0DNk0Kxm3H6omEtAUwsi8aRUqXtdgrqvKn5t0EbjvwLHzi2WfhGy+9rPoudal8GhYzh/2ixdNimSRpCPgp7dNHjsBP/s5/gMfi6HnTls3QTTrgr9eFKUEDur3Y4cbDQMYtkR4b58uHgmVU1ygS0KwBR+Ixz8LF2ZS9Bw/Bz/z7P4Y/+MkPwIXnn2coCiOdOYTlu62ZA9BgJto+9tRTcMfBg9CtTq0NjTwwrGt56y9jqmljcaf5YTYNkiZBNhXQVLIAuSxAy4tts0rJ2wuThJ5EUP/SPXfDDbt25w9PTd6qsAANldaQ0uLvbIlrVaf08zt/eVtssCOwGsE8XZlGQE/iDVkCR9nwQWyxcnPcLvurGgyUFS9kKwoAMMsApO/30nINa2uwL0rrf/Whm+Gn/vb7hnVWPAdoyqMBDUGZE14ia1v+udOn4dfv/SL0Xfr6e5K1esDi/O1J89e9cJwLD6qQLQJMVZqk8HSebPAyJEAFcJbUNKuTpTP9TiKAJtMJPB5nDX/v4YfgR1/zWjOy1p0GWtKAJQHdN+mGnXLA2Q994V6YblqBlc2bIh0rmR7eT4VHzWIfkqQmWQ3a1Pr/Q/DbaeQ4GvnJFhRpu7wcn+od22wWB+y5k5+FW+970OQnPGAB4u61QmgkYsmsaWP6/t9H98IXo2t38+bV3DbscgoaxIRP3oexVtjZlp4W0CaH2BlhUEGZfqSK9iSlda8pNkiXiVxJ77hGSfDvHnwQrty2Hb7tqqsNogNn7mgzQlqBGHUicNJApU/k7z9yDFY2rWa7eZpWbsoSgF5L5IKdk1zAremDNsMcKXNDeInSChFOl5PlXPmFtF5cR1I7DeLTNlhpQ6J4/vjhozUrJYb1Ng/6RGNA32e6/edP3u34l3Eg+Cv33AMrqyswjeOrpM2hKwLH+J8DezawmhoIRuhUPljMmlFbq8FEMoeqzvI0JZQtEpAkXsZzUh1RVCdCp2m9iPUz8M/uvANu2L0brti2XTJHpdKQKiGMUi1rOr+Xzq4XiPaJHapLpkZaS3lazA1WU9zri7M+iATQqkyX5XnDHaf1vgNAm4e1OkPI6mLQp9WFjKBd6hwqoHl5NqzGdH5c9u7uijadRFCtr88smMGaFyw4vAbVNDNtehZVDgXmJ54/AT/56U+RwEuAnkRaJlmjyN7lAOKA6D0tMAR0K24KDZ7lc2r0uksnmvqwlObBGm+VkBmWiY5Xqz2cOXMWvufmm+DfvvNdcP35F9AmkZYo6fTEiWDfQm2/3O2AzDSD9Ppim+XdmEKdgSrbKBd7LZUle3SEYkblvLyNpKSSLns0YCsNbjytL9NlgQElNQOnjHOwbBQPdQHxkjDfibwJNOZB40vWRQlQwljZNVp2/3XWAS/X9cSJk/C9N90EZ2K61diRVnhsk9sIaG9G/R50FTS8G5h8Fui0g6Y5hc7c1IMk0lu5PtTVOHPvpzbraEQik6E/nRbTI1XgWLTb/v7Hb4UHjx6pPVcfjpONCaAB4b5Ckm9Z4zcDOm+yQwxjpuV9s9PCuVi2HS4b8WBNg/W8z3sFduZ+jW/FdYP82mnxHNI6OmIdNK25LnIfch3T/bQ7a+nENW1S8XkgNumsKefaQeJY7atGD475DH7pXJTggcOH4e/d9JG8WedqBHI6knTuJp3gSBcZNB3KzNCf/8EgroYpqFGwF0b1RR0U/SNTkYhkhvB+00XChdz5yzYDsBIonwDPnj0N33fLzfBPb/gq+JtXX2PVujNDRFqHBoCVamtpZt2oxT/Oe/uhbFzJEkBLAlMO+g7TkK7YkKI6rWHkBtKCq5BPjzpLvbBmbT9eLVb+kOTgvbtzW3WlA4ArqmVe6JccXbOZKqA7v3HfPvi5z34Wjsfx1OYo2FbjuCZJ5zJQ74rggerVYJdw0fb1qyiRcoxB3wkVhqfMS6cxABrXtQdVYHPv7aUiJbfiwpvStG5B5um1s/Czd3wWnj55Er7r5dfDedGW0iZIAMs548NWNKBOr86RmUEHsIQOxcyozvsuL2ySpTiZF1rFNqXPWMAN3NtI2kacviQuS4fmMb0AHRU/gDs6zR1QR2cV7sHMJsigo3s6sJobYi/H4+jZM/DnceLkf7/jzuzx2kxATho7gVkPTGWvcuqsUi7jF2AgtT1PNG3NhWYM0whY+VyjP5SlDMoItPai6oHA7P7tphORGskaOLO2Dr9y793wx48+Aj/+hhvgXXmd48qcAahYuIVKQ3A0GymtGhDZrMh7pPO0Kt3vOqG9NCC9P0CACE1mgJK6MB40gWGDaeflrdIiEYNQec03i2sVqRN38tyMUicu9L6OVDc2LTy4USdDa1boLD7zzDPwC5+7Ex46djSCeKVI5vg7mRavBsrYpjzBZoN0Iqz1GJC3iJfQeJdDp8fGRVCMqB8nltlEFv/lHY+ySHXeeWVSV2fn7eGeOnUK/sFtH4M3X3gRfHeU1u+4LC0yPjHdrSWB5VqBWDc0qywg27MyivbHBm1ysJkSiO7CgaDz9CDrGvdAXaOLgzlpfZqxMJJ3BXX1bBThwa634oPONjPUmThklU6SmkVgUHQEHQfz+1paV+NjTz4Bf/rww3BrnAVcjUJsS5TKCcjpSJIZp8WrUex3EiAde6CoDEQZ2LIlUDRkQ8DAkK0pND/B4i/BRb2PqMNSKGWJaGbeOJ8M7OzIR7OBZ1p+ay322LsOH4Q7Pvks7Nq0Cb7lqmuixL4Krt+xE7bweyCKaiEFhxI7aNpp8ANYJDX7oYsqq1+r16lV8lMj2spR+lbdze+8+EVpF8VBlYrlHBWJhSPsnWHPQpXQJR3PFmY3a+Jbj9U+cNXrnYT2gQVJAvEjcYLkxsf2ws37H4f90S2XgLs1zgGsxl82MVaS63SiwUzg7IY7+labWZXnGTF2j8LiHde70rih2TDV7uGepCdoGHCFoR1lR5t2pj3Bk786VnatW4Nj62vwOw98CX73/i/Ba3buhn90w1vgDbsvqiNrxUwPbFR08UieX/EKaNcRoW+L6QWroDoGCkAss+iLHlAdRvcwGArPSh89q0yKuWkBqixqgUp5BWyfIdrJHu0oF9GgCNVTRav29B2aF314QoNp4l8Wavprnk8+9QT89r33wL0HD8GZfj0DN5sWUwZx8WQkTxeqyZMwUDGoOiWohgzDSoYhL8zkBJ2bdzncyGIYjLejlCIOfCWpAar3gPPN7xbQQjRp0iNJ6TWoWy3vXtkEb9+zB959xVVw+bbzYOvU7ketgc2VNUKVkYEgHpcisrC6nGQQRINazZScB6qBUjD15iv28zINoOJ1lNYYAezNABbYtmrtvJstQhJX92jdgUHbp2xeUHygjh+g0q5DaERw3F+79DJ444UXw31Ru378ySfh9gPPwoEzp2ETSeTslovnub3JfVqkcjUltMYx5xCknaB5rhpd45TOp55BzaCYY0ZlWlwEqC48oJdlggKNPE47amUvCMCrdu2CvxHt57dGBq120/rJTbDMNLadizNMR6RBBw9AFHjp+WK/seYJkl0gaVwYr9A3KKZVeDv5RtLOS18lGLi6IzC1JZq0ZrruCuDZwigdPNW9LLnVXGc5VPzojqabPGmArdE2fsvFe+Ctl+yBY2tn4IuHDsGH9u+HLx47UvaLx/IFk3QiZRoZ/57vwFxRb+uKhaBxOORgc1CIMGSp//5uUJBIarAtpVpCppbjvws3b4YfuO56+Gu7L8r3+c0q8I/6iwaILT1l4oBGSQPnuwGG0Kt8mxnwCAohoKU1UqfR/dkIEh8C2nuhLRPqPTRpAXU60g3iuAikPVhSS2yFeadJwWreZN50ltRgAayBDfqaeMUvqp2/ugm+bs+l8DUR3HceOgD/5oEH4bkIcp223XnRMQGbKVuxHmqcxvih7RMoX4KjtAC9DxCKqYE4LE5G3iqa7dfEsbQo33dffS18xxVX5+18jUTW57XWVkUH27HBVaA0ElKjkfM+qA7lXtDGvN1mLSuHLpjy0XGnIdeqUBkJvt04Lc5J65WgScPI5tC18iquVQSe8QVaSCYR0NkJCmJN0/8cwChvXo+QvSkyEI0Rb4ua9g07d8EfRz/0H+57nFZUqsANHQg2mnWngpDOMVRXKig8tviSzo0fuiWZwT3APbxcl0LQi3+XSa5U/HNe9Fz85KtfBW+Jg76UfBbA+D39wSG430ERWrqWjRXJBYRgjewuI0kkMNh69I1M2xgdioA5WG4+Pf+uLdvWm7UcKhMABCXycr1ko1qVToPSXgbAI4JEYYmAVuLLuiwwCJtjO3/ftdfB1du3wa8/9CAcm/W84WWdETb2L/+xqo5BDXpQDvP5JyYHKoNbZ8T3cCQbrBlAVYzCk/IhQBxa74l+yZ97zevg2q3bq2sogJHQ5hdqJtzJW0HUpLRbJ35osaeNnletzVIJQEkr1zkVHca8Gr0HTg8uEN1G1CxoLq4o6t+guF7Kqnv1odDGg+L8YlJP2qthjgXNE1ASWl3Ly0hhKGR6dfH2iy6BK7Zug5+OHpEDZ8/mWWQ2c7Rg5NP0spVwQN8DaJsc4kWisQ+03HZa2rLNxSYGQEOKq/cJlE0UmNXx2Uuib/J/ffUb4OqtWwXM/QiY5V3cMGS0x1MLQ0H21sU8wma3ox4to3JXFcb1ogvZzRbAlaFB6wE8L8zrjc30uDBv3dSIxUmHZD4hMUrkS1fbMGutbC90xQ5HrPxXgsT4oYPjf2WjlMPP8cJDoO6njUx//g1vhH941+fhUHTN5o29lamErYqhh7Adh4jJYdxc5bmpj5BfY0JY6YagdpNlVQcsjOoL88npeX5k3v/5ujfl7SqCA7Ps5qWYKcwYntbrUM+Hn2WhSCdWbahsONMiHM8vOoogx0Wy8q9EQP4rAGBxE2rHEMFdUvNsXK5zN7/niI8elHRW9yQdHR1Ld/plMi7dvAV+IYL6A5//HDyfHOFsCmqLAEBwlalDmnFW5UubaPeyEr4pzH2XgxM2l8BqPUeABQJzGgD+WJzW3hPB3Dsga6kMYNWbzm8ecaH1y7NRWkJDxbKWLEkqB6xAyA6+vkqA+XyBNuJH9eNI/EbyCPayaht1M3tVwlDFSGU64g00KyhtElyxaCV15k8Q2ZGD2NRKg/KA8cotW+GHr3sZ/MJDD2QTlN/HblW9OFpxXvVH443JYfdVrg/o32GoAxEkRCbpnDYRev+VV8G74qh3RvyVjx6DVW0M5EWgboGMn5FBEBKQlaRm+rVG4YmXOmaszn+v4kYDLhGvicZzzMPFockbQcxBJYmLAGqMfZBMDuyabjvdETS4fZPoTkpkiCFhNn2C2jbfFN16Xzp+DP746afyhBroBQO5h5hCQMZvdWIsGHb4ybHpUjzGsXviECKi6POmWRkEfssll8rdwYaNAYy7bOA6WzJ47PCAkO3o8oEsyzOa9JFrkPNiawcY2GV/BUMFNO+HbU3A6glRTwhgqKPzx6lKW0q2MJwTGITgzBBqQ7HulPmhxeh/d821cMtzB+Bw3xfes7YIunbBncHgeuzeYFs3YRS0TArbOwYVTPZzP4vM6OEfvex62B0d7t7UGAAbykyWH1mbQzEPYHhuAzUUSSFtS/M1H2VNiI4kujs6d+jnx9K37p1zWlycdkA/A6Q8i4Zm7uz10zTWUF4ocOgd7+e1j1l2IKhz/RuP7ZMV+J+vfxX0eQfZWRlrkVoWM4qaUVNWh3fYanH5nXrjXJ4USVWnseug0Kk9ILdJktDRvnjz+RfAW3fstBUMbXNDshgisxmkh/ruyT/80g37rrCtU8oFWXjKLBHN5gtONh+oPj3kay2LPAtBO283nFY3Zn15B3X7gDSRekYzQ8kxPRWKlS8esADtpgijF8N0rOwkwvHzzXHi5TXbt8M9J54v73uI6w0sr5qmQgAzsYI4tKFReTcqb9BkI7OFRtgr1RbKyjzrsxm8N/ofJzQL6D9Pp6SGgWBya7d/UCUX26kt1QXELK2okYMbrVRgFy8I22KoO3cj4AbMkRczLbbSq9E+irnU0W8gs4C4xun5fWQ2O8AKFD43g/URAHuQ61WuUnHyNT/3XSjaOEpR+PZLL4e77v9iERSqg5VHEDS6ZfYwODMDcWCC1IkVIcy95Ic1XoM5AMggsDCgz+bGZdF2/oY4EBQprA5tZoxJZ31vDNj6XkuSAgNUg5pEmbz8wxKM/LPS4AttaNUxXtKgy7Fl6rZiQAfVGUVrsqKiNmKbuZoxEzCZqnWcA6g5AU0WtinlW/4LfcEB1inzBOqv3r0bLlxZhYNRAOYPQeT9GX7jztY7SAGqrEZbdbBsUGq5UkvgTqYGSee377oQtqaPIIP+LB2Mm24emD0zlr2WjpDaU+xFqIMOusZO2dHs1tMLRstX41jvdapzmOdHDnTn89Jj49rRhnw+llbFo7qHavwQlLEs0hnB2MEBqubTkhX8NcC4hg1Drcn5azxcsLIC3xy9HrM05upDNbnE1aILC0uLkMUv+EOVxmikcwDRDInYtHliNPT/mz17bCXCEMQtZkAjDnWcEqymyugliGtoMTPUr5zSm2qctndpPTGtc4ChzD7XtO5ap0V3L5/yC0n0joShHVUm5rrUtX7eVJONfZQMYSg8WjS2Qu8S6OWY33HRRfBvHtsLOOlLpx18V1d/gzIFw5zy7KZBriba3PDACvKbattnQG+NRL32vAvs5Ik2ORxj5klnVRTRB1Vz+oQaBB3NGKRGS+9Dd0oJyeCKPkmCMnUcnA0HG7B9XfHzQ9hY1rggr/rKXnnpCrlRsIKgY3OEHhETjNfm8HlqQamiF5LiyAoj0lyPn14dsXJB1ObHI3Y6Ze4FJbwG5bNpOBKmJoE/x0Ym6CrN3o1I1FVxNihIPAzUmSbOMyHYrEcFjA4BGpJf1KlSxYoZuQzj1cAqybsRCb1IDPm0sGR6nXaZMlxDy/MdGmbkAS91Ho378kxXPUHs6XBFDMqcd3+cTPMrOLCkwuuiR+y2o4dpJ1l6E3IseHzqXwplYqUlnRq1rMCriM5xaZnWKH6v2LRlkFayCENmhJFffW56Png6hs9l6sh2lKqoypeGxkGvL14P+hpPNXTpAG06TJpavPyMpZVztGXk5yhikNbRUYuiiSKPA9brA8mgvt6RASSozgADb9QYqNHdGhM62toRgUeRaUq8P3woC0R24dVdrtCqaHFV4qBcvh68D+0TDRpGIbMuHl4k9OVbNksluIB+RDpr4C8bWkJs8LwaELHZUdIRc9jNhUoasBpOL3KEKqnH+AKN61Zj4pxrXPD8vLRyHqrJkZtYOX+T1yC9KoryDVa5F7ind50BO7fJAMwAoxLcn7faJwV245mBJ52nwWGfPWRBFv0Z9GgYCscxwSFbUjCDEGqeY8xmKc1M6DMxPVyc3qijAoNmDljmhEa+LWAjjEvqUQZifTFJv/OLyn6uJgY/UtaHkI/vEIcEtK49sQDj4mtR5TaSFlx6+hAY5X4BhJga7JqmRkWZfOqaoIQl4lokzrsXGkcK50+nWRim9+YnQZfB4MGBK9CU5ezp5tt23r2XgRPql9wazGn5liyho4djhQcZyPdcviPXY20ZYAhkfz54hiUzYm04ig+6p2p9T/H5o1pwlQdoistip4Zx0Zry7lRaiVwi30Vp+TrU2V3UqMlx/N5KAQfS8g252syjFhe57VqdGRptRTxsC5eaxC+DwaRO0xp7PUvoOEwPk6pNQGEPsfqdEcwYQYfhV9+ukUKw0XI7aNWhP3+d36vDkBeD66YEp5tjQK51ACijfiA7ml1UoZohQNKqq2BnCnLDIwgUhm6JWgM0XgJHNbq0tefAIh1l0/K9IR0y1ymDXPvqKPtyzFOsobImAwGjBnGohGgrpkFpO4L6mrkGbW6ox4omD7Q8c5AbgiHU7WMLEY0bKgF2j5VQGhCDpdB/5lIWlOmFKHaMn+2HKzxocI+B2l+3znXP9irMlJdmvzITOkA9oWDcc7TgjEiNrvCFyK+DDt0qWHsVYKPkF5LW10yn82AucXnhHiGYOhaPAVDlxy8pM3o6GnSxJ4iYyLf1uzatxWf8uadUSg42Xg8INajX88tsALw9CHIOiA47wfGMsBhq2hRGJlawimNNpDpnYiszAhw4c8YkEGKCajMVWsxyVLTvIaiJhMqknBetDT1w2ynJVDJQkhTppKP3GNEDiIjttN5EW1EESxB1pJKKJXkD2NyKUmZXy0NVvhaX4r7p1HVQC3CoorraYbIZxhMrPDBcFEYb4dyCl7VHzq4De8sEzgFk3ZQCZWw8PcRoCnZQOC8IKIPKS1aLzoBK65uNVUKDG7AthwZFamwFlxiH9Jm2V9PdbC+iXo6KXXUpiQyqUibO5FDpLSEAyki2BIrbTzcTQlMkqLSoOWI6VWjGiVyiupTlFwIYkwP7KsgJ1IHfhR5r9OB+/fmisKDNdLGHzpxWu1yR10xWuwrVtSht28hEheZOsnriodanfjdYrtU9Sv+lo0dMVnodZzHtGrgQ6a3vIQw6pCETxqQ3DwRbElmBAt15Dp27bnFtDAXYiBnrdSNpTc92PdSnTzT2TmLnx6r6KnzH+h2UpMX6bjQzUh1sGnAeVZiBUVgGqBqwpDElmvujA3U69j7/PN1U5QGBG5mkOsAFw6Kg+Ffip/OaDsTBbXnt6CfN2MGjJ07YfCihMRPVvSwV6X6v2xOHNAVdOLTpzUlY+nTki+bGk7fu6Gl97Xs9joEWYOAC8gTMedTcHEsrrYbDDu4DWwyo0BBoYRleST4zF0zd9Bp3TSqDJUeK16BDm2asKuZAe53CHYcO5gUdDVhHtLjGoKePabSbBhGAsfGQDhrg+suHE7N1uOfIEXj1BTtECxtCAYxTnEEN/p76Ne6eMKTDS+rgpHIYvHlGQ/tOZcrJ6btCSUu3tAsLtaoOtaEZ52bGT2hScWj7hC5Hp9Vli6Zr8AD1M4VAZegkBvblDbwAMksK4qeHJhINPz24AgxNFVS0oQK/l3ooJObzew4fhsNnz8KmrZuBNWt5rBpgGi8BxgMX01x9NP/wZwdYkwfu/RDcrCpmoKRnbnrqCXgNAZrHKkiNItovDCnBFsGacfNqY55RElmtcWdEBADZ01Dqgwi23+iPZw0LJI3vqeKCd5qESGqmnZt3GD47SKsBBLXs/NupXsCjcn43lDulAnrvf0EJiwDW5Ajgx2IVzKF2QvMsBzXs+C/7HiNw86KanJXqlNJulqGhD4M4lX2lqV7YIU2NDiY9q3mkrZH/095H4ejaWT0e81ga/Dqa7L0W4+YF5eEQWxoa3+Pxd/z6+73WN4PdyDH2zaD/1m/ed4MbyXtuWqx1oLoGXy64Dx8kfn4QLUhAbbE/KNCKpFYdUoSbki0n19fhpiefzPtKopiHXusODYzABSr6NHC6eRXRBXCGrDL11g98JFto/+mTcOszT1WhCCPA5huuUF7rwRhG0Eg7Qi9wBVlKo3rfOfub6yc/SGDgOJQ0uLGjewFxG8nTHVy3vGKS1EXFq06Kgii0nX6kzduMBSudhwJSNLKAVwnS3K2IhA8/sR/2nnietmmuryWIpA6s+RXQCUDBla1De0sKHYEAowYl1M+XMO9PWDYj/92HH4L3XnZlZig6LonPODgGhhEilJrT9yWJZm4AA+QUiV1tSLZ/6/d7WnzoOo/3ngF/5oSXKq0OIhz0tWJa8YagVHXoARqRumCBGwKMaktUJWozE8DKFv54KE1x/+lje8uGUoQdmfhqcMJYCsr90vrca6nN6wcdklWPTCWhmB2JyNsPHoBPH3g2rxfM9rNIaEUTzFFVnhCDaWyrQjZ/RGNojsoBYNUE1MkHwTlaOhSfscUwn5ZPfdpRhqq0rV+X1uSlz/vWbWI+zRnJjc4C2vCzYqZkyd8aNuqi95fMbFM0yJyWO2575hm47dmnodu8iSQ0vaNNhRQPFZg6t+RaK4jJYfg1gvD6fmopzXx7lmzo1OOmUwiTKfzE7Z+EE2trw3EZDPHVbDgP7jGafLwTCbwCaVZVtF5FGIC8cZAnwHzLR6bAeNpuGN+65vRj9xalbeVtxGCNs68AKPOLhJBrYBh0QNUuGGyctB3/hNq+HbTJOnDqJPzs7Z/JGOmmK1kAajpaUleEk2nnNiQkK1NhegI9UMBKSRRgM4PSlrfRcbIyhSdOn4JfufcusZs6B2JU+TAjhIeoDo4Plr/eQtGVr7OBZD8SEbxoIxoQdEbtobI/669dtEXHDY+WPe7Tdy9aWvYu1WsHXKyTKKCAzfaoB4n8jhyadYM4Hr9ilQUTdaTrP3r0Edh76gR0ar9v+QwuI0pnVvFl5R2aejJm01/jtsMBeOuLSkGii+7S343l4vKHmph73GQ2hX5lFX4v2tJvu/ASeM/lVxq1xhNXKBnTj1J180JL60s+Ipn1OtGd6kUMZLAMFB2KhgeguFPobaQdBGKw7f0ATZni00JFy2ASpzZcHXgQHUGLTRDzA5VNwO7VIDbrkNdGcKibTQsoVHKR6sCSmf1I+vjQY4/Br3/x3gjm1bKpUPZwdCJsRKhKmSisq6apIxrrgBLAezkaDVSXX2UGQ2OmiRidXXeTDOrUA0/F6J/49Cfg8RPHW9pwKLFR52aZGRo3jJRGVQctIsTe6ZR/uhPpXJct6KoYaal4oz+7kYq8GGlV2XPpoLQTdHXRYpK0ledHp+IavOSIlsWH/ly1H4N5oorg86dPPg8/dfunIyYCdKvTMiCcVI9T0BkCmEkfng6pn9LBaOhcHUYuGDRob6OKZ/EfiUxmx2Ql2kfxOBxm8Hdu/At4MlZIqx7+1W0EXB+0jJMylQQPY3Tq4XSngQE0cKV7WHdq4nhxebmGx5EDGgduIP2yaXFeeqRBlJEWYNLXDtM4Wk3ueBoabOZ26kCKGxxT+n306BH4rg9/CA716xkXk2Q7J9OUJbRkCCQwa+sHVRY06Bs0v7s2NrLEMZPSuZ9w6RQSsdiiidBJlNCT1Uh8VC9PnTkD33PTX8ADRw4bKe3bwHTAxZ1R6OXReaGHpVpn3/vN0SVeJJh0xG5wjs5nbQ1F1YFR27rdaFpYKm3XTAsL6bA0DydcbBsBS22aWGHzQgRGsKaHP/ghxpluvwmBin8fPHwI3v+RG+GJU6cyFiarqxkbWUJrDcT0UaMHwhpAo0NhbXsfOhgBSTNoCY1Qu49Bo5bSkfhNqzDdvAqPxQr93QjqG/ftNSqJe3h+NNjyvStJ3Ejuvr7WYBYA53g1KGJpTGqbvR9GbWu1bI5W3Fj6jabFJdP6vMlkEoaWZwIOTZb6+ijV3fFRL//FfGfvRnDto9stS2k6WBN//Mn98L0f/gvYf+Y0TDYXLGTNnSSz0Aa1XRAHps4A7GBp8KEbfbCRUQUMqQP5pY8tOyWBaDfRrGJSr9y0CZ6brcP/8LFb4Ne+8Hk4G8/FAwJOUsOQeSKFg13ERjO6dLBOJFzQnc1LbLpn1sDDZQ5YMl1JixtIu3y+7WPgmlMdeCipARaqPxeUAJUsuO20kEpt+y9jG//AzTfCkX4WBdommCYMrK5kTGAyNzplP3tBKQV6c8QR3cCo9XIggneBYagP1BdPyug7u8LVtkeBE2WTFYtbhhFHjF6P5sc/v+sO+I8P3g8/+7avha+77AroqGdWVUOg1nWDOZpDh86ty6HB5cAMUD69yq3gRs7NkSnfaxHCBBpCUf1dIm2rks20dN2P01FeUIK6vFlHz6e6zpQrb0HAxq/xXiggJwR8dN9j8HOf+VR+BWKyGoG8aSUem/J4aiKejfoWpOSM5aW4YsLWOQ5U9ytGHJCVN8h89R0aFZFzLDM5qKa+q1slqNnxOmLNg5KQPB6g7K0C7Mejn/oHPvpheMeey+F7rn813HDRHtgeGSBVRD26tcQNANJqhdzhnBRj0KBqZE5jnsd2nq3zVhos3JlLqUeKxDeeW3qTG2jYA1TvvHmMykd3Wq0Ng9WGuh8PqkTnZ9bX4RNPPA6/f/+X4PY4A7geTc4E4mxukmROE27JA8ZChds56GxVG/G7JxnHlD40qleJK2G6kEdoMxGzQ14thboXAYRqKrD663jbsSlotdrHnjo7uwY3P/0k3BR79cvPuwDefeXV8O6rXgYv27ELNiW1BNbkgAXnOSgpHJRak0EQn2dSOjvBYEAwYMNyGkLS15dsFvVAk3fAdiO00vYqQlqcwMvCINU12WhZCyW7OQBPJmVtZmy6eqp/TTXo5MTZs7Dv2BH4yGOPwI3xeOLkiTj7F8dOEbwrEcRddgqsFqkcvRri0UD13jNrfmTgwiivREjC/GA3DZITBPvmfbkZ2Mxwb3MHrqn+4lg5+vOCgdk/XRo6/eu7AvY+MmEWzx+Obr2H4szib3/xbrjhwovh+197A3zd5VfDhgMDtkPTgXiWMDhJXc0SVVVss83HLsIqAixuAZ1WnczLW+LJYrB9oHzRXn4Lv+sH4gG8vc0dQX+VrUNo0Hd3lML/4vbb4AsHnoX1DsskSQTylFy1xWU7zWDOQJ6wZGZzIYCxjzletw2otmkxZKSNllpOV2cU5BoHta9fW2C1a/QX0HmwqOhR7qjLz9sE33jJ5fDeK6+BV+68EFYi+oMzM4x6GqW1SmLjV9amBzOqQ/uc/CyHQhyLDHMeWFLM40bSpj9iR6ajr5n02ZAmEzTxJdS6Iw68HABK0IfBcCCH1128B371ve+D+w8diJ6MffDnUcMenK1VIOf3NJyfGSwPeE2QodStLbwRjcjB7LEy/AwBbLycC3KJokBblWC9nVxCZdM/Mt0C8FfX2CO9btrD11xyKXzbZVfCe/ZcASsR7bNQN5rx1VwUcppOgVkDubMvJaEGt3CW69nBUDb5EUZonNM1wsj91j0Yzwtxflpt6HLaPCDsgPe8yRvk9sSLvD8gVp88DYbFdlb28wDkQVEY/yST8IaLL4W3xPb7wJveDB9/5in4w8cfgTuPxrmGSXm/pJPBH4A2NcoMZeE5GlSXOkg6biO91MPgdQAbP1w5qRVK9zbnvKwWybXKb/TdOkjanjiVlOE1286Dn3j5q+DtaR/DvgBY9jNUDB0DdvAHdyQjkbvqjyXah+48MqMKp3NupYrooIgiO4LUDdTdSldJg4oDnq817xeWlmhGereG+V2NDRnz8DYPdrJo6OUII7+ozBJjosRjJZqT74neqvdefgV8/MAz8MsP3RfnHU4W5QCVd0QARTZ+0X16pXgglPjnJEm5njZvclwYkYvcTSEM5IecZYEXKpMTE/JK6D384wjkb4/ejQumq4PdZf1Os5l/oTYoV00kCJEpzB645kDZyQTgfG1n30QikEEq/VMGEIqXUtdQCcAKtIIdFzfCRsKZZtsG0iJotMueNyqS6ShNljpzqLzocCAg+BwaUhpIe7KXk/dM4SPt9Z02rH/Lrt3wh08+Dr+59xE4lRJNwCjCIZi5HIc3w3AcxjfCYLHGEQib3o6NpQ3Mjp6uQxWA9rAj2lX/5JWvgW+95LKs/WYklc0Os6HSMSotGnGmsomU5kQJVIYydjWDU2C7us6lU77BcUP9emnirwchuLS+Zv63kRYdkynfMGhN3TtJCqIaFFKy4A+wgqRXxfAneEyxFNMVUG+N5sj7r7oO9mzaAv9blNbHs9dlonSLpxABYBykLBs8R1ph2krQAngrs0DgZmmuP60qpwhld6weLp6swK+//k3w6u3nZxNDwByUuaHALYAOlo4x2iSQe66+OwwCYuOX5tyQGQq2dTqcwxVY4t5G0uPwXFwX6l4mrZEWgpIlLKor+upileX5Ym3UOrbmZ3QI6sSbHTOlHWbBPvM3on39qvPPgx+9+/PwRHTzsWjX4GTpjKrTDYVUW6gN6IM6tWAOL4sQYKBua9paQ/SFJWamrSo2bYbfueGtAzDro2+B2REcWoeW6MGWbSkFhxtqhczNAGbRlnlYNJxZNpxD2mX6COLwRnNixj9cz/0rBgOtDwp8dF/zno8kmVvteu2W7fCrr78BLkoLmye1TFPLlhrukFWGLzo8jXw05z4HvJxjsyDX0quSUNb73Rzjf/N1b4IrN2+pYO7L0fcwvmWyVn3QALWTBmJzEyDlKwZsdEiSyhKvegO6f8OY8TsvVdp5sRr/ui9WBw4qa0vlxgNk02YDPMt173ivN1RddyBed8e1W7fBb0dPyBagtaB94wEqqylsrP+DqjDwywz+0IlEPyB4VW2lYFCMKVtUhNkMfj7azFdu3poBvM5gdpI5gxvqN7cayPPUod9mOf121FA4QLEmHWGABu6aGMwnYKDOFx0vVdrR9GDrxSc8bezrzQffTrzywqS5lTUdJr6haVP7roXazuuUJv1etmkr/PT1r8wCToN6gF0vPNER3sKnGmS2306ZI5HtbIdlWrlVtkhOYP5AHBi8e/fFUjEBtTv0xucMYgE4wGAHWi+5tdS4dss2KHYYGrFleRHUOJElFplMga6VoMCRAxZc4waePae8pV+GKoFd29kxMXVaSp037HG8Np2l0YFyeyAd6lltcmTJDOVYU3HfEv3W358+x5uVcVXGClHklbwZ3Noq1Yo1wuLXrRoZFdwSBUEbBMVESlskvyqqme+Mg4Je+ZhbPV8kQG+vPWKD+pUSdT5E0jt27C43mvyocAiidSiepjnrErX+2QYrFlzDBp49p7xFyhH9pUe6p+jJUCU9R31TFDYiSPQBVUiYNoDKd/DtF6yEZxD3wQqx74mAvnrTpgzoIJMMWDMUTJ1baAPaZ4g1PkiN1G8oPSrQILCLhP5InMK+cLqpAlnZzTPFjL53IFUMazKTy1MdQXeOH7z0Srgu2ut17epGPQjwQYMXB4leYNhoo5xLIypa1Xsdhluo40udE2+u2bwZvvviy9rjGA9saJsecg8aZkivzA5lelwQvV3/8NqXw2w2K4PEXm0wDgCGD9KrYNgsI6BfOChEWCClGOBU2z5K59dt2w7v2nWRVJQrpE0LPb3N6o7pbOBZ953BoRti12QVfvaKl0cpsBlkyznJQzMrEB898AMMnbLncsBLnD6AbnypR4BBXYJOE5l01epm+PHLrxWBMwsLvEtt7EBotQmDnto15w9qvBSPr9mxC752x84ipUN1OdbC69ziMkFjdKojszkRQrNSOgbliTrNyv7mZDt/Z5w4SSKhNdhoTW97Bo2FIKWWIPtGh+oDTRL7TVvPh//76lfBfzj8LNx04hjsWz9b3u7Ls2MBZEbFuQXqYBEWE8IsWCaElzAtAAE5WAQy4Gn/m0k8rooA/przt8P7d10KO+Lkx3oYd5kOMDZGQgDxG3DQryuke6mMVKX8Bkc8X8UJfOtFe+AThw/n5eOwo0y4QxIOB+MBqPc8G6QZr/zc54Khbiwl9yRmlJIU6R2NZOj3a+tw9XQFfv+Nb4Wt3VTUTFY7oLwZWiipopbqlGgHRfqrCfP5fGfvySCqYRsvwo+wgXnOeVTz1CUcVsV3xrFyWhdhIWGNfILVYPyrJSW3j0jSoDxNUCXuouB5qj+p4+8Lk+Rc6cpMXvo906/D++74FDwXZuo7w5RJZ8c22mMl5gcOC6fQ3tZtNDiZGhTz8vbIM3jHzj2wXfX+BGRjZsBiMGsKsEWCAk2vHkg/HVeqr9O1MgseKrCNlFV5oqNBbrtxCzSJs7QMgmOvATnXqdETmnkpAseEQQvQRlsqU3AWbHuMgVnzReKUlEZVJn9bkLUoS+oE8FCmx7/9kj3wm0/ui2OuXjZ6KjPPAIOGyVEIi4Te+PvQwVLcYnQVA8U266O58b7o2WBm8K+RyP1iMAdXDEtkRY6pL4M6v/mbpA5JZ1ZzvDa2dHpfgKOhiXdsly8NqYGH86VqcHUz5PT1HsC8hGCcA2G8OBEi+lcG51B/Nfh9xwOY3y6jpgfWNpAxFYH6XdHL8hv79kKYTgkYtOmm+WKBrkE34niY/4I/jkVaSBbDvoft0R56RRwQ9r2VBMbPOXi6hnmN0orLL3sqUAeSCtnzgUpCsHRmvsASQQM2OECrziQrbbFBD3Pq1ei4SBfVC1HycvJETK1BXvPAHCyvjaTW5wADIeTzHGsDqQO0EwTVBjKvEEr7vHr7edGWn8Dx7MIjW7qR2+CrtDmFjgO6qU6D+Q2kQ9ldl97ZSB/RejDLyDfUAYNm9Fw1PacOjCEtLVhjZQYqUwOUyTFWPak6g1gBTfZHYWIoE2PChXHpls/RpjP14/yDep46CpepAb3MABpcegYT09gSMqZdXB4Lg2okLXD0hlB6MmYSmfem83bAx44fIQnd1Rfecl4NaQIwt/GW+wSLM/FiRzhTAH11nOI2zApgZv9aDGMA9rA4GFCH2nNR1T+Fju7rdanB9fJWXKtAb37kaIMspWoV6JlWkbzBdQamP9g00ik4bbD1NnnoOLD5mijX0Xr1nO+AXGed91weUcCRa22embKo8Ku3xDmDo4cgKCeDBTAuTwRoQOveYIxUzlSLEBCq2NzI/s0tWw2TmPktuwwABlJkmdACtcRRRjMGOsWZX9daZsDM0b5RqQDhSHDEBKspWCoNaO+H4OOj19KbeaeaQOc94JeOYI0UhvwN7tx3njAn26WDaiCNIoMLrFJ618pqeVUiqK2RWw1l7A4vnapEGF1ON5DI45f5pXrefqSMEqgvXl09J6ZslHEe1PnHixWwDNUiTpsdxmsBMBRPrV/uREoG1AxV52U54B7XhLEnRkwxnT6UTmBkSytoHjQawJM/qFIYz/6cQO2e58O/sZeO5BHLApEJocDv2QudWN8S1PSa5or3pjhCxXyzxc7uBPJyrKrF/7Q0mFvbcwweh9yJmdZBIwZlZzfuWZ0+LKw18NZb1Q1wpKTUoDyv6MCaXKIRejVJ0UKj7jDObhupxvBeWKqvzA1Olw9IDa5T9aqtpjxRQgdrU+ZvS4OKFmpgdLENHdwTvSabDupd2HhUKhLmM/lcwqCXslSkc98pQ+MZnJPvWJwHRl+LFm1g0rPkZomu81BSHdTzHNcaW7SUSIvoMHLOEWO832ibeDDjgnTmmhHu7o7lsSi0AY3zSQmtk/j/bD9rpB420jyh84IDc3TOWKIFiEWNEFS+Bgyq4wiY6ab3agwGfT5/cB1jhLCxDjdicQyfUXTASF6Lgi5Paz7vixYJje2815K5YXo4M9S3nrseabDFEpoNdG1jtDgXw4H03Rice+861zAA7ghKrb1VG0LuKZu49y0W6jNmyarQaDDNrgatetCk+ajBF8bqBjC0+VWn4nGBLr8fo2MD8YvShpEbWpjla1eZo2trdqKLnsqbHcHGQ3sZA+/t0Ht1NVqLXxx//OTz0AxBnhyZcXzhodnwPl4B0WNiEHDeTRATysgSVRizbzApADAwL4LuFOpmcOmXeXndegpgYOJwXPNZeHFDZrcXKmhZe/DMaStZ+I5vUNSN5+6rVza6QYlS1EhmY8THNPcdP9rOQUmkpY6wgbTqWDRRwA0pC3QjyAtLT508XgYbxPBOV1uZMNLowXaUfM+lL8sKQ/2MyjEGNV0ufw8uDVIGCh97jx2SF7DkRSx+bn6zgarOSxsUb5nuFPaePAGAOK6FdMVb9+W6ZLrxL1YG+aLs9bH35EkzA6zbFlzcgkzPOXhADDp+UGCAAoDT62vwU7feCCfXzgy3yZhTzkCdAhg/awZyB+Ir77GCmz9h8p2Ega3rwLQbIEPpdGcj7b92+62wlhaQx9oRDajn0B/ghYPZ8ELFGbrdM3x95+GDwMtL4AtoeH6y8xH+nK+1NMJB4gLq07MZ3HX4kH3DDU2yHIQBYdigoxKW1TLMl8IAI+q1IcH4uP/wAbj38LPw2LGjAzBji3bXQoYOBOvShBYT7XOeZgQHCFQNRuf8WuYjRw7C3QefhYcjMMxWH1jrr/mnJ7n80W/wCHMOUOVKBR1f7z16GI6tr6sNmywP2sbDfNB3vicbZvq8JK1ycgt6u7wA40effdqCYQTUfC70BYB5HVR7DFoEekmsJzs8OBnY6Z3pvBfIU/vyB50373vEbJFhwI2OfvrtB4UrglogpjgvffVvUHXQr7wybXonsdueeAzOhBnc/PhDeaOeCdo3DXGMPGyTvGzABfn5cvnddW0q/dmTT+S94dHZIsVERpMPjuXr7rU/wZL80c6CNbzcslsTrff8n5/cF3vd2YpzsKAGaDBzpCcNJK0CA0uZQXq0z0rHAQUKtRfPegTDBx9/OK9r/JEnH8/7gzDQtQoXm9rTzWVjI16VG3D00VJ1tI0tDYm1ofSmPGlG7EQ0kW6NnTEtKP6XTz2e66K3zht83ADDjq95tdEwT8Nwh2Sa0V2fipL5o88+WRbEz4viE44oB6HTjyLVKTZoqoPCUVGO4FBd+w6DGQuY01cHaW+NTx08INKtpeI1R7TP1khhPtVpggWtJtnYs3T4vqhpYgmdAHHo7Jm8nvEzZ07BbU/vL4DohuobdB1QsUafa3taHbpqZnbP5cv30cWL1ugK3QnQ9xx6FvadeD7TfuDMGfjoE3ulM2pQG23uCYPaDmGePeeO0MjDXxvtAlbz3fLMk/BYHBAWCd3ROtKVIShMrlxo2tjGBOBBoQY16tZxD+pfUzhmwhKg03Zuv/3og1Fa9Haf584x2BXjpzmFIegOxSgNfKQ8AG0dfZnc0FNq+D945AHaT3ElRk7gDx59ANIaHQO6u6G0KwXU8oNli6mLodPfV52iU3XWHUoDuWweG+BPEu0rtNNYPP7r44/k+1NVP94vUH8W5VsQG829TPDmpD40r/QncumYRWz80eN7C16mE6h7lcMAoCBqDsCqe0c0nXeLKWZydbzKHMBK6UjgZw8fhk8ceNbaoyo76bnpYTWAMJILQQZY5gA7AOMgj9JJLrdTQAb1fRv9fjRK589GKVf2AynA+Pyh5+DmaHrkNJ0FtedfRx0MGuuj67FBa5UjbwJ4a85rEk37Sjw+9fST8JkDz5TOmGmfwO3x+rZYp6kCvv7WUuMBHQIzL5VdE9y9sCCNViWylU2ngKzOb33mqYiRg2WV/7RVCdvRhhEOc9Bo7EYYWTlp/AEDcAXsBOZJ2rh+WnYJ/cUv3Q1HkirvhpIGPXMBmpLLd0gtfX16VCdMYl6DEWGw/Vhi7snZGvzS3Z+j7cZou960oGC8+fN33Zk/4vS2aBMcmpOuIoM06K7pOW0nC5hBgRpq2Qmsa5G2n7/r9kxrJ7SXHVp/8Qt3wrGzpwX8GtiirbpGh/L8bPEch+0DFgbVvFC8zr9Q6DgUafs/vvSFrA0TXspq/938Rm0V7KJ0M7haUHBq0qJQIqXGbAfljesjqO8/cQx+66H7TQ9t2XVjzNJBC785nXNIIsLAK8DH7z98P+w9cTyrvdQJ80HnT0Vb+l/fd4+R5gLmDoZmEMAArEYC6mvFtk5dexOpc+VqcP72/V+CJ6LPP29sSkJkQttR74t26Z/sfUjS+kN3Ri/0/CBca00+b74Oy3UAMB4Wz7e0PevvP/IQ7Dt1qmw0lPZi6SZ1E07B05BAnNfoKtTldEe7HxLDVeaoDHSyfdjLUTeuX4V/F23pv4heD89QM2iBBjhgSAo6svw9n0fnmUkdKn1C/2f7HoV/dd+9tO902egmdcQJb0UWj9+4/4vRJNkvdqsxQbBhRvE5qVyhFRtp6DrofEKVnppfbGLw70eeeBx+6767YbJphWznKe3YOy3aJpog/9e9d8EHH3ukLBvAtndXXXrieXD0MG+D8x0HjXZ0fAcwGiXzvquSeaqOD0Us/OsoSDK/eb/vSfFwaKnG66Ogxp2AvB2Ylo6XVA30LqrYwwDGrgl8nW3CCnIGNw8MJxMyPSLBSSX+7BfugPuPHxEpzcAYmCKKud0yAFdpWGoaNY1qMIWlQdPx8LEj8M8+91k4neIJEJM8mJ3IICXFpy+R/6fPfBIeOHJ4KOXAaprW3uVeeosUVucizdSzvizmVwLzQ0ePwM/dcXve4zGbSStTorsjTVNAjvH3FyLfvxTt1Ck9K/ynQ0tQGTAC2MEjtoFrTCN18GCUtcNKVzvjo8ePwk9/7jMZE4nG6YRox44GhYwnICHJjKo49HjTeGWCO/CR0kVrJtJrOK3qRbr1qvuu7vF9pO/h73/qY/DUqeeNlOPKD4DtQO1tuGYcOHBpqaSkUwLzf3/bR+F4nA6ZrGySBU462ksvg2JSpF3aATVtpfBDH/8oPBif0w017WwjzgOzsSvBSmNtVmg7mQ8GQzqePPk8/Eik/XC0n7u8sWWL9kmW0NN4HItt+IGYfv/zxwywWl4Q7QnhJs3XwQK8C/Y+P5eWJBC6QbUvnT8daX//rTfDmSTwWCtOaTBoGlrkp+BPRFhLOjfi8Jq777ZmqTeSsMTJJzLKuDIfNvI6ZbQc2PraOqyfPQuzeKydOg07I/H/z9e/G1523gV1ERq1ao9fxXKMFEt9Za6W7hpszOj90V7+7ls+BIfixEnatndKG0VOaC89pDLSAoJ9JGx97Wykfy3vTb5ndTP8+298D1y6bbssnCOL6GClmd/h0DSHEdqZnZn+INURAE2hStEnjh+Dv3fLTXAg0lRoX420k4RTtCfez/pZoZtov2LTFvj1r3sXXHXe+WZpW1lkJkBzNasgRDqWV9w1B9zaPEudKAmDf/DJKNDiZFvexD7SzzvNdnkTe16irQ5OMsidLc2Se8BMB+rJjh/+4f8F5gXUDzHruDx1DaxeiSiAahvFcDLODP3Row/BVdu2wSsuuADqrBAMTQgYSl4ttb1fU2zkzrrlsrqNx3+JNvMPfvwWeD7Fpf2naQ/qTjZT76qGEW3TSWHHYqf8k0cehiu2b4NX7txR6Waed65DUaWEXufZYfWuTZiJphlrPT6yfx/8yMf/Eg5HbZGBvKlIuMmAdiKEAA4EiuRp+qM4lnlZBPT1519glKqx7xVfEYbnk86acVrbshZc0b8x/qZo7//EZ2+DgyxEEqBXqqmU7WfXuIXvAjBiXrUUKtBUI8wF9NiDgzgEh2eTRNs6DP61KEFujJWcxd/E3G3J3tNMhSG4NXM7BQ593emBlDIzjsXG/K0Hvgi/GAdJZ7ATIBdATCoglC9LQN0RE2mvw1NR69y0b1/+oPOa886D80Zo9+aQNkUMQBqAnlJ8+j0ZJdov3fU5+OV774aTKT7SvbKpRXsnTKu0E7CJiLUofv/8sUdz21x7/vmwPdEOli5PoxEg6toM7qE9eH0+8v1f3veFyPfPw6mYMG9kT6ZQcZFW2mUDUGIceheYs6PngTlHDUyOFEbeAA+ik/oq+vvyxXf169BC1oEWcEzmx/paND3Ws/nBZsjVm7fAT7z+q+Cdey6PDOkG664xGU1KcAh+bYOeiRLhtmefjgOjO2FvtN+K5yKZGKt5AiK7ubqJME73fl7ZMn9aH9X3bD3RT+bTWqrHGlweaf+ZN78Fvv7Sy/KAzK8IZNQ22DpgY9aQ9yzqch49fPqZZ+CffvqTcSr+tKO9uOk6nioeoT0RMiPaZ5n2tczzRPsroqT+4de8Hr7h0itz6WZrEGi76wy9CmsT/qXzNAP4mQNPwy/f8zl44Pnj0RNDAmS1emTy/t9KIxpTg8EdQIHcSWeDg3mA1jf79rIvZhlT/rDR2NIAvKQBr4Bd1rxbz4ydra1npiZw9BEcIca9bfdF8J3XvBzefdmVsGU6ta84wpCxqOpiJEk8PxE7zs3RNfSf47Tqrc8+lScdpnkWjcAgdudEADEaAtAq831enDuDOY0Loh3bn020z+CrL74Y3nfttfBNV12Vpd5gSVq0tOuLTL+yoY9Ge/fWOPv3+w8+CHcefC6q47Qh/JRUdOmIxW/bKdpHVKTQXkGd6M/AjnXoYn1eu2MnfMe1L4f3XH41bIt80qtc8a8Onu9a2xyPPLk9Avl3H7ov0n6gDFizRF6VafmJTHNP8kNDMAOYUT8BGnXB8r1hI9B9vPaeeyrt/EAIlVXaCB8MDivajJSmDhFohfZAA60C7JlIugRqZvY1ccD1jXuugG+/5jp4ZWR2KrQlJTSDS90C3HP4UDZl/mTvI/DM6VNlKpt8s8zQjtR0deRzvii4EJ4BrUUSaBFKBsdaAkcBxSw2YqpLH+m/aus2eOell8L7XnYdvCl2UNmPRPjW6JBQAH3Xc8/Bjfsehz999FF4+vQpmiyZin9cBq5Tol1UNEiDq2ar3CJQ8+ZNBdhr0jHT0sepPa7del7eb/19174MXnXBTuClxlvaUWMuCbG7Dz0Ht0Zf/QejAHni9IncCQvPiwDp2MRIbsWueGOA5ityfmn/9XTSVds5l58L6gSnAuKgpAEUya35mqHKgJYIboMgzW1upLWg7ar9UJpfJHZGcr6OrAQkSd0rEySBOAFhRkdibmJ4ktipEc6PDfrmCy+Ga7afBxdG9X5+sh+JgLWYz/FoXx6MnpO9cTbyzgiIw2tnyjsBNEvJEw1ZKrB7iyRbp2xOgkRFXf6rUVjq03OnTEeiN0vsdalHn4AdwZHqd0Es780XXQTXRFt195bNcEGincpKtuzRqJ0OnY60R8/F5yPtB8+cNTOs2Q+eNEukP7vjplUqi5mhGzV3HKwLs7DJpMxD9twk/s4GtJf6JNp3Rtpft+vC7InavXlzHCes5vXnUogp8uD4udjpHovmxF1RixyJnRrFB86TJVM5Ty5QZD851lFlBm1nB4DJdg7GxKjnDDcWQlxngKGSzYCGVhizo/meA3WGtTJDyAdW05NbLzO2nxWJvb4uUruAYpalSU8bsvRkk4vIMHqvU7OTXQX0ZCqDJlZx7O+UKVbdc1HLzGDrzp0V2Kb2wE6dcVb2CyHaWRsF3gXJ85JUbWrUTDcN7jKQJ9OqSQztRL+g2dPebjutZRI9zPvAZghpzcT7zHfZnaov30XrsZIMygotQhdpDn6Hp+NOyG0y6Spw2dRA6/bRAG4OBFth5N507gMNR7CVZ6yuS/dJdMoH4lyBQFvzpsqnDYUmHc009qUh+8QIZuiMVCRtbxF6JWmG6gZI4qK8utoViUHqLcejArLoTPVrEUKVq4BG6qBZgmA5WFp2swn00zhJQ2BIC75nLUQ7pga/vpfy+Ajtk05evUUBwRzaofFrQgC2eVghs/RLwOr7JB2TCRP5nrXKtPB9VjsrjPGdaJeX8h3txa9M8ZjukX0iLjkE4xoCBWapTwPMWgCN1ruEja0+ajLkxkKoi9xpUEvXjrf7AuJU2QQOJID0XWZiVqWRKazaZTMZ9qAAGCM0k9LV/bxRqWQUkNMLUwbAlXFo6qUrF4oECUGtA106dx7ERTDk1wQS7dRJQ+pM3AFZktPoVvY/UdKg0K20hjmQ7HwE80qlp320UQvRTdonpNozj0t5YdIX2jXfaYJM+J6Obg7tJIUHmlAdAzCjm53WUrpVJTkfB3MK87ek8NcmKS/oSAAQBhCoZRVwECAH0AwuwM62VPo0ui9xxUwJ4vrLwHKjKv0yS/W9FjUIZI8NmCXPcSbYZpjaQAXVaMvQnssk2vtUZho4VrNKz6AuTTv7wVu0E78r7Ypo075YtaVI6hbtSUqHzHfueL3srxdqHTiPIu6HtJP/3ggWJzw8sOvzmnjbHrgAtPPCdID4RZlpTwjSICr34I7AX6RRYQOafJH91KoiWVqTfZx/J50CBVTGUnrJ34AUrY2pQbsIzD54aZCL6/NC7kHVveTYZ6lXBiwh84D3Aay0g6IfLO2IDiScxA1ccQHtWvAgOl5pkms65HwTnV2QjhkE1OD4DoYW4bumXUtZHSevH+pnoKaFeo4D3jfqOicsb3IMCiJQA3diRQ1J7jwY6INdEQgnWU2D8BZFMiCbLZSH2WAueJsDrOo1IKZ8jIRGWwd5RpUpZCqpyvqWO1w2RZj4yQjtQeUFA1ygq8eARlyedqx2jOOXTT+gXQ1YBdx0rbvfwFyaR7t0QAAZ+Ml9UJ1X5aE6wQsFcwpTjbVmUBWVtHwyCupQJFpKlE0KxewQSJqTVOPGR8pUhFooDGBJgR1UicP54RDQAIBO5QV9XzO2PmJPVQ+sp1ReNjPSNfnaNY8g1A1FSL1L5waiGX2h2KAdXN0U0M11bYpyqfilaWfNwlqS8hCNw3wXcwWE/wGHgsTSrujmarBEVmlqvQCqr/nFBXMKZuNNqxhrvj5/c88wiWznTHxhEtLgShqXMFyaVzFZSYKgGbsMHU6CMYil8QXElZm2fjpXMqW4oQgkgW1+BmgyL6h+tSOivDq3iOZKru2QfM31CqoDapkRTI4cF1Q+NTGbbTJ2z0IGlKSu6ZaiGSzfmc+8KLmhnUAr5ikDGXGw4ZW0G8LAyGydt/hsTI5Bp9C/oma5cCApCwLKoOINgVoqAJJkhjpBg1WKo86EH2MbW2qAhglYiTRSgJlHlqq6Jyn0IxIbGBcQNANMvVnDBKKd0RKU1gJdd8VHLY1atNdzpElBHKWdfwLUzgdEOypeMFSlGZE1iGpXqhwaLWlpr+RZMGvaUfO9EV/4AnYFWBU/aBPEAZDBXfPvtJVoNKAd+fsGQGJCYG5nSwHNLKKuYHBbSxUQ8iruOOyGo3S5E7TMMw/XnmB/VTkCwlDjURAkibI2MqzO/3WdYJB3m3aFTAI5eoDDCO0WiyBodPtTiMQOoaLJPSwQDUMyxWxxJGnazMcgDhtSjsqjVNcxhdvNlbcURmN66+XwROtrf48yKPdUkRrY8uYUWN3AmBB7SW9xQYl0e4wCQV0oqSESQz/fArDPSC/sAa7uwRPD0ockMxfm9iscFINQeRkqregb3nQAtHVo0WzOcQjaUhFgyVnpINoNwGEIalO+ohNgfudjfqqOizAHS63rFib9L92bbjhTbLSWAU8thIWCrHOlgco2HD2jwQ1BD+Ra4qIWjIY2dUuBxdI9TKvlgDEQdJ1QgxqgaigCJPuv2YaeR7uyK5envUkwKAMGzFggKBAx7SLRg8qXaCeAByZg0Mw4LLFFO0e0OiBWSBth2IBUE2emTBymyxL6XAMDV65BEVh7jICaEykholV6uV0NKA2yprRoE1V/Rhg693F/Txfd6pRMuxoUV6nlM2gV0Cj9y017TqsEi87pXPhO+bQ6oBE+nP9GwLxEOHdAc8HB1boBbNR+WZYaGvgi/eYxcsT+QEePv4HtpMsyzXhwwNPuAMIheDJeGO3nQrce0M2lXZMHG6AdWvSPgNikASvUBnmeO5hTeGGA1gRsANg5WtMtEgSy0h/uOei7MsK4SoTlgTAmIXS80zZMrpSQcNGhnVkz9L8ItGs6WjT6eJ++QTt7c2paR7sZM+j7uDHacUFHWJTWPRZgfpiWdzKU/5Ey1e9D13rj0FdJUjo4aT2UDjZvW+nyE9QFC4eQB5RolEGllU3DlqhRNOtn1L3RJW7RyyVUQABomloZpx1REXj8pX0HjmbK19RaiAaemBnQ7Mod3ENFM+eNdWyQ2cltizUH7o+opLmlGW2nMGmpDYxbF4c0W9IVzTgfdy6PeWmnzDh9Ax0T6qyXTQtgO4GvVKD0qK8BqQJg03K5YGuueA4amrVMUPR48FJa3Umw0iVxaqTcphkkt1J2nbVUpKoGwDbNFG/GMTDkfYnoVL1KJ9kQzahyD5UHmndgylQ059lcrM/pduBidVr0g/OC9ADu+RbNiJYOVQ+NBXR8ZozKfcp78HJSMxNNqAuDwrWKtuLINYh6CtXzXnqbwlpVtfc4b1XVQXLfKXW95tLMZ452uRPCKF0wXqsB7fYe/yyg2WQ3ntaoJcUaQ3urvceq0alpbj3YxAU0y8ts87NvhWYayvuF29Cjpere2mroxjPB3RiIrbFnwOqnpbiyGGBNurmMFg2A42lg7Bl4cWmXPM+R9nk81+rPP78M7Yjzr1+E8P8B0szv+tLrxRwAAAAASUVORK5CYII=")'}}),Trust=({theme:o="light",...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"44",height:"44",fill:o==="light"?"var(--ck-brand-trust-02)":"var(--ck-brand-trust-02b)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.0246 11.8662C33.4096 11.8662 33.774 12.0243 34.0421 12.2925C34.3102 12.5675 34.4615 12.9387 34.4546 13.3168C34.3859 17.4143 34.2277 20.5493 33.9321 23.0312C33.6433 25.5131 33.2102 27.3556 32.5571 28.8475C32.1171 29.8443 31.574 30.6693 30.9346 31.3706C30.0752 32.2987 29.0921 32.9725 28.0196 33.6119C27.561 33.8861 27.0843 34.1568 26.5842 34.4408C25.5172 35.0468 24.3441 35.713 23.0146 36.6025C22.5333 36.9256 21.9077 36.9256 21.4265 36.6025C20.0766 35.7026 18.8879 35.0281 17.8112 34.4173C17.5718 34.2815 17.3379 34.1488 17.109 34.0175C15.8509 33.2887 14.7165 32.5943 13.7265 31.5906C13.0665 30.9306 12.4959 30.1262 12.0421 29.1706C11.4234 27.8918 11.004 26.345 10.6946 24.3443C10.2821 21.67 10.0759 18.1706 10.0002 13.3168C9.99336 12.9387 10.1377 12.5675 10.4059 12.2925C10.674 12.0243 11.0452 11.8662 11.4302 11.8662H12.0215C13.8433 11.8731 17.8652 11.6943 21.344 8.98559C21.8596 8.58683 22.5815 8.58683 23.0971 8.98559C26.5759 11.6943 30.5977 11.8731 32.4265 11.8662H33.0246ZM29.8277 27.9331C30.2746 27.0118 30.6459 25.74 30.9277 23.9112C31.2646 21.725 31.4709 18.755 31.5671 14.7125C29.4221 14.6506 25.7371 14.2381 22.224 11.8731C18.7109 14.2312 15.0259 14.6437 12.8877 14.7125C12.9633 18.0537 13.1146 20.6525 13.3552 22.6943C13.6302 25.0181 14.0221 26.5925 14.5102 27.6993C14.8333 28.435 15.1909 28.9643 15.6171 29.4318C16.1877 30.0575 16.9096 30.5731 17.8927 31.1643C18.3005 31.409 18.7502 31.6635 19.2396 31.9406C20.1116 32.4341 21.1099 32.9991 22.224 33.7081C23.3175 33.0107 24.3014 32.4515 25.1633 31.9616C25.4231 31.8139 25.6717 31.6725 25.909 31.5356C27.119 30.8412 28.0127 30.2637 28.6796 29.59C29.1265 29.1293 29.4909 28.6275 29.8277 27.9331Z",fill:o==="light"?"var(--ck-brand-trust-01)":"var(--ck-brand-trust-01b)"})]}),Argent=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M18.3242 7.63647H13.6516C13.4955 7.63647 13.3704 7.76611 13.367 7.92726C13.2726 12.4568 10.9768 16.7559 7.02532 19.8009C6.89986 19.8976 6.87128 20.0792 6.963 20.21L9.69685 24.112C9.78986 24.2448 9.97107 24.2747 10.0986 24.1772C12.5694 22.2856 14.5567 20.0038 15.9879 17.4746C17.4191 20.0038 19.4065 22.2856 21.8773 24.1772C22.0047 24.2747 22.186 24.2448 22.2791 24.112L25.013 20.21C25.1045 20.0792 25.0759 19.8976 24.9506 19.8009C20.999 16.7559 18.7033 12.4568 18.609 7.92726C18.6056 7.76611 18.4803 7.63647 18.3242 7.63647Z",fill:"var(--ck-brand-argent)"})]}),ImToken=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:`linear-gradient( +`);const it=createData(et,tt,rt),st=Utils$1.getSymbolSize(et),at=new BitMatrix(st);return setupFinderPattern(at,et),setupTimingPattern(at),setupAlignmentPattern(at,et),setupFormatInfo(at,tt,0),et>=7&&setupVersionInfo(at,et),setupData(at,it),isNaN(nt)&&(nt=MaskPattern.getBestMask(at,setupFormatInfo.bind(null,at,tt))),MaskPattern.applyMask(nt,at),setupFormatInfo(at,tt,nt),{modules:at,version:et,errorCorrectionLevel:tt,maskPattern:nt,segments:rt}}qrcode.create=function(et,tt){if(typeof et>"u"||et==="")throw new Error("No input text");let nt=ECLevel.M,rt,ot;return typeof tt<"u"&&(nt=ECLevel.from(tt.errorCorrectionLevel,ECLevel.M),rt=Version$1.from(tt.version),ot=MaskPattern.from(tt.maskPattern),tt.toSJISFunc&&Utils$1.setToSJISFunction(tt.toSJISFunc)),createSymbol(et,rt,nt,ot)};var canvas={},utils$1={};(function(o){function et(tt){if(typeof tt=="number"&&(tt=tt.toString()),typeof tt!="string")throw new Error("Color should be defined as hex string");let nt=tt.slice().replace("#","").split("");if(nt.length<3||nt.length===5||nt.length>8)throw new Error("Invalid hex color: "+tt);(nt.length===3||nt.length===4)&&(nt=Array.prototype.concat.apply([],nt.map(function(ot){return[ot,ot]}))),nt.length===6&&nt.push("F","F");const rt=parseInt(nt.join(""),16);return{r:rt>>24&255,g:rt>>16&255,b:rt>>8&255,a:rt&255,hex:"#"+nt.slice(0,6).join("")}}o.getOptions=function(nt){nt||(nt={}),nt.color||(nt.color={});const rt=typeof nt.margin>"u"||nt.margin===null||nt.margin<0?4:nt.margin,ot=nt.width&&nt.width>=21?nt.width:void 0,it=nt.scale||4;return{width:ot,scale:ot?4:it,margin:rt,color:{dark:et(nt.color.dark||"#000000ff"),light:et(nt.color.light||"#ffffffff")},type:nt.type,rendererOpts:nt.rendererOpts||{}}},o.getScale=function(nt,rt){return rt.width&&rt.width>=nt+rt.margin*2?rt.width/(nt+rt.margin*2):rt.scale},o.getImageWidth=function(nt,rt){const ot=o.getScale(nt,rt);return Math.floor((nt+rt.margin*2)*ot)},o.qrToImageData=function(nt,rt,ot){const it=rt.modules.size,st=rt.modules.data,at=o.getScale(it,ot),ct=Math.floor((it+ot.margin*2)*at),lt=ot.margin*at,dt=[ot.color.light,ot.color.dark];for(let ht=0;ht=lt&&ft>=lt&&ht"u"&&(!it||!it.getContext)&&(at=it,it=void 0),it||(ct=nt()),at=et.getOptions(at);const lt=et.getImageWidth(ot.modules.size,at),dt=ct.getContext("2d"),ht=dt.createImageData(lt,lt);return et.qrToImageData(ht.data,ot,at),tt(dt,ct,lt),dt.putImageData(ht,0,0),ct},o.renderToDataURL=function(ot,it,st){let at=st;typeof at>"u"&&(!it||!it.getContext)&&(at=it,it=void 0),at||(at={});const ct=o.render(ot,it,at),lt=at.type||"image/png",dt=at.rendererOpts||{};return ct.toDataURL(lt,dt.quality)}})(canvas);var svgTag={};const Utils=utils$1;function getColorAttrib(o,et){const tt=o.a/255,nt=et+'="'+o.hex+'"';return tt<1?nt+" "+et+'-opacity="'+tt.toFixed(2).slice(1)+'"':nt}function svgCmd(o,et,tt){let nt=o+et;return typeof tt<"u"&&(nt+=" "+tt),nt}function qrToPath(o,et,tt){let nt="",rt=0,ot=!1,it=0;for(let st=0;st0&&at>0&&o[st-1]||(nt+=ot?svgCmd("M",at+tt,.5+ct+tt):svgCmd("m",rt,0),rt=0,ot=!1),at+1':"",ct="',lt='viewBox="0 0 '+st+" "+st+'"',ht=''+at+ct+` +`;return typeof nt=="function"&&nt(null,ht),ht};const canPromise=canPromise$1,QRCode$2=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(o,et,tt,nt,rt){const ot=[].slice.call(arguments,1),it=ot.length,st=typeof ot[it-1]=="function";if(!st&&!canPromise())throw new Error("Callback required as last argument");if(st){if(it<2)throw new Error("Too few arguments provided");it===2?(rt=tt,tt=et,et=nt=void 0):it===3&&(et.getContext&&typeof rt>"u"?(rt=nt,nt=void 0):(rt=nt,nt=tt,tt=et,et=void 0))}else{if(it<1)throw new Error("Too few arguments provided");return it===1?(tt=et,et=nt=void 0):it===2&&!et.getContext&&(nt=tt,tt=et,et=void 0),new Promise(function(at,ct){try{const lt=QRCode$2.create(tt,nt);at(o(lt,et,nt))}catch(lt){ct(lt)}})}try{const at=QRCode$2.create(tt,nt);rt(null,o(at,et,nt))}catch(at){rt(at)}}browser$1.create=QRCode$2.create;browser$1.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$1.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$1.toString=renderCanvas.bind(null,function(o,et,tt){return SvgRenderer.render(o,tt)});var PRE_ENTER=0,ENTERING=1,ENTERED=2,PRE_EXIT=3,EXITING=4,EXITED=5,UNMOUNTED=6,STATES=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],startOrEnd=function(et){return et?UNMOUNTED:EXITED},updateState=function(et,tt,nt,rt,ot){clearTimeout(rt.current),tt(et),nt.current=et,ot&&ot({state:STATES[et]})},useTransition=function(et){var tt=et===void 0?{}:et,nt=tt.enter,rt=nt===void 0?!0:nt,ot=tt.exit,it=ot===void 0?!0:ot,st=tt.preEnter,at=tt.preExit,ct=tt.timeout,lt=tt.initialEntered,dt=tt.mountOnEnter,ht=tt.unmountOnExit,ft=tt.onChange,mt=reactExports.useState(lt?ENTERED:startOrEnd(dt)),pt=mt[0],yt=mt[1],gt=reactExports.useRef(pt),xt=reactExports.useRef(),vt,bt;typeof ct=="object"?(vt=ct.enter,bt=ct.exit):vt=bt=ct;var Et=reactExports.useCallback(function(){var kt;switch(gt.current){case ENTERING:case PRE_ENTER:kt=ENTERED;break;case EXITING:case PRE_EXIT:kt=startOrEnd(ht);break}kt!==void 0&&updateState(kt,yt,gt,xt,ft)},[ft,ht]),wt=reactExports.useCallback(function(kt){var It=function $t(Nt){switch(updateState(Nt,yt,gt,xt,ft),Nt){case ENTERING:vt>=0&&(xt.current=setTimeout(Et,vt));break;case EXITING:bt>=0&&(xt.current=setTimeout(Et,bt));break;case PRE_ENTER:case PRE_EXIT:xt.current=setTimeout(function(){return $t(Nt+1)},0);break}},Rt=gt.current<=ENTERED;typeof kt!="boolean"&&(kt=!Rt),kt?Rt||It(rt?st?PRE_ENTER:ENTERING:ENTERED):Rt&&It(it?at?PRE_EXIT:EXITING:startOrEnd(ht))},[Et,ft,rt,it,st,at,vt,bt,ht]);return reactExports.useEffect(function(){return function(){return clearTimeout(xt.current)}},[]),[STATES[pt],wt,Et]};const defaultConnectors=({app:o,walletConnectProjectId:et,coinbaseWalletPreference:tt})=>{const nt=o.name&&o.icon&&o.description&&o.url,rt=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,ot=[];return rt&&ot.push(safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})),ot.push(injected({target:"metaMask"}),coinbaseWallet({appName:o.name,appLogoUrl:o.icon,overrideIsMetaMask:!1,preference:tt})),et&&ot.push(walletConnect({showQrModal:!1,projectId:et,metadata:nt?{name:o.name,description:o.description,url:o.url,icons:[o.icon]}:void 0})),ot};let globalAppName,globalAppIcon;const getAppName=()=>globalAppName,getAppIcon=()=>globalAppIcon,defaultConfig=({appName:o="ConnectKit",appIcon:et,appDescription:tt,appUrl:nt,walletConnectProjectId:rt,coinbaseWalletPreference:ot,chains:it=[mainnet,polygon,optimism,arbitrum],client:st,...at})=>{var ct,lt;globalAppName=o,et&&(globalAppIcon=et);const dt=(ct=at==null?void 0:at.transports)!==null&&ct!==void 0?ct:Object.fromEntries(it.map(mt=>[mt.id,http()])),ht=(lt=at==null?void 0:at.connectors)!==null&<!==void 0?lt:defaultConnectors({app:{name:o,icon:et,description:tt,url:nt},walletConnectProjectId:rt,coinbaseWalletPreference:ot});return{...at,chains:it,connectors:ht,transports:dt}},isWalletInstalled=o=>{if(typeof window>"u")return!1;const{ethereum:et}=window;return!!(et!=null&&et[`is${o}`]||et!=null&&et.providers&&(et!=null&&et.providers.find(tt=>tt==null?void 0:tt[`is${o}`])))},isFamily=()=>isWalletInstalled("Family"),isRainbow=()=>isWalletInstalled("Rainbow"),isZerion=()=>isWalletInstalled("Zerion"),Mock=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),Injected=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6505 3.64041C15.6501 3.64062 15.6497 3.64083 15.6493 3.64103L6.05165 8.43985L16.2501 13.5391L26.4484 8.43987L16.8508 3.64103C16.8504 3.64083 16.85 3.64063 16.8496 3.64043C16.6632 3.54806 16.458 3.5 16.25 3.5C16.042 3.5 15.8369 3.54806 15.6505 3.64041ZM28 10.4592L17.5001 15.7091L17.5 28.5205L27.248 23.6465L27.2508 23.6452C27.4757 23.5334 27.665 23.3611 27.7973 23.1477C27.9297 22.9342 27.9999 22.6881 28 22.4369V10.4592ZM15 28.527L15.0001 15.7091L4.50006 10.4591V22.4333C4.49831 22.6849 4.56687 22.9319 4.69807 23.1466C4.82896 23.3608 5.01696 23.5342 5.24095 23.6475C5.24148 23.6477 5.242 23.648 5.24253 23.6483L15 28.527ZM14.5207 31.0824L4.12104 25.8826L4.11759 25.8809C3.47681 25.558 2.93902 25.0625 2.56486 24.4502C2.19154 23.8394 1.99597 23.1365 2.00006 22.4207V10.0486C2.00044 9.33234 2.20062 8.62972 2.5781 8.021C2.95529 7.41274 3.49457 6.92167 4.13537 6.60291C4.13585 6.60267 4.13633 6.60243 4.13681 6.60219L14.534 1.40359L14.5368 1.40221C15.0692 1.13767 15.6556 1 16.25 1C16.8445 1 17.4309 1.13767 17.9633 1.40221L17.966 1.40358L28.3633 6.60219C28.3638 6.60245 28.3643 6.6027 28.3648 6.60295C29.0055 6.92171 29.5448 7.41276 29.922 8.021C30.2994 8.62973 30.4996 9.33168 30.5 10.0479V22.4376C30.4996 23.1538 30.2994 23.8565 29.922 24.4652C29.5448 25.0734 29.0056 25.5644 28.365 25.8831C28.3644 25.8834 28.3638 25.8837 28.3633 25.884L17.9664 31.0824C17.9663 31.0825 17.9665 31.0824 17.9664 31.0824C17.4316 31.3499 16.8415 31.4894 16.2435 31.4894C15.6455 31.4894 15.0554 31.3499 14.5207 31.0824C14.5205 31.0824 14.5208 31.0825 14.5207 31.0824Z",fill:"#CCCCCC"})}),WalletConnect=({background:o=!1,...et})=>jsxRuntimeExports.jsx("svg",{...et,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:o?{background:"var(--ck-brand-walletConnect)"}:void 0,children:jsxRuntimeExports.jsx("path",{d:"M9.58818 11.8556C13.1293 8.31442 18.8706 8.31442 22.4117 11.8556L22.8379 12.2818C23.015 12.4588 23.015 12.7459 22.8379 12.9229L21.3801 14.3808C21.2915 14.4693 21.148 14.4693 21.0595 14.3808L20.473 13.7943C18.0026 11.3239 13.9973 11.3239 11.5269 13.7943L10.8989 14.4223C10.8104 14.5109 10.6668 14.5109 10.5783 14.4223L9.12041 12.9645C8.94336 12.7875 8.94336 12.5004 9.12041 12.3234L9.58818 11.8556ZM25.4268 14.8706L26.7243 16.1682C26.9013 16.3452 26.9013 16.6323 26.7243 16.8093L20.8737 22.6599C20.6966 22.8371 20.4096 22.8371 20.2325 22.6599L16.0802 18.5076C16.0359 18.4634 15.9641 18.4634 15.9199 18.5076L11.7675 22.6599C11.5905 22.8371 11.3034 22.8371 11.1264 22.66C11.1264 22.66 11.1264 22.6599 11.1264 22.6599L5.27561 16.8092C5.09856 16.6322 5.09856 16.3451 5.27561 16.168L6.57313 14.8706C6.75019 14.6934 7.03726 14.6934 7.21431 14.8706L11.3668 19.023C11.411 19.0672 11.4828 19.0672 11.5271 19.023L15.6793 14.8706C15.8563 14.6934 16.1434 14.6934 16.3205 14.8706L20.473 19.023C20.5172 19.0672 20.589 19.0672 20.6332 19.023L24.7856 14.8706C24.9627 14.6935 25.2498 14.6935 25.4268 14.8706Z",fill:o?"white":"var(--ck-brand-walletConnect)"})}),MetaMask=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,style:o?{background:"linear-gradient(0deg, var(--ck-brand-metamask-12), var(--ck-brand-metamask-11))",borderRadius:"27.5%"}:void 0,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M27.2684 4.03027L17.5018 11.2841L19.3079 7.00442L27.2684 4.03027Z",fill:"var(--ck-brand-metamask-02)",stroke:"var(--ck-brand-metamask-02)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M4.7218 4.03027L14.4099 11.3528L12.6921 7.00442L4.7218 4.03027Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.7544 20.8438L21.1532 24.8289L26.7187 26.3602L28.3187 20.9321L23.7544 20.8438Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.69104 20.9321L5.28117 26.3602L10.8467 24.8289L8.24551 20.8438L3.69104 20.9321Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5327 14.1108L8.98181 16.4568L14.5081 16.7022L14.3117 10.7637L10.5327 14.1108Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.4576 14.1111L17.6295 10.6953L17.5018 16.7025L23.0182 16.4571L21.4576 14.1111Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8292L14.1647 23.2096L11.2984 20.9717L10.8469 24.8292Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8257 23.2096L21.1531 24.8292L20.6918 20.9717L17.8257 23.2096Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.1531 24.8296L17.8257 23.21L18.0906 25.3793L18.0612 26.2921L21.1531 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8296L13.9388 26.2921L13.9192 25.3793L14.1647 23.21L10.8469 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M13.9877 19.5389L11.2196 18.7242L13.1729 17.8311L13.9877 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0023 19.5389L18.8171 17.8311L20.7802 18.7242L18.0023 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8468 24.8289L11.3179 20.8438L8.24561 20.9321L10.8468 24.8289Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.6821 20.8438L21.1532 24.8289L23.7544 20.9321L20.6821 20.8438Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.0182 16.4565L17.5018 16.7019L18.0122 19.5387L18.827 17.8308L20.7902 18.7239L23.0182 16.4565Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2198 18.7239L13.1829 17.8308L13.9878 19.5387L14.5081 16.7019L8.98181 16.4565L11.2198 18.7239Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M8.98181 16.4565L11.2983 20.9718L11.2198 18.7239L8.98181 16.4565Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.7901 18.7239L20.6919 20.9718L23.0181 16.4565L20.7901 18.7239Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14.508 16.7021L13.9878 19.5389L14.6356 22.886L14.7828 18.4788L14.508 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5017 16.7021L17.2367 18.4689L17.3545 22.886L18.0121 19.5389L17.5017 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0121 19.5388L17.3545 22.886L17.8257 23.2099L20.6918 20.972L20.79 18.7241L18.0121 19.5388Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2196 18.7241L11.2981 20.972L14.1644 23.2099L14.6355 22.886L13.9877 19.5388L11.2196 18.7241Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0615 26.2917L18.0908 25.3788L17.8455 25.1628H14.145L13.9192 25.3788L13.9388 26.2917L10.8469 24.8291L11.9267 25.7126L14.1155 27.234H17.875L20.0736 25.7126L21.1533 24.8291L18.0615 26.2917Z",fill:"var(--ck-brand-metamask-07)",stroke:"var(--ck-brand-metamask-07)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8258 23.2096L17.3546 22.8857H14.6357L14.1646 23.2096L13.9191 25.379L14.1449 25.163H17.8454L18.0907 25.379L17.8258 23.2096Z",fill:"var(--ck-brand-metamask-04)",stroke:"var(--ck-brand-metamask-04)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M27.6806 11.7552L28.5149 7.75041L27.2683 4.03027L17.8257 11.0387L21.4575 14.1109L26.591 15.6128L27.7296 14.2876L27.2389 13.9342L28.0241 13.2178L27.4156 12.7465L28.2007 12.1478L27.6806 11.7552Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.48486 7.75041L4.3192 11.7552L3.78916 12.1478L4.57441 12.7465L3.97566 13.2178L4.7609 13.9342L4.27012 14.2876L5.39892 15.6128L10.5325 14.1109L14.1644 11.0387L4.72164 4.03027L3.48486 7.75041Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M26.591 15.6122L21.4575 14.1104L23.0181 16.4564L20.6919 20.9716L23.7544 20.9323H28.3186L26.591 15.6122Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5326 14.1104L5.39897 15.6122L3.69104 20.9323H8.24551L11.2982 20.9716L8.98168 16.4564L10.5326 14.1104Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5018 16.7018L17.8258 11.0381L19.3177 7.00391H12.6921L14.1645 11.0381L14.5081 16.7018L14.6258 18.4883L14.6356 22.8856H17.3546L17.3742 18.4883L17.5018 16.7018Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"})]}),Coinbase=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"var(--ck-brand-coinbaseWallet)"}),o&&jsxRuntimeExports.jsx("rect",{rx:"27%",width:"20",height:"20",fill:"var(--ck-brand-coinbaseWallet)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 17C13.8661 17 17.0001 13.866 17.0001 10C17.0001 6.13401 13.8661 3 10.0001 3C6.13413 3 3.00012 6.13401 3.00012 10C3.00012 13.866 6.13413 17 10.0001 17ZM8.25012 7.71429C7.95427 7.71429 7.71441 7.95414 7.71441 8.25V11.75C7.71441 12.0459 7.95427 12.2857 8.25012 12.2857H11.7501C12.046 12.2857 12.2858 12.0459 12.2858 11.75V8.25C12.2858 7.95414 12.046 7.71429 11.7501 7.71429H8.25012Z",fill:"white"})]}),Family=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{backgroundSize:"100% 100%",backgroundImage:'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAABQGlDQ1BzUDNDAAB4nGNgYHyQk5xbzKLAwJCbV1IU5O6kEBEZpcD+iIGZQYSBk4GPQTYxubjAN9gthAEIihPLi5NLinIYUMC3awyMIPqybkZiXopc+xz3pvOzD4rlWyascy2VY8APuFJSi5OB9B8gVkkuKCphYGAEuoZBqbykAMR2AbJFkjMSU4DsCCBbpwjoQCC7BSSeDmHPALGTIOw1IHZRSJAzkH0AyFZIR2InIbFzc0qToW4AuZ4nNS80GEhzALEMQzFDAIMxgzMONWxgNc5AaMCgCAov9HAoTjM2gujicWJgYL33//9nVQYG9skMDH8n/P//e+H////8GBiYZzEwHBBB6G++z8Bgux/EQoh5AfkbzYHBtBUhpmHBwCDIxcBwoqIgsSgRLMQMxExpmQwMn5YzMPBGMjAIXwDqiQYAOQZcLsEClb4AAGmfSURBVHgB1b0J1G3HVR6497n3/98o6Q0anubBludJeAiTbYwd2gGC6UACBFZY7gVNB3CaJEB3VhbQhNW9OtDQkAYSIOkEGhJCGJrEBGzJkrEsT7Jky5JszXrSexqf3qw3/v891TXsvWvvferce/8nyabrvfPfc+rUqdq166u9d+06pwrP+/CHA3AI8RQRmqFxbyRliVdpcSQ9jj27IASwdAVHVxi7l65hcZAn6NlFdOOce4vCgB5Fc5iXdiN1abSFP1/2PrRoUtiYR/Oy9C9Tr7EwNVc4pwojTDFxC0CMI2nH8hwlhX4D5ZOvWwzy9cHlS8FlzhfwZNlyDN2pPlSXwT0VAtd7yTL8+SDuHOvCzzKdyOButIeuj6HfpTXtu8Ew3WD6NpjnALnFuI1IPB9GK0n5ZiCM9H4GyTJhLqAX1GHZMoJK70Etp0tK4nlhLqBfQF08CFnAgPrN8SHMz0N1YmjluYGwNKDnSeV5DEOnttHnpZ7fKBDyuWJWUHnKqWLUsgyaJ4WbjT2nDv56TCWL6gaw0vklrAv/vpD2mNcWrTpAI00+H9G0G5XWU/1gs8fBSCM1gMq/Y/d9BzD3WiqUpS4zQakyBkDQ6k7HQ5uZi4CgQepphJE66DiuC9PM57lcpsU1auA6Ul1Q1S399o6mF1qXFDq5NbyHqi7QoBmZ5wp8wdn+3G6o6qifRV0vQ3QtbxGwPUbT+RSXeEj/NiUyqQwP5BaIOw8Gl94HAwTKS0viXkk1fejeru02k2+jrNb1gE7d4GA7YwtEYYEtHyhN0HWh6/Q7AQV4bmidPwzDaF00rbpdGnHQqI+vh26LoPjNdQCi3XeAlL7zcaA6g5PYCDBqMup70xahvpK2DkMACmjVvc4904EFApL08dJgAAxVUX3OTEIlFcYYigooPi9fZ0nPtCj6fKPr+2MSD+fUARzNDBCJ0yBR9ZT6qjKC8jRImcxfvuf4b84pLXBdsG1bG94pLSL00i0taHpdP4rv6XnoOiut1aDSaCyYI3AV7aM29KAyc1QwNqSyZ5gHdEcM7kbyaAXfmOYg5vaF2MrQxCzFGFZ3Oj9dH98xPc263t0YQKAdPCA0CHxn1CDo+Z4ysSQvrovTPjkksHCdoLYDtOpCaY3AAZgvYBjABFShWdGfjs7VKcepugSiS3dK/6vt80HHUnVfalA4b2CHDROCG1uDmM87dd4Cgy5HiG1I2OB6uwEC9VhOhxosytZrSSAg2nU9dZ2wRT+MaB+mXwdtd7pD6qJA3ENtQCOxAYZ2d6M+Y3w2dQEL9rntQXXSAGOaO2f+zcACGZVwMRJZ5QtULxE+/OvKHAvTFhMs7bZx5XyOVNZg7kAxT0nkTkmNVNFunoRz6rZXKi4xxvR2YhoDm5ntJRxxroJhBMQtIHe+vj6e8muBTMwKJgFqg/eUV0/8aNWnWRfn/QBV/gDUrh2w0Un9PZMv063axEtfXxehn/JhgdNzHRoDQM2fWiU12Hb3OMyV0K3KeDAbadUA8AQsIDqVRqS1VndOOoCuWCBmIavgdE0MI/D2JCl61eAi7RSYWVWO1Rddp9QN7evQAnk5tJyRUgemknQ6rgMfyozyoNHqfTDo1PWAtkQWuhttxveB6lDqpWtQz7XG0HTqw8fNFF3mOWU+5eKcRNYSG6AN6qk2wNHZKWJPkgqQHstSFZxUpvOJZhTlNaHryQig828AwBFzoFQ0MQ8ziDOYMTGhJ6akhq+gnjGoYWjD8YBEQK0GFbrjAYyD2AAhd6KSFQNZQBCcOMDaTj1wfahjgjU5pB7U2B1UbcPqfCDJuC6qzYxWTPGR3xPTBqm9dD1R6gLAHdO2SSDaU6MJX/u+CA3XMWdES0edk6UzUr14nNDxs/QrfnPlANBSnmkKCsNTQ6gGk+r1A3uR47ykggrmibrWcRbQLOGGErEVqkRT6jjm2qtG5/MJAXwGwajApunhB0QODFrTtECd03VWwmk+1QqEobnBEjrTXkDOkjkBYUIgSHGmkyIaST/wCuCQnk4ETW2TBOSBSei1UkMDcJlFkBBPu0mhnwA6I3BO0nlMs574SrydoRt7Qe0A2VRRYDbjKIVRI6kpvpgcaJWjrkCnC8Wh50I3rkhhdT1RQJ5AZaIBNjZUdqOHDtSub2xEB+5YTpSQM2ApUk0PaA0wEF3Du/qBBcBE1Vnbn1wXAKtxuNzg6qCBrTtlp0FO5Zl0YMHMdeBfDUoteSe+ftxhVVov3TWPQNOv24bbIZ33SaOU81mU4h1pmBkdPEBE6rg6yLgIQAb1fvAbPF0UN5hY0b3GxI+AWYOXwTzRYCYglHN7TzPQgDoUM0QTUCUrSzEl4bCaGTOodhoDPEvr9Gwo5kp+tsOB71ZLpPpb6DYN7+qLyBpJaRwYDqiCrouugx8HxLqzNJ5BBbnutMYT4iUoCYNkBhWTCJrmoBU0heaJ/Or2BlUbMjWAgdww9aCAWOoQUnukMgjY8VgHEBM3g5qvCcAz6vxsZg0EkBIOmsfW5OCEKpGW2PMkM/fwdD51gJ4OAA71GfRmS2oAa9MOJxpIMkOpeJZiufGKqVFUNWSmiS2HKObKhJiuxw8AUMtnerDS5U2nOh6gdMD1YL5hFZYChfpbxwDa/scMBLYnRf1C6aCdgF55CAhMpmWx2vBm4Ad2LMNAnrTa1LW/RkVQvz0SqEmbzLDSOyOAI4E4CyqlTGYAYusz9tiG7uhX28/efQsNoFsJ7aTVIjNDwAkV2CsUxyCepgEIn9MzU8VII6mBTZxu0Mm4LxZgFk9HH9hOLoydEUNnGeCJjpAlQxo4zrB6C/TslkhodLYmWM1R60qgRjAdskq5CuiuYkB0pAZzoQVIqiHVAXPdZoE7axBg8AAraFDTL41ATVsyLRMPaAJz4k+HOJDURZr7+tiKsJZhM7AnwTIjzZN+14nvqdz19BsHjetprBH6iq0krWO8ES5OUouzAut7MQxs78qbagaAIV7hSR2+FwuDSBJPiTHTzsalgqY0us73FSgK07vCQG0OKsIDeQuyT0M1fC82clFjEwZ1aphQ8u9j3myKGFCr+gFJBRiRVtV0AiPhJtToDPTKJwvu5KGRupBUyx0T2EYO1VSCamumDjkDZUqxlA7VG1AHuEPtqr0YRiKHInSqhq0dtQ7WM+VO42DtlCylCdgzoT+QidFl4dLFmGw/0zQ3BvqNQM64i/HrDNqgXsrCOkcR9GA4uPc7FKiH73JQZtq3DNBQXQrMGsgGxJHQBOQVD/RScJVwWCUgWEEjhBYGBlHB1b5ij0Yqm+w1sTeBwIDk4bAN4AdTnZNqbFMycLWZNAUwEk1AQLDNT5PNL1PtSH+oSPbozUgDyYAqJliPfzU41sksYcnNklGm+509WQFNNjSoekDxykwRlLSm9KFAll18bIYBtbuRNsjjGDVucQIl//ZdHiCugRWWeZzUB4lc122OzMnqj0elVVEBHxRd1YbGxswSWneOPrRknjgJzQBeSQXEXlriC4jzgWAGi2xf8UBjU6zohaurcPnmzXDhpk2wfTrN6VJYiww4urYGz545HY8z8FQ8nl9fJ3VTGmad6ElgTnlP2FOAIICBUAEFaAFQzQ0w9r4e3IrXgyVYKEp4c6J902a4YssW2BXrcIGifT0mObJ2Fg6ePQvPpuP0aTg163MjBCqnF7o7GkwFMg0YLKTaMZCEZ5+8FUwMYgxBBniTGDPpap0Sz/PAkbr6aqR9T+T3ZYnvkfYdK6uwQoPztShNj6yvwcHI70OR/wfi71oocnKSNVDRmKklspuuLzRnV12H1L4I1P0K3mKesZoQLRAxwQCgvl0Itl49COKNIBLhBM5tJ+2Lbb+z9zUXScUgJRBHBqxgjVtByEcBeKxsVwBfGFmBsDsy7y07dsDrLjgfrti61fiijXoBG1Lc/pOn4LaDB+ELR4/CExHoE6h2bx6ksInCg8v0r3MAgDqZoDutsZs7HhBSJ8y9IsDO1RV4285d8MZI+1WRdmjQPhYeO3kSPnv4MNx97Dg8d/ZMAW/uOB3Z0oX2DBJkSVht7p5MFxYG0oaBtARWLcJ1wcD+4BA73Ap89a6d8NadO+G6bduk8y0KqaxHnj8Bdx45DPcePw6HI8iZ71nDTAqPOnLfFewEKLosZDv6LCIBtmfXjwCbQd0pHgplJJmDaT9Kt+MjHwk8KzaQ0NAYAPJvNicSgK1kLkeXpfCKiqu2NKu3ItleFpn4zgsvhOu3b4ctkwm8kHB6NovgOJLB/cCJE1k6BG50UDNxoQ5okMSz7rzae6HtzokAuaS7LoL37ZH2V5+3HbZON/w1mwlnorS668hR+EwE94PPP0/mRPWArIdgBl3F2xGMXz6HUA2PjqU0qAF3KGB/VaT5a3ftjkDeAdsi7QHOPSS+fz7Sfnuk/eHIdx6j5MkUoj0da3Tocx233vO9XsxGGUuE6n/n+vo3FLOpvDMCWrtl6mDASWMA671g4HYKzPE+S+gVksgrnQI0VKYmc+JvXroHXhGBPO06eDFDqmgCx588+SQ8dupUUUuIakDGDAABM1uKqEAsPmg2LWg0tCNKte+96kp4RQRFt6REWzakBrvv+PPwB/v3Z9Ok0A7i1eBJojqrCKJ1St1BNA2bUEDSOMTEF0VT4u9ccTm8MWrDTS8y35O34gtHj8EHn34q0r5WXHohmYAgIE6/ZxuA1qBOgF4nQK+HOljWM6UMaDZD+Bp33Xxz0CaHnhmc52NOYNbSeVWBd8VdywCQ7Ll3XXQRvOfii7JkaIWNSosxSCVb+2PPHYQ/fvIJksQo7wME9aAfQ0xATUJAsTETs1L811+4G755z55RbfJi0v6JSPtHDhwgW5VnRosZUj02QTSOJyKra3LzrcZn3x35/k2XXAI7VlfgpaT9yNnE9+ci7c/KmCWZSwLoBFqwYD4bO0MaNM76XtLMwIGaB8TpnREqS795mTvurltuCaJuQzBvvlW7y87wMWjT+aoyMzKQs6nRxQFGBfOUpNv2CIIkHb4q2msvBkOXZfDnjhyB33p0b2Za1j7Kfg5gvTnFi6EnWbJ+jwDu4G9dfjm8ddcu+HLSfmek/T/t2x8HjzOlaQqoxdMR9Dsiyk/bFzAngfM9V14B74yA/nLRnvL89KFD8B8j7Wtk+qUB4zowgIskzucB5HyNJHO6z+aKMT+CMrNC48MHA2iwgz8D6K4TG9hIZgEzCLg3sX0NNOqMBe6Oqu6HrrsWLo+j/40GPSgcY+BY4LTPxFH5P7/vfng+AmNKkpols6TDAuKJPFsAcX40MX7k5S+Di6IHwOcbXkKaOSTT41cfeih6SNbFF6xfudQ0VDdnAcN5UYj841dcD5cpvnvazoXmscGuj9sXTb5/8eBDcCJ1yA5zR0yS+GwC9qzPQD4DUCV1qCA+21vTQ3zxLVDT0XkwyygZ3bsWQC4eBOuLJjuT/bJTSsv2cpIS26YT+B8jIOaBOcw5ACzzwxLpfdqLIxj/yateCTsjLezDLrOWoUz6xCN1wNUcTxM+8cGdEcwfePnLDZiXpWEjNM9Lm9x/P3jttdF2n+aIRHv2HvFv5j/Vg/hfbP0p/Nj1L4dLI99btL0QmmHJuOS+/PFXviK6AKcZC0lIVCFZvDlm4goAzNt/+gDCKGITsymY2Vk5x6HbLoOYZv8Q0cyUsSuLz6eB3paKPWwaH/yxCIjdDhAA4yB8oWEsz+TT/tFIy7YotbJ/FoqfXA9icx1K14etUdP8wHXXRdpXR8v5ctCdQgLlD0RQbyVbMQsNHnhD0pQdTV4V03FTbKvUEa9wbkRd1osdxvJMwuSHIh+3RH5mUCczKJDQwzp/IJNYIRiBarCovEwcPE6rVG4k4BlCfmlHu4D8Sy/sh8xqi1Tf9111VXTUb5HWCvqAL++RQmrg74r2JKT3B/o+D/hEYkDxj2fAxOM7or1/6ZbN0lhfrqMfof2yrVvgu6++Kr8TAQQMkWpQ/L1pliIB5TuvuCLWdcuXnfYW3SlcRXzPcQqU5lVWsO/PdAp7nZPMgxluCnV4pG1JgIGETrf1K5R62rcQRUzNPE1+xB7ee8nF0c+5SzLVFQwNTmuwvxghjFy/OQ7s3hcHeOkLizRb1ZG0Tu8cYF80y7suvhjeSIPXVj4vEomjYYz2115wAXxDpC3RWKamifaYgGl/T/RkfG30j4/l81LS7vPX52+LfH9XpCthIwuTAFkay3Q8VN8/v5ZbDmhaDC1wdwMgq0FhzdD2EHnHFqDOygHbL2UgtXtlJYOCy9Ijz6B+5RysGmkBeyMNEUae4eu3RffbxXGKOvFWXm/MXoEeLki077lk8Py5gOFcaB4rj8+/Mfrvz4/2cT8rHbC8OlDAvCvOuL7z4osG+W2E9hdCcyten39LpP3S1U3lDUEynXhsVj+WAPNujFgIjEXKK3umDCaR3zdBaAE7hQ6UkR7Um1dQ3+LStk5ShcmX+LejykvA4AoxOMNYhdGCXqQ6Abtn6Q3LHbAgPvnA33fl5TCLo+9AhfDvt0Xa03sNPh9Ysuxl6Fg2bav8RNu3RA2TrvI3lUR3mtj45ssugy1q5u/FouNc+Qzu/LyIif82mnKJ1uyfCEraOiBrSZzGb4IxJZH1dQG2KlQjXq7pqvYO/Uph8QTwb5J2aaYnzf69Kc5E+RoGOg/+gJGggM00eft7meAZy9evjur7+jjb10dQJ2CvR4l37bbtMf78QVqfz5crjJX/hl074cpol84izcl0Sr9Xb9sGN+zeJWm/krTPK+/1ke/plYdEM7/fzC9KCZC1V0OeVBIZrEbnIINCbTvbN++GtrQBNhFUZqSi37CfwTuiAz+5YzJTcQnGkgTmY9DjvfSmZzY6uHRF5uPN0aY7G8GcfaKR9q+O6ppnE33ar/QB7vyrI5+TPbq2Pst1+Np43QLyV5pWH59ej/jr0aRLUrr40QO9C88vMhG20L71yVhMQeNUBzOZrxN7/Egvol+2oXMhGVTllcH0rsCbd9XB1DKAA1eWGRx6JKrE6MySdm+hNCPlJkm3ParB9HLQjmjbXRslNkC7cb5SoQWQFF5NLxYl2tNk1us03+ErS/uA38Eerzv/fNgZ+Z60S5bSYSg8BWuUZwuT4OI6j3C9iqjpHfyk8QNW8Zu+8k3S+YZoamzuJpaZDqCtwd4ouAFGvR+BEjMjFqVtSY80A/raHTvh9NpaNjW2OvtT/4LLw9/zYUEfW5i2Va4+ki39mgt2RNrX4U27d2fJt0g6Amyc5jAvrQYqzOlMzgmQbOmviTRnKd0HSay/jClvWllvhuDVu+1kzDdyQ//1lCGpB21upJ6WiHt7GmEzfaqiwgBo91h9T38q5cOoaYJDcoNKp6vg6bkhejwSU18f7U//OuY8UMwDzyIwLpMWRtLo+K+6KJlM6/CGSPsi8J4rzfk6WN7XT9nASqAlAueb3HjrNAaQdesIECZbusWYRBwvrJgcPBhEhwh1qW1oLUoLcPpsbqR3Oa7Zus2+orlMMOIYqKcOogwdfHPgs2ZzREVpid2i6Yrt2+DKaGpcFgcqPixdh69QuChO/FwaeZ7q4MMLpd0IHGXmedNg9Hn368PLIs83T8qSDcnlmIM1ksupLgRdMu2hQ2wsY8CJWnlnFcCfvDCxxXZOg5Mr4/RsNufnSEU5H6slMasPrmyowPb0ttKaHsGnrYehfLz7/a98BWyaTJqS8K9K8OSn8+Si++HXvUZo1/LmnGhXHb8lCJfOM7QvjQ0cC0gfdtx19BgNxIORXg0cm3P5rhBqvQfvcmAjgzCH2rKEVcgumEs2bR6kNwM2fQ5O/XFd+grQfA9hYBer7IRWbUMbApwo8WYIh0u3DT+d+qsEZg7ebEjh4q1bBvc3Srsx/RAA8RyedXlou9nPMbBQ27N5c563KFI6qDqotwiDbetyUgnUpE45A6uiw8iKlvy5ePksP3+wG4BeVezzSygepIqmltC00tql5xNDiQNry+LQeQ7UFXeKAYeGQUu8ZVTruaSFBenH6FgE2IV0NDr9WN4BRm4w/9Hauj5/LZUlPQmqHXFwuN6XGc8cJ5KvpA668jqP0OZANTmCRwC6HqJBXpbVKgPR4ktMZsfO6LIbY0aABpBhhOkuk7JiZTud1BXbWTSqpeq0iJBmXxsN55J2o+mXSQtz0hqgIcylKbQyGbFpwlhGMJBBtU2gzNjmla7y6wdxcIjsqXEfwQawcxojKqR+A4X606QqDyxYaPlXypzX880zVfHgT96NdG5wtRJllmVogkrw5/Ix74gEIddKEyXWQqg2dtBV9OmXCBtI+pKl3UhoDZxxUVqvQkbas4X3VnwrTQrJbzyjl9nSnbqVSC2B1zSEUZpraVO9ZpgRYnrWAvVqOQRqqMtQycIuDTUwhmvd+42QNBfjjGlpHNTPeomsymxJa/ldwgTxfWHs2WUat5UNwNDEOJfgeYwNXrQGS0IDQ2OJCmi54mmw5myNSD/5S3bCDkthvY43Y80WhgYAemZX1uXwRJjtD/ggiSrrytFUJS9Ntdb3g3zsicqfajSo7AgnWjakUV9OOiMo6Y3OjgtOKyiEaknuA7rGsDcd6apcHwZAddoE5jy7LMq9jdx8BNtpuYFawqiBfwFmq6eH8WLzvfTuD+Mnf4zc1wWBAjWG4C/Ubwh9EEB7kMivNkEALLAlU6xfIMfrQ2fOwrygwWKkMcVBsCCE0KDNSxmVN5Fd74V2A+j7Uvw825oBho1ygorXtGObJtN/VL76PuCweB1QlTsgtQHkwQCYCup7MJqMXzBbpKX0SQAYdGauc3BpMAyzPr6+Jt9FzqROdUGg1rs9GZshGHwyn6ZjBGu+lAWoSwHF7KjL2aaIQIXuP3lCAGEc8uAq54HrCmaws1aQ4FoX1X2fDUtIkZbqIS2dg6s8qvOA7lmwwJdrBa65aVs0jKQfpNW9YSRt0M+4zqo7aRPgUPntaWNBpNtM918tBExnVcW0tG+i8eDpM/myeMxC9p7NNNbQdSLXiX2Y2loHVwt+URTM7J9soQCgtkwL8PCxYzZ3lrrQICLYiqP8aUgc5rCTKMF3UXAA1M/qcnF4v2VqoEqLwdanNXtViXb5jkk8Fy9pcTytpFEAb3ouNPhCOy8BH47w3AHID/SDa191a3BtOmX9gX0nnidMlQ8VeACY41AJR6jxY9u7pTynLL7NGryZWDRiP73SVwqoawLnRbiB4xAeTUtYETe0lOW6hFYtVY8HJ0m1JNeSkxvJ8XyYt6LBgEpJHANULdl0owebdlAejv9ii8hGPSUtzEkHVnJL3Rp5SRZhPEsxl9x90xah/SxHDPgPDUHUCEWDB7jr0GGpOO/XUsZpYCS0frfHrO+dC6x77ph3OXSFmkcI5uWU+hJRaeWT6zP40tGjlWBVcZM5MyOoHti6Vs9YOmqcgF3HaSkL4xJSD/JETTcaEjXQwdWlBdRBy4/ELUqLjfLcuQGzT9voOIYVaNvItEGjOAN0V2xwYNHtxGj05Dx8/Hgcd52Bmiw4XLmX0EKbxRrYHYQxTquKgj3MwuEApJbLikS3PP1UW2L6YlABERxjW+USsz1t6PI22l9JNX101H99fOvFG7nm3wD23V2+9s/jgrRjecNIOWP0wkjeisd8H4iPqPjX7Bz+NrWFFgAtkOnnTMBKiw4f3L+/rBFNpq3BWAB5+V+RaPvpYGYo1Hc5Br0xhCaIZcX5YFe+LEtsdfCnjz1e1mv2EgOlzLoCaF/j+De4Hu4ldx+cNACwkhpUgxIgOK2Ol3vQAAo4oIzdw0baMPIcNs7DAqAvQ4dLq4OPF0VsUNEGS4ARgOs2ChbUrUOeDWDGYQkjH3v6aUCqgDYtZgrIjDcWnB6bPgxXS5TBoAO3KhChuurqCv8F1M+cOg23PPkUfOtVV7KWg3pSOaMlMmgm4zDeMFeBeHRgFm8eiAPUX/uvN8Itd98Ljzz9bHmJnAYdQHUCfW5Y0GKVC75OX4GAjgGI6pdGl3yetNLVl1wE3/yWr4L3//V3wJ6dO5qg5mphcKBs1FU/Y9pUxfPGR3oskU4/8sST0YlwHLZu2SQTI7LhKNTtLVodRM65/VT81NOq24l3nLITLOU9Dl54G4mxefPytIfKpIM/2/84vPuyS2HTpLG6KDa4xyBtiASHU0D9S8/pdk2ndzyyF3783/4ePPzMgbL1wuoq1YfBqlbsDB7AwXSa5cKLhWzceCqsMSztUF3n866k2H/4KPzGh2+Gm+66B37m7/4teMdrXmUpZyk6B+iDENrxnkYvqz74+OMZK2kfFiD8yC6yAAN7uXo6lM0DNk0Kxm3H6omEtAUwsi8aRUqXtdgrqvKn5t0EbjvwLHzi2WfhGy+9rPoudal8GhYzh/2ixdNimSRpCPgp7dNHjsBP/s5/gMfi6HnTls3QTTrgr9eFKUEDur3Y4cbDQMYtkR4b58uHgmVU1ygS0KwBR+Ixz8LF2ZS9Bw/Bz/z7P4Y/+MkPwIXnn2coCiOdOYTlu62ZA9BgJto+9tRTcMfBg9CtTq0NjTwwrGt56y9jqmljcaf5YTYNkiZBNhXQVLIAuSxAy4tts0rJ2wuThJ5EUP/SPXfDDbt25w9PTd6qsAANldaQ0uLvbIlrVaf08zt/eVtssCOwGsE8XZlGQE/iDVkCR9nwQWyxcnPcLvurGgyUFS9kKwoAMMsApO/30nINa2uwL0rrf/Whm+Gn/vb7hnVWPAdoyqMBDUGZE14ia1v+udOn4dfv/SL0Xfr6e5K1esDi/O1J89e9cJwLD6qQLQJMVZqk8HSebPAyJEAFcJbUNKuTpTP9TiKAJtMJPB5nDX/v4YfgR1/zWjOy1p0GWtKAJQHdN+mGnXLA2Q994V6YblqBlc2bIh0rmR7eT4VHzWIfkqQmWQ3a1Pr/Q/DbaeQ4GvnJFhRpu7wcn+od22wWB+y5k5+FW+970OQnPGAB4u61QmgkYsmsaWP6/t9H98IXo2t38+bV3DbscgoaxIRP3oexVtjZlp4W0CaH2BlhUEGZfqSK9iSlda8pNkiXiVxJ77hGSfDvHnwQrty2Hb7tqqsNogNn7mgzQlqBGHUicNJApU/k7z9yDFY2rWa7eZpWbsoSgF5L5IKdk1zAremDNsMcKXNDeInSChFOl5PlXPmFtF5cR1I7DeLTNlhpQ6J4/vjhozUrJYb1Ng/6RGNA32e6/edP3u34l3Eg+Cv33AMrqyswjeOrpM2hKwLH+J8DezawmhoIRuhUPljMmlFbq8FEMoeqzvI0JZQtEpAkXsZzUh1RVCdCp2m9iPUz8M/uvANu2L0brti2XTJHpdKQKiGMUi1rOr+Xzq4XiPaJHapLpkZaS3lazA1WU9zri7M+iATQqkyX5XnDHaf1vgNAm4e1OkPI6mLQp9WFjKBd6hwqoHl5NqzGdH5c9u7uijadRFCtr88smMGaFyw4vAbVNDNtehZVDgXmJ54/AT/56U+RwEuAnkRaJlmjyN7lAOKA6D0tMAR0K24KDZ7lc2r0uksnmvqwlObBGm+VkBmWiY5Xqz2cOXMWvufmm+DfvvNdcP35F9AmkZYo6fTEiWDfQm2/3O2AzDSD9Ppim+XdmEKdgSrbKBd7LZUle3SEYkblvLyNpKSSLns0YCsNbjytL9NlgQElNQOnjHOwbBQPdQHxkjDfibwJNOZB40vWRQlQwljZNVp2/3XWAS/X9cSJk/C9N90EZ2K61diRVnhsk9sIaG9G/R50FTS8G5h8Fui0g6Y5hc7c1IMk0lu5PtTVOHPvpzbraEQik6E/nRbTI1XgWLTb/v7Hb4UHjx6pPVcfjpONCaAB4b5Ckm9Z4zcDOm+yQwxjpuV9s9PCuVi2HS4b8WBNg/W8z3sFduZ+jW/FdYP82mnxHNI6OmIdNK25LnIfch3T/bQ7a+nENW1S8XkgNumsKefaQeJY7atGD475DH7pXJTggcOH4e/d9JG8WedqBHI6knTuJp3gSBcZNB3KzNCf/8EgroYpqFGwF0b1RR0U/SNTkYhkhvB+00XChdz5yzYDsBIonwDPnj0N33fLzfBPb/gq+JtXX2PVujNDRFqHBoCVamtpZt2oxT/Oe/uhbFzJEkBLAlMO+g7TkK7YkKI6rWHkBtKCq5BPjzpLvbBmbT9eLVb+kOTgvbtzW3WlA4ArqmVe6JccXbOZKqA7v3HfPvi5z34Wjsfx1OYo2FbjuCZJ5zJQ74rggerVYJdw0fb1qyiRcoxB3wkVhqfMS6cxABrXtQdVYHPv7aUiJbfiwpvStG5B5um1s/Czd3wWnj55Er7r5dfDedGW0iZIAMs548NWNKBOr86RmUEHsIQOxcyozvsuL2ySpTiZF1rFNqXPWMAN3NtI2kacviQuS4fmMb0AHRU/gDs6zR1QR2cV7sHMJsigo3s6sJobYi/H4+jZM/DnceLkf7/jzuzx2kxATho7gVkPTGWvcuqsUi7jF2AgtT1PNG3NhWYM0whY+VyjP5SlDMoItPai6oHA7P7tphORGskaOLO2Dr9y793wx48+Aj/+hhvgXXmd48qcAahYuIVKQ3A0GymtGhDZrMh7pPO0Kt3vOqG9NCC9P0CACE1mgJK6MB40gWGDaeflrdIiEYNQec03i2sVqRN38tyMUicu9L6OVDc2LTy4USdDa1boLD7zzDPwC5+7Ex46djSCeKVI5vg7mRavBsrYpjzBZoN0Iqz1GJC3iJfQeJdDp8fGRVCMqB8nltlEFv/lHY+ySHXeeWVSV2fn7eGeOnUK/sFtH4M3X3gRfHeU1u+4LC0yPjHdrSWB5VqBWDc0qywg27MyivbHBm1ysJkSiO7CgaDz9CDrGvdAXaOLgzlpfZqxMJJ3BXX1bBThwa634oPONjPUmThklU6SmkVgUHQEHQfz+1paV+NjTz4Bf/rww3BrnAVcjUJsS5TKCcjpSJIZp8WrUex3EiAde6CoDEQZ2LIlUDRkQ8DAkK0pND/B4i/BRb2PqMNSKGWJaGbeOJ8M7OzIR7OBZ1p+ay322LsOH4Q7Pvks7Nq0Cb7lqmuixL4Krt+xE7bweyCKaiEFhxI7aNpp8ANYJDX7oYsqq1+r16lV8lMj2spR+lbdze+8+EVpF8VBlYrlHBWJhSPsnWHPQpXQJR3PFmY3a+Jbj9U+cNXrnYT2gQVJAvEjcYLkxsf2ws37H4f90S2XgLs1zgGsxl82MVaS63SiwUzg7IY7+labWZXnGTF2j8LiHde70rih2TDV7uGepCdoGHCFoR1lR5t2pj3Bk786VnatW4Nj62vwOw98CX73/i/Ba3buhn90w1vgDbsvqiNrxUwPbFR08UieX/EKaNcRoW+L6QWroDoGCkAss+iLHlAdRvcwGArPSh89q0yKuWkBqixqgUp5BWyfIdrJHu0oF9GgCNVTRav29B2aF314QoNp4l8Wavprnk8+9QT89r33wL0HD8GZfj0DN5sWUwZx8WQkTxeqyZMwUDGoOiWohgzDSoYhL8zkBJ2bdzncyGIYjLejlCIOfCWpAar3gPPN7xbQQjRp0iNJ6TWoWy3vXtkEb9+zB959xVVw+bbzYOvU7ketgc2VNUKVkYEgHpcisrC6nGQQRINazZScB6qBUjD15iv28zINoOJ1lNYYAezNABbYtmrtvJstQhJX92jdgUHbp2xeUHygjh+g0q5DaERw3F+79DJ444UXw31Ru378ySfh9gPPwoEzp2ETSeTslovnub3JfVqkcjUltMYx5xCknaB5rhpd45TOp55BzaCYY0ZlWlwEqC48oJdlggKNPE47amUvCMCrdu2CvxHt57dGBq120/rJTbDMNLadizNMR6RBBw9AFHjp+WK/seYJkl0gaVwYr9A3KKZVeDv5RtLOS18lGLi6IzC1JZq0ZrruCuDZwigdPNW9LLnVXGc5VPzojqabPGmArdE2fsvFe+Ctl+yBY2tn4IuHDsGH9u+HLx47UvaLx/IFk3QiZRoZ/57vwFxRb+uKhaBxOORgc1CIMGSp//5uUJBIarAtpVpCppbjvws3b4YfuO56+Gu7L8r3+c0q8I/6iwaILT1l4oBGSQPnuwGG0Kt8mxnwCAohoKU1UqfR/dkIEh8C2nuhLRPqPTRpAXU60g3iuAikPVhSS2yFeadJwWreZN50ltRgAayBDfqaeMUvqp2/ugm+bs+l8DUR3HceOgD/5oEH4bkIcp223XnRMQGbKVuxHmqcxvih7RMoX4KjtAC9DxCKqYE4LE5G3iqa7dfEsbQo33dffS18xxVX5+18jUTW57XWVkUH27HBVaA0ElKjkfM+qA7lXtDGvN1mLSuHLpjy0XGnIdeqUBkJvt04Lc5J65WgScPI5tC18iquVQSe8QVaSCYR0NkJCmJN0/8cwChvXo+QvSkyEI0Rb4ua9g07d8EfRz/0H+57nFZUqsANHQg2mnWngpDOMVRXKig8tviSzo0fuiWZwT3APbxcl0LQi3+XSa5U/HNe9Fz85KtfBW+Jg76UfBbA+D39wSG430ERWrqWjRXJBYRgjewuI0kkMNh69I1M2xgdioA5WG4+Pf+uLdvWm7UcKhMABCXycr1ko1qVToPSXgbAI4JEYYmAVuLLuiwwCJtjO3/ftdfB1du3wa8/9CAcm/W84WWdETb2L/+xqo5BDXpQDvP5JyYHKoNbZ8T3cCQbrBlAVYzCk/IhQBxa74l+yZ97zevg2q3bq2sogJHQ5hdqJtzJW0HUpLRbJ35osaeNnletzVIJQEkr1zkVHca8Gr0HTg8uEN1G1CxoLq4o6t+guF7Kqnv1odDGg+L8YlJP2qthjgXNE1ASWl3Ly0hhKGR6dfH2iy6BK7Zug5+OHpEDZ8/mWWQ2c7Rg5NP0spVwQN8DaJsc4kWisQ+03HZa2rLNxSYGQEOKq/cJlE0UmNXx2Uuib/J/ffUb4OqtWwXM/QiY5V3cMGS0x1MLQ0H21sU8wma3ox4to3JXFcb1ogvZzRbAlaFB6wE8L8zrjc30uDBv3dSIxUmHZD4hMUrkS1fbMGutbC90xQ5HrPxXgsT4oYPjf2WjlMPP8cJDoO6njUx//g1vhH941+fhUHTN5o29lamErYqhh7Adh4jJYdxc5bmpj5BfY0JY6YagdpNlVQcsjOoL88npeX5k3v/5ujfl7SqCA7Ps5qWYKcwYntbrUM+Hn2WhSCdWbahsONMiHM8vOoogx0Wy8q9EQP4rAGBxE2rHEMFdUvNsXK5zN7/niI8elHRW9yQdHR1Ld/plMi7dvAV+IYL6A5//HDyfHOFsCmqLAEBwlalDmnFW5UubaPeyEr4pzH2XgxM2l8BqPUeABQJzGgD+WJzW3hPB3Dsga6kMYNWbzm8ecaH1y7NRWkJDxbKWLEkqB6xAyA6+vkqA+XyBNuJH9eNI/EbyCPayaht1M3tVwlDFSGU64g00KyhtElyxaCV15k8Q2ZGD2NRKg/KA8cotW+GHr3sZ/MJDD2QTlN/HblW9OFpxXvVH443JYfdVrg/o32GoAxEkRCbpnDYRev+VV8G74qh3RvyVjx6DVW0M5EWgboGMn5FBEBKQlaRm+rVG4YmXOmaszn+v4kYDLhGvicZzzMPFockbQcxBJYmLAGqMfZBMDuyabjvdETS4fZPoTkpkiCFhNn2C2jbfFN16Xzp+DP746afyhBroBQO5h5hCQMZvdWIsGHb4ybHpUjzGsXviECKi6POmWRkEfssll8rdwYaNAYy7bOA6WzJ47PCAkO3o8oEsyzOa9JFrkPNiawcY2GV/BUMFNO+HbU3A6glRTwhgqKPzx6lKW0q2MJwTGITgzBBqQ7HulPmhxeh/d821cMtzB+Bw3xfes7YIunbBncHgeuzeYFs3YRS0TArbOwYVTPZzP4vM6OEfvex62B0d7t7UGAAbykyWH1mbQzEPYHhuAzUUSSFtS/M1H2VNiI4kujs6d+jnx9K37p1zWlycdkA/A6Q8i4Zm7uz10zTWUF4ocOgd7+e1j1l2IKhz/RuP7ZMV+J+vfxX0eQfZWRlrkVoWM4qaUVNWh3fYanH5nXrjXJ4USVWnseug0Kk9ILdJktDRvnjz+RfAW3fstBUMbXNDshgisxmkh/ruyT/80g37rrCtU8oFWXjKLBHN5gtONh+oPj3kay2LPAtBO283nFY3Zn15B3X7gDSRekYzQ8kxPRWKlS8esADtpgijF8N0rOwkwvHzzXHi5TXbt8M9J54v73uI6w0sr5qmQgAzsYI4tKFReTcqb9BkI7OFRtgr1RbKyjzrsxm8N/ofJzQL6D9Pp6SGgWBya7d/UCUX26kt1QXELK2okYMbrVRgFy8I22KoO3cj4AbMkRczLbbSq9E+irnU0W8gs4C4xun5fWQ2O8AKFD43g/URAHuQ61WuUnHyNT/3XSjaOEpR+PZLL4e77v9iERSqg5VHEDS6ZfYwODMDcWCC1IkVIcy95Ic1XoM5AMggsDCgz+bGZdF2/oY4EBQprA5tZoxJZ31vDNj6XkuSAgNUg5pEmbz8wxKM/LPS4AttaNUxXtKgy7Fl6rZiQAfVGUVrsqKiNmKbuZoxEzCZqnWcA6g5AU0WtinlW/4LfcEB1inzBOqv3r0bLlxZhYNRAOYPQeT9GX7jztY7SAGqrEZbdbBsUGq5UkvgTqYGSee377oQtqaPIIP+LB2Mm24emD0zlr2WjpDaU+xFqIMOusZO2dHs1tMLRstX41jvdapzmOdHDnTn89Jj49rRhnw+llbFo7qHavwQlLEs0hnB2MEBqubTkhX8NcC4hg1Drcn5azxcsLIC3xy9HrM05upDNbnE1aILC0uLkMUv+EOVxmikcwDRDInYtHliNPT/mz17bCXCEMQtZkAjDnWcEqymyugliGtoMTPUr5zSm2qctndpPTGtc4ChzD7XtO5ap0V3L5/yC0n0joShHVUm5rrUtX7eVJONfZQMYSg8WjS2Qu8S6OWY33HRRfBvHtsLOOlLpx18V1d/gzIFw5zy7KZBriba3PDACvKbattnQG+NRL32vAvs5Ik2ORxj5klnVRTRB1Vz+oQaBB3NGKRGS+9Dd0oJyeCKPkmCMnUcnA0HG7B9XfHzQ9hY1rggr/rKXnnpCrlRsIKgY3OEHhETjNfm8HlqQamiF5LiyAoj0lyPn14dsXJB1ObHI3Y6Ze4FJbwG5bNpOBKmJoE/x0Ym6CrN3o1I1FVxNihIPAzUmSbOMyHYrEcFjA4BGpJf1KlSxYoZuQzj1cAqybsRCb1IDPm0sGR6nXaZMlxDy/MdGmbkAS91Ho378kxXPUHs6XBFDMqcd3+cTPMrOLCkwuuiR+y2o4dpJ1l6E3IseHzqXwplYqUlnRq1rMCriM5xaZnWKH6v2LRlkFayCENmhJFffW56Png6hs9l6sh2lKqoypeGxkGvL14P+hpPNXTpAG06TJpavPyMpZVztGXk5yhikNbRUYuiiSKPA9brA8mgvt6RASSozgADb9QYqNHdGhM62toRgUeRaUq8P3woC0R24dVdrtCqaHFV4qBcvh68D+0TDRpGIbMuHl4k9OVbNksluIB+RDpr4C8bWkJs8LwaELHZUdIRc9jNhUoasBpOL3KEKqnH+AKN61Zj4pxrXPD8vLRyHqrJkZtYOX+T1yC9KoryDVa5F7ind50BO7fJAMwAoxLcn7faJwV245mBJ52nwWGfPWRBFv0Z9GgYCscxwSFbUjCDEGqeY8xmKc1M6DMxPVyc3qijAoNmDljmhEa+LWAjjEvqUQZifTFJv/OLyn6uJgY/UtaHkI/vEIcEtK49sQDj4mtR5TaSFlx6+hAY5X4BhJga7JqmRkWZfOqaoIQl4lokzrsXGkcK50+nWRim9+YnQZfB4MGBK9CU5ezp5tt23r2XgRPql9wazGn5liyho4djhQcZyPdcviPXY20ZYAhkfz54hiUzYm04ig+6p2p9T/H5o1pwlQdoistip4Zx0Zry7lRaiVwi30Vp+TrU2V3UqMlx/N5KAQfS8g252syjFhe57VqdGRptRTxsC5eaxC+DwaRO0xp7PUvoOEwPk6pNQGEPsfqdEcwYQYfhV9+ukUKw0XI7aNWhP3+d36vDkBeD66YEp5tjQK51ACijfiA7ml1UoZohQNKqq2BnCnLDIwgUhm6JWgM0XgJHNbq0tefAIh1l0/K9IR0y1ymDXPvqKPtyzFOsobImAwGjBnGohGgrpkFpO4L6mrkGbW6ox4omD7Q8c5AbgiHU7WMLEY0bKgF2j5VQGhCDpdB/5lIWlOmFKHaMn+2HKzxocI+B2l+3znXP9irMlJdmvzITOkA9oWDcc7TgjEiNrvCFyK+DDt0qWHsVYKPkF5LW10yn82AucXnhHiGYOhaPAVDlxy8pM3o6GnSxJ4iYyLf1uzatxWf8uadUSg42Xg8INajX88tsALw9CHIOiA47wfGMsBhq2hRGJlawimNNpDpnYiszAhw4c8YkEGKCajMVWsxyVLTvIaiJhMqknBetDT1w2ynJVDJQkhTppKP3GNEDiIjttN5EW1EESxB1pJKKJXkD2NyKUmZXy0NVvhaX4r7p1HVQC3CoorraYbIZxhMrPDBcFEYb4dyCl7VHzq4De8sEzgFk3ZQCZWw8PcRoCnZQOC8IKIPKS1aLzoBK65uNVUKDG7AthwZFamwFlxiH9Jm2V9PdbC+iXo6KXXUpiQyqUibO5FDpLSEAyki2BIrbTzcTQlMkqLSoOWI6VWjGiVyiupTlFwIYkwP7KsgJ1IHfhR5r9OB+/fmisKDNdLGHzpxWu1yR10xWuwrVtSht28hEheZOsnriodanfjdYrtU9Sv+lo0dMVnodZzHtGrgQ6a3vIQw6pCETxqQ3DwRbElmBAt15Dp27bnFtDAXYiBnrdSNpTc92PdSnTzT2TmLnx6r6KnzH+h2UpMX6bjQzUh1sGnAeVZiBUVgGqBqwpDElmvujA3U69j7/PN1U5QGBG5mkOsAFw6Kg+Ffip/OaDsTBbXnt6CfN2MGjJ07YfCihMRPVvSwV6X6v2xOHNAVdOLTpzUlY+nTki+bGk7fu6Gl97Xs9joEWYOAC8gTMedTcHEsrrYbDDu4DWwyo0BBoYRleST4zF0zd9Bp3TSqDJUeK16BDm2asKuZAe53CHYcO5gUdDVhHtLjGoKePabSbBhGAsfGQDhrg+suHE7N1uOfIEXj1BTtECxtCAYxTnEEN/p76Ne6eMKTDS+rgpHIYvHlGQ/tOZcrJ6btCSUu3tAsLtaoOtaEZ52bGT2hScWj7hC5Hp9Vli6Zr8AD1M4VAZegkBvblDbwAMksK4qeHJhINPz24AgxNFVS0oQK/l3ooJObzew4fhsNnz8KmrZuBNWt5rBpgGi8BxgMX01x9NP/wZwdYkwfu/RDcrCpmoKRnbnrqCXgNAZrHKkiNItovDCnBFsGacfNqY55RElmtcWdEBADZ01Dqgwi23+iPZw0LJI3vqeKCd5qESGqmnZt3GD47SKsBBLXs/NupXsCjcn43lDulAnrvf0EJiwDW5Ajgx2IVzKF2QvMsBzXs+C/7HiNw86KanJXqlNJulqGhD4M4lX2lqV7YIU2NDiY9q3mkrZH/095H4ejaWT0e81ga/Dqa7L0W4+YF5eEQWxoa3+Pxd/z6+73WN4PdyDH2zaD/1m/ed4MbyXtuWqx1oLoGXy64Dx8kfn4QLUhAbbE/KNCKpFYdUoSbki0n19fhpiefzPtKopiHXusODYzABSr6NHC6eRXRBXCGrDL11g98JFto/+mTcOszT1WhCCPA5huuUF7rwRhG0Eg7Qi9wBVlKo3rfOfub6yc/SGDgOJQ0uLGjewFxG8nTHVy3vGKS1EXFq06Kgii0nX6kzduMBSudhwJSNLKAVwnS3K2IhA8/sR/2nnietmmuryWIpA6s+RXQCUDBla1De0sKHYEAowYl1M+XMO9PWDYj/92HH4L3XnZlZig6LonPODgGhhEilJrT9yWJZm4AA+QUiV1tSLZ/6/d7WnzoOo/3ngF/5oSXKq0OIhz0tWJa8YagVHXoARqRumCBGwKMaktUJWozE8DKFv54KE1x/+lje8uGUoQdmfhqcMJYCsr90vrca6nN6wcdklWPTCWhmB2JyNsPHoBPH3g2rxfM9rNIaEUTzFFVnhCDaWyrQjZ/RGNojsoBYNUE1MkHwTlaOhSfscUwn5ZPfdpRhqq0rV+X1uSlz/vWbWI+zRnJjc4C2vCzYqZkyd8aNuqi95fMbFM0yJyWO2575hm47dmnodu8iSQ0vaNNhRQPFZg6t+RaK4jJYfg1gvD6fmopzXx7lmzo1OOmUwiTKfzE7Z+EE2trw3EZDPHVbDgP7jGafLwTCbwCaVZVtF5FGIC8cZAnwHzLR6bAeNpuGN+65vRj9xalbeVtxGCNs68AKPOLhJBrYBh0QNUuGGyctB3/hNq+HbTJOnDqJPzs7Z/JGOmmK1kAajpaUleEk2nnNiQkK1NhegI9UMBKSRRgM4PSlrfRcbIyhSdOn4JfufcusZs6B2JU+TAjhIeoDo4Plr/eQtGVr7OBZD8SEbxoIxoQdEbtobI/669dtEXHDY+WPe7Tdy9aWvYu1WsHXKyTKKCAzfaoB4n8jhyadYM4Hr9ilQUTdaTrP3r0Edh76gR0ar9v+QwuI0pnVvFl5R2aejJm01/jtsMBeOuLSkGii+7S343l4vKHmph73GQ2hX5lFX4v2tJvu/ASeM/lVxq1xhNXKBnTj1J180JL60s+Ipn1OtGd6kUMZLAMFB2KhgeguFPobaQdBGKw7f0ATZni00JFy2ASpzZcHXgQHUGLTRDzA5VNwO7VIDbrkNdGcKibTQsoVHKR6sCSmf1I+vjQY4/Br3/x3gjm1bKpUPZwdCJsRKhKmSisq6apIxrrgBLAezkaDVSXX2UGQ2OmiRidXXeTDOrUA0/F6J/49Cfg8RPHW9pwKLFR52aZGRo3jJRGVQctIsTe6ZR/uhPpXJct6KoYaal4oz+7kYq8GGlV2XPpoLQTdHXRYpK0ledHp+IavOSIlsWH/ly1H4N5oorg86dPPg8/dfunIyYCdKvTMiCcVI9T0BkCmEkfng6pn9LBaOhcHUYuGDRob6OKZ/EfiUxmx2Ql2kfxOBxm8Hdu/At4MlZIqx7+1W0EXB+0jJMylQQPY3Tq4XSngQE0cKV7WHdq4nhxebmGx5EDGgduIP2yaXFeeqRBlJEWYNLXDtM4Wk3ueBoabOZ26kCKGxxT+n306BH4rg9/CA716xkXk2Q7J9OUJbRkCCQwa+sHVRY06Bs0v7s2NrLEMZPSuZ9w6RQSsdiiidBJlNCT1Uh8VC9PnTkD33PTX8ADRw4bKe3bwHTAxZ1R6OXReaGHpVpn3/vN0SVeJJh0xG5wjs5nbQ1F1YFR27rdaFpYKm3XTAsL6bA0DydcbBsBS22aWGHzQgRGsKaHP/ghxpluvwmBin8fPHwI3v+RG+GJU6cyFiarqxkbWUJrDcT0UaMHwhpAo0NhbXsfOhgBSTNoCY1Qu49Bo5bSkfhNqzDdvAqPxQr93QjqG/ftNSqJe3h+NNjyvStJ3Ejuvr7WYBYA53g1KGJpTGqbvR9GbWu1bI5W3Fj6jabFJdP6vMlkEoaWZwIOTZb6+ijV3fFRL//FfGfvRnDto9stS2k6WBN//Mn98L0f/gvYf+Y0TDYXLGTNnSSz0Aa1XRAHps4A7GBp8KEbfbCRUQUMqQP5pY8tOyWBaDfRrGJSr9y0CZ6brcP/8LFb4Ne+8Hk4G8/FAwJOUsOQeSKFg13ERjO6dLBOJFzQnc1LbLpn1sDDZQ5YMl1JixtIu3y+7WPgmlMdeCipARaqPxeUAJUsuO20kEpt+y9jG//AzTfCkX4WBdommCYMrK5kTGAyNzplP3tBKQV6c8QR3cCo9XIggneBYagP1BdPyug7u8LVtkeBE2WTFYtbhhFHjF6P5sc/v+sO+I8P3g8/+7avha+77AroqGdWVUOg1nWDOZpDh86ty6HB5cAMUD69yq3gRs7NkSnfaxHCBBpCUf1dIm2rks20dN2P01FeUIK6vFlHz6e6zpQrb0HAxq/xXiggJwR8dN9j8HOf+VR+BWKyGoG8aSUem/J4aiKejfoWpOSM5aW4YsLWOQ5U9ytGHJCVN8h89R0aFZFzLDM5qKa+q1slqNnxOmLNg5KQPB6g7K0C7Mejn/oHPvpheMeey+F7rn813HDRHtgeGSBVRD26tcQNANJqhdzhnBRj0KBqZE5jnsd2nq3zVhos3JlLqUeKxDeeW3qTG2jYA1TvvHmMykd3Wq0Ng9WGuh8PqkTnZ9bX4RNPPA6/f/+X4PY4A7geTc4E4mxukmROE27JA8ZChds56GxVG/G7JxnHlD40qleJK2G6kEdoMxGzQ14thboXAYRqKrD663jbsSlotdrHnjo7uwY3P/0k3BR79cvPuwDefeXV8O6rXgYv27ELNiW1BNbkgAXnOSgpHJRak0EQn2dSOjvBYEAwYMNyGkLS15dsFvVAk3fAdiO00vYqQlqcwMvCINU12WhZCyW7OQBPJmVtZmy6eqp/TTXo5MTZs7Dv2BH4yGOPwI3xeOLkiTj7F8dOEbwrEcRddgqsFqkcvRri0UD13jNrfmTgwiivREjC/GA3DZITBPvmfbkZ2Mxwb3MHrqn+4lg5+vOCgdk/XRo6/eu7AvY+MmEWzx+Obr2H4szib3/xbrjhwovh+197A3zd5VfDhgMDtkPTgXiWMDhJXc0SVVVss83HLsIqAixuAZ1WnczLW+LJYrB9oHzRXn4Lv+sH4gG8vc0dQX+VrUNo0Hd3lML/4vbb4AsHnoX1DsskSQTylFy1xWU7zWDOQJ6wZGZzIYCxjzletw2otmkxZKSNllpOV2cU5BoHta9fW2C1a/QX0HmwqOhR7qjLz9sE33jJ5fDeK6+BV+68EFYi+oMzM4x6GqW1SmLjV9amBzOqQ/uc/CyHQhyLDHMeWFLM40bSpj9iR6ajr5n02ZAmEzTxJdS6Iw68HABK0IfBcCCH1128B371ve+D+w8diJ6MffDnUcMenK1VIOf3NJyfGSwPeE2QodStLbwRjcjB7LEy/AwBbLycC3KJokBblWC9nVxCZdM/Mt0C8FfX2CO9btrD11xyKXzbZVfCe/ZcASsR7bNQN5rx1VwUcppOgVkDubMvJaEGt3CW69nBUDb5EUZonNM1wsj91j0Yzwtxflpt6HLaPCDsgPe8yRvk9sSLvD8gVp88DYbFdlb28wDkQVEY/yST8IaLL4W3xPb7wJveDB9/5in4w8cfgTuPxrmGSXm/pJPBH4A2NcoMZeE5GlSXOkg6biO91MPgdQAbP1w5qRVK9zbnvKwWybXKb/TdOkjanjiVlOE1286Dn3j5q+DtaR/DvgBY9jNUDB0DdvAHdyQjkbvqjyXah+48MqMKp3NupYrooIgiO4LUDdTdSldJg4oDnq817xeWlmhGereG+V2NDRnz8DYPdrJo6OUII7+ozBJjosRjJZqT74neqvdefgV8/MAz8MsP3RfnHU4W5QCVd0QARTZ+0X16pXgglPjnJEm5njZvclwYkYvcTSEM5IecZYEXKpMTE/JK6D384wjkb4/ejQumq4PdZf1Os5l/oTYoV00kCJEpzB645kDZyQTgfG1n30QikEEq/VMGEIqXUtdQCcAKtIIdFzfCRsKZZtsG0iJotMueNyqS6ShNljpzqLzocCAg+BwaUhpIe7KXk/dM4SPt9Z02rH/Lrt3wh08+Dr+59xE4lRJNwCjCIZi5HIc3w3AcxjfCYLHGEQib3o6NpQ3Mjp6uQxWA9rAj2lX/5JWvgW+95LKs/WYklc0Os6HSMSotGnGmsomU5kQJVIYydjWDU2C7us6lU77BcUP9emnirwchuLS+Zv63kRYdkynfMGhN3TtJCqIaFFKy4A+wgqRXxfAneEyxFNMVUG+N5sj7r7oO9mzaAv9blNbHs9dlonSLpxABYBykLBs8R1ph2krQAngrs0DgZmmuP60qpwhld6weLp6swK+//k3w6u3nZxNDwByUuaHALYAOlo4x2iSQe66+OwwCYuOX5tyQGQq2dTqcwxVY4t5G0uPwXFwX6l4mrZEWgpIlLKor+upileX5Ym3UOrbmZ3QI6sSbHTOlHWbBPvM3on39qvPPgx+9+/PwRHTzsWjX4GTpjKrTDYVUW6gN6IM6tWAOL4sQYKBua9paQ/SFJWamrSo2bYbfueGtAzDro2+B2REcWoeW6MGWbSkFhxtqhczNAGbRlnlYNJxZNpxD2mX6COLwRnNixj9cz/0rBgOtDwp8dF/zno8kmVvteu2W7fCrr78BLkoLmye1TFPLlhrukFWGLzo8jXw05z4HvJxjsyDX0quSUNb73Rzjf/N1b4IrN2+pYO7L0fcwvmWyVn3QALWTBmJzEyDlKwZsdEiSyhKvegO6f8OY8TsvVdp5sRr/ui9WBw4qa0vlxgNk02YDPMt173ivN1RddyBed8e1W7fBb0dPyBagtaB94wEqqylsrP+DqjDwywz+0IlEPyB4VW2lYFCMKVtUhNkMfj7azFdu3poBvM5gdpI5gxvqN7cayPPUod9mOf121FA4QLEmHWGABu6aGMwnYKDOFx0vVdrR9GDrxSc8bezrzQffTrzywqS5lTUdJr6haVP7roXazuuUJv1etmkr/PT1r8wCToN6gF0vPNER3sKnGmS2306ZI5HtbIdlWrlVtkhOYP5AHBi8e/fFUjEBtTv0xucMYgE4wGAHWi+5tdS4dss2KHYYGrFleRHUOJElFplMga6VoMCRAxZc4waePae8pV+GKoFd29kxMXVaSp037HG8Np2l0YFyeyAd6lltcmTJDOVYU3HfEv3W358+x5uVcVXGClHklbwZ3Noq1Yo1wuLXrRoZFdwSBUEbBMVESlskvyqqme+Mg4Je+ZhbPV8kQG+vPWKD+pUSdT5E0jt27C43mvyocAiidSiepjnrErX+2QYrFlzDBp49p7xFyhH9pUe6p+jJUCU9R31TFDYiSPQBVUiYNoDKd/DtF6yEZxD3wQqx74mAvnrTpgzoIJMMWDMUTJ1baAPaZ4g1PkiN1G8oPSrQILCLhP5InMK+cLqpAlnZzTPFjL53IFUMazKTy1MdQXeOH7z0Srgu2ut17epGPQjwQYMXB4leYNhoo5xLIypa1Xsdhluo40udE2+u2bwZvvviy9rjGA9saJsecg8aZkivzA5lelwQvV3/8NqXw2w2K4PEXm0wDgCGD9KrYNgsI6BfOChEWCClGOBU2z5K59dt2w7v2nWRVJQrpE0LPb3N6o7pbOBZ953BoRti12QVfvaKl0cpsBlkyznJQzMrEB898AMMnbLncsBLnD6AbnypR4BBXYJOE5l01epm+PHLrxWBMwsLvEtt7EBotQmDnto15w9qvBSPr9mxC752x84ipUN1OdbC69ziMkFjdKojszkRQrNSOgbliTrNyv7mZDt/Z5w4SSKhNdhoTW97Bo2FIKWWIPtGh+oDTRL7TVvPh//76lfBfzj8LNx04hjsWz9b3u7Ls2MBZEbFuQXqYBEWE8IsWCaElzAtAAE5WAQy4Gn/m0k8rooA/przt8P7d10KO+Lkx3oYd5kOMDZGQgDxG3DQryuke6mMVKX8Bkc8X8UJfOtFe+AThw/n5eOwo0y4QxIOB+MBqPc8G6QZr/zc54Khbiwl9yRmlJIU6R2NZOj3a+tw9XQFfv+Nb4Wt3VTUTFY7oLwZWiipopbqlGgHRfqrCfP5fGfvySCqYRsvwo+wgXnOeVTz1CUcVsV3xrFyWhdhIWGNfILVYPyrJSW3j0jSoDxNUCXuouB5qj+p4+8Lk+Rc6cpMXvo906/D++74FDwXZuo7w5RJZ8c22mMl5gcOC6fQ3tZtNDiZGhTz8vbIM3jHzj2wXfX+BGRjZsBiMGsKsEWCAk2vHkg/HVeqr9O1MgseKrCNlFV5oqNBbrtxCzSJs7QMgmOvATnXqdETmnkpAseEQQvQRlsqU3AWbHuMgVnzReKUlEZVJn9bkLUoS+oE8FCmx7/9kj3wm0/ui2OuXjZ6KjPPAIOGyVEIi4Te+PvQwVLcYnQVA8U266O58b7o2WBm8K+RyP1iMAdXDEtkRY6pL4M6v/mbpA5JZ1ZzvDa2dHpfgKOhiXdsly8NqYGH86VqcHUz5PT1HsC8hGCcA2G8OBEi+lcG51B/Nfh9xwOY3y6jpgfWNpAxFYH6XdHL8hv79kKYTgkYtOmm+WKBrkE34niY/4I/jkVaSBbDvoft0R56RRwQ9r2VBMbPOXi6hnmN0orLL3sqUAeSCtnzgUpCsHRmvsASQQM2OECrziQrbbFBD3Pq1ei4SBfVC1HycvJETK1BXvPAHCyvjaTW5wADIeTzHGsDqQO0EwTVBjKvEEr7vHr7edGWn8Dx7MIjW7qR2+CrtDmFjgO6qU6D+Q2kQ9ldl97ZSB/RejDLyDfUAYNm9Fw1PacOjCEtLVhjZQYqUwOUyTFWPak6g1gBTfZHYWIoE2PChXHpls/RpjP14/yDep46CpepAb3MABpcegYT09gSMqZdXB4Lg2okLXD0hlB6MmYSmfem83bAx44fIQnd1Rfecl4NaQIwt/GW+wSLM/FiRzhTAH11nOI2zApgZv9aDGMA9rA4GFCH2nNR1T+Fju7rdanB9fJWXKtAb37kaIMspWoV6JlWkbzBdQamP9g00ik4bbD1NnnoOLD5mijX0Xr1nO+AXGed91weUcCRa22embKo8Ku3xDmDo4cgKCeDBTAuTwRoQOveYIxUzlSLEBCq2NzI/s0tWw2TmPktuwwABlJkmdACtcRRRjMGOsWZX9daZsDM0b5RqQDhSHDEBKspWCoNaO+H4OOj19KbeaeaQOc94JeOYI0UhvwN7tx3njAn26WDaiCNIoMLrFJ618pqeVUiqK2RWw1l7A4vnapEGF1ON5DI45f5pXrefqSMEqgvXl09J6ZslHEe1PnHixWwDNUiTpsdxmsBMBRPrV/uREoG1AxV52U54B7XhLEnRkwxnT6UTmBkSytoHjQawJM/qFIYz/6cQO2e58O/sZeO5BHLApEJocDv2QudWN8S1PSa5or3pjhCxXyzxc7uBPJyrKrF/7Q0mFvbcwweh9yJmdZBIwZlZzfuWZ0+LKw18NZb1Q1wpKTUoDyv6MCaXKIRejVJ0UKj7jDObhupxvBeWKqvzA1Olw9IDa5T9aqtpjxRQgdrU+ZvS4OKFmpgdLENHdwTvSabDupd2HhUKhLmM/lcwqCXslSkc98pQ+MZnJPvWJwHRl+LFm1g0rPkZomu81BSHdTzHNcaW7SUSIvoMHLOEWO832ibeDDjgnTmmhHu7o7lsSi0AY3zSQmtk/j/bD9rpB420jyh84IDc3TOWKIFiEWNEFS+Bgyq4wiY6ab3agwGfT5/cB1jhLCxDjdicQyfUXTASF6Lgi5Paz7vixYJje2815K5YXo4M9S3nrseabDFEpoNdG1jtDgXw4H03Rice+861zAA7ghKrb1VG0LuKZu49y0W6jNmyarQaDDNrgatetCk+ajBF8bqBjC0+VWn4nGBLr8fo2MD8YvShpEbWpjla1eZo2trdqKLnsqbHcHGQ3sZA+/t0Ht1NVqLXxx//OTz0AxBnhyZcXzhodnwPl4B0WNiEHDeTRATysgSVRizbzApADAwL4LuFOpmcOmXeXndegpgYOJwXPNZeHFDZrcXKmhZe/DMaStZ+I5vUNSN5+6rVza6QYlS1EhmY8THNPcdP9rOQUmkpY6wgbTqWDRRwA0pC3QjyAtLT508XgYbxPBOV1uZMNLowXaUfM+lL8sKQ/2MyjEGNV0ufw8uDVIGCh97jx2SF7DkRSx+bn6zgarOSxsUb5nuFPaePAGAOK6FdMVb9+W6ZLrxL1YG+aLs9bH35EkzA6zbFlzcgkzPOXhADDp+UGCAAoDT62vwU7feCCfXzgy3yZhTzkCdAhg/awZyB+Ir77GCmz9h8p2Ega3rwLQbIEPpdGcj7b92+62wlhaQx9oRDajn0B/ghYPZ8ELFGbrdM3x95+GDwMtL4AtoeH6y8xH+nK+1NMJB4gLq07MZ3HX4kH3DDU2yHIQBYdigoxKW1TLMl8IAI+q1IcH4uP/wAbj38LPw2LGjAzBji3bXQoYOBOvShBYT7XOeZgQHCFQNRuf8WuYjRw7C3QefhYcjMMxWH1jrr/mnJ7n80W/wCHMOUOVKBR1f7z16GI6tr6sNmywP2sbDfNB3vicbZvq8JK1ycgt6u7wA40effdqCYQTUfC70BYB5HVR7DFoEekmsJzs8OBnY6Z3pvBfIU/vyB50373vEbJFhwI2OfvrtB4UrglogpjgvffVvUHXQr7wybXonsdueeAzOhBnc/PhDeaOeCdo3DXGMPGyTvGzABfn5cvnddW0q/dmTT+S94dHZIsVERpMPjuXr7rU/wZL80c6CNbzcslsTrff8n5/cF3vd2YpzsKAGaDBzpCcNJK0CA0uZQXq0z0rHAQUKtRfPegTDBx9/OK9r/JEnH8/7gzDQtQoXm9rTzWVjI16VG3D00VJ1tI0tDYm1ofSmPGlG7EQ0kW6NnTEtKP6XTz2e66K3zht83ADDjq95tdEwT8Nwh2Sa0V2fipL5o88+WRbEz4viE44oB6HTjyLVKTZoqoPCUVGO4FBd+w6DGQuY01cHaW+NTx08INKtpeI1R7TP1khhPtVpggWtJtnYs3T4vqhpYgmdAHHo7Jm8nvEzZ07BbU/vL4DohuobdB1QsUafa3taHbpqZnbP5cv30cWL1ugK3QnQ9xx6FvadeD7TfuDMGfjoE3ulM2pQG23uCYPaDmGePeeO0MjDXxvtAlbz3fLMk/BYHBAWCd3ROtKVIShMrlxo2tjGBOBBoQY16tZxD+pfUzhmwhKg03Zuv/3og1Fa9Haf584x2BXjpzmFIegOxSgNfKQ8AG0dfZnc0FNq+D945AHaT3ElRk7gDx59ANIaHQO6u6G0KwXU8oNli6mLodPfV52iU3XWHUoDuWweG+BPEu0rtNNYPP7r44/k+1NVP94vUH8W5VsQG829TPDmpD40r/QncumYRWz80eN7C16mE6h7lcMAoCBqDsCqe0c0nXeLKWZydbzKHMBK6UjgZw8fhk8ceNbaoyo76bnpYTWAMJILQQZY5gA7AOMgj9JJLrdTQAb1fRv9fjRK589GKVf2AynA+Pyh5+DmaHrkNJ0FtedfRx0MGuuj67FBa5UjbwJ4a85rEk37Sjw+9fST8JkDz5TOmGmfwO3x+rZYp6kCvv7WUuMBHQIzL5VdE9y9sCCNViWylU2ngKzOb33mqYiRg2WV/7RVCdvRhhEOc9Bo7EYYWTlp/AEDcAXsBOZJ2rh+WnYJ/cUv3Q1HkirvhpIGPXMBmpLLd0gtfX16VCdMYl6DEWGw/Vhi7snZGvzS3Z+j7cZou960oGC8+fN33Zk/4vS2aBMcmpOuIoM06K7pOW0nC5hBgRpq2Qmsa5G2n7/r9kxrJ7SXHVp/8Qt3wrGzpwX8GtiirbpGh/L8bPEch+0DFgbVvFC8zr9Q6DgUafs/vvSFrA0TXspq/938Rm0V7KJ0M7haUHBq0qJQIqXGbAfljesjqO8/cQx+66H7TQ9t2XVjzNJBC785nXNIIsLAK8DH7z98P+w9cTyrvdQJ80HnT0Vb+l/fd4+R5gLmDoZmEMAArEYC6mvFtk5dexOpc+VqcP72/V+CJ6LPP29sSkJkQttR74t26Z/sfUjS+kN3Ri/0/CBca00+b74Oy3UAMB4Wz7e0PevvP/IQ7Dt1qmw0lPZi6SZ1E07B05BAnNfoKtTldEe7HxLDVeaoDHSyfdjLUTeuX4V/F23pv4heD89QM2iBBjhgSAo6svw9n0fnmUkdKn1C/2f7HoV/dd+9tO902egmdcQJb0UWj9+4/4vRJNkvdqsxQbBhRvE5qVyhFRtp6DrofEKVnppfbGLw70eeeBx+6767YbJphWznKe3YOy3aJpog/9e9d8EHH3ukLBvAtndXXXrieXD0MG+D8x0HjXZ0fAcwGiXzvquSeaqOD0Us/OsoSDK/eb/vSfFwaKnG66Ogxp2AvB2Ylo6XVA30LqrYwwDGrgl8nW3CCnIGNw8MJxMyPSLBSSX+7BfugPuPHxEpzcAYmCKKud0yAFdpWGoaNY1qMIWlQdPx8LEj8M8+91k4neIJEJM8mJ3IICXFpy+R/6fPfBIeOHJ4KOXAaprW3uVeeosUVucizdSzvizmVwLzQ0ePwM/dcXve4zGbSStTorsjTVNAjvH3FyLfvxTt1Ck9K/ynQ0tQGTAC2MEjtoFrTCN18GCUtcNKVzvjo8ePwk9/7jMZE4nG6YRox44GhYwnICHJjKo49HjTeGWCO/CR0kVrJtJrOK3qRbr1qvuu7vF9pO/h73/qY/DUqeeNlOPKD4DtQO1tuGYcOHBpqaSkUwLzf3/bR+F4nA6ZrGySBU462ksvg2JSpF3aATVtpfBDH/8oPBif0w017WwjzgOzsSvBSmNtVmg7mQ8GQzqePPk8/Eik/XC0n7u8sWWL9kmW0NN4HItt+IGYfv/zxwywWl4Q7QnhJs3XwQK8C/Y+P5eWJBC6QbUvnT8daX//rTfDmSTwWCtOaTBoGlrkp+BPRFhLOjfi8Jq777ZmqTeSsMTJJzLKuDIfNvI6ZbQc2PraOqyfPQuzeKydOg07I/H/z9e/G1523gV1ERq1ao9fxXKMFEt9Za6W7hpszOj90V7+7ls+BIfixEnatndKG0VOaC89pDLSAoJ9JGx97Wykfy3vTb5ndTP8+298D1y6bbssnCOL6GClmd/h0DSHEdqZnZn+INURAE2hStEnjh+Dv3fLTXAg0lRoX420k4RTtCfez/pZoZtov2LTFvj1r3sXXHXe+WZpW1lkJkBzNasgRDqWV9w1B9zaPEudKAmDf/DJKNDiZFvexD7SzzvNdnkTe16irQ5OMsidLc2Se8BMB+rJjh/+4f8F5gXUDzHruDx1DaxeiSiAahvFcDLODP3Row/BVdu2wSsuuADqrBAMTQgYSl4ttb1fU2zkzrrlsrqNx3+JNvMPfvwWeD7Fpf2naQ/qTjZT76qGEW3TSWHHYqf8k0cehiu2b4NX7txR6Waed65DUaWEXufZYfWuTZiJphlrPT6yfx/8yMf/Eg5HbZGBvKlIuMmAdiKEAA4EiuRp+qM4lnlZBPT1519glKqx7xVfEYbnk86acVrbshZc0b8x/qZo7//EZ2+DgyxEEqBXqqmU7WfXuIXvAjBiXrUUKtBUI8wF9NiDgzgEh2eTRNs6DP61KEFujJWcxd/E3G3J3tNMhSG4NXM7BQ593emBlDIzjsXG/K0Hvgi/GAdJZ7ATIBdATCoglC9LQN0RE2mvw1NR69y0b1/+oPOa886D80Zo9+aQNkUMQBqAnlJ8+j0ZJdov3fU5+OV774aTKT7SvbKpRXsnTKu0E7CJiLUofv/8sUdz21x7/vmwPdEOli5PoxEg6toM7qE9eH0+8v1f3veFyPfPw6mYMG9kT6ZQcZFW2mUDUGIceheYs6PngTlHDUyOFEbeAA+ik/oq+vvyxXf169BC1oEWcEzmx/paND3Ws/nBZsjVm7fAT7z+q+Cdey6PDOkG664xGU1KcAh+bYOeiRLhtmefjgOjO2FvtN+K5yKZGKt5AiK7ubqJME73fl7ZMn9aH9X3bD3RT+bTWqrHGlweaf+ZN78Fvv7Sy/KAzK8IZNQ22DpgY9aQ9yzqch49fPqZZ+CffvqTcSr+tKO9uOk6nioeoT0RMiPaZ5n2tczzRPsroqT+4de8Hr7h0itz6WZrEGi76wy9CmsT/qXzNAP4mQNPwy/f8zl44Pnj0RNDAmS1emTy/t9KIxpTg8EdQIHcSWeDg3mA1jf79rIvZhlT/rDR2NIAvKQBr4Bd1rxbz4ydra1npiZw9BEcIca9bfdF8J3XvBzefdmVsGU6ta84wpCxqOpiJEk8PxE7zs3RNfSf47Tqrc8+lScdpnkWjcAgdudEADEaAtAq831enDuDOY0Loh3bn020z+CrL74Y3nfttfBNV12Vpd5gSVq0tOuLTL+yoY9Ge/fWOPv3+w8+CHcefC6q47Qh/JRUdOmIxW/bKdpHVKTQXkGd6M/AjnXoYn1eu2MnfMe1L4f3XH41bIt80qtc8a8Onu9a2xyPPLk9Avl3H7ov0n6gDFizRF6VafmJTHNP8kNDMAOYUT8BGnXB8r1hI9B9vPaeeyrt/EAIlVXaCB8MDivajJSmDhFohfZAA60C7JlIugRqZvY1ccD1jXuugG+/5jp4ZWR2KrQlJTSDS90C3HP4UDZl/mTvI/DM6VNlKpt8s8zQjtR0deRzvii4EJ4BrUUSaBFKBsdaAkcBxSw2YqpLH+m/aus2eOell8L7XnYdvCl2UNmPRPjW6JBQAH3Xc8/Bjfsehz999FF4+vQpmiyZin9cBq5Tol1UNEiDq2ar3CJQ8+ZNBdhr0jHT0sepPa7del7eb/19174MXnXBTuClxlvaUWMuCbG7Dz0Ht0Zf/QejAHni9IncCQvPiwDp2MRIbsWueGOA5ityfmn/9XTSVds5l58L6gSnAuKgpAEUya35mqHKgJYIboMgzW1upLWg7ar9UJpfJHZGcr6OrAQkSd0rEySBOAFhRkdibmJ4ktipEc6PDfrmCy+Ga7afBxdG9X5+sh+JgLWYz/FoXx6MnpO9cTbyzgiIw2tnyjsBNEvJEw1ZKrB7iyRbp2xOgkRFXf6rUVjq03OnTEeiN0vsdalHn4AdwZHqd0Es780XXQTXRFt195bNcEGincpKtuzRqJ0OnY60R8/F5yPtB8+cNTOs2Q+eNEukP7vjplUqi5mhGzV3HKwLs7DJpMxD9twk/s4GtJf6JNp3Rtpft+vC7InavXlzHCes5vXnUogp8uD4udjpHovmxF1RixyJnRrFB86TJVM5Ty5QZD851lFlBm1nB4DJdg7GxKjnDDcWQlxngKGSzYCGVhizo/meA3WGtTJDyAdW05NbLzO2nxWJvb4uUruAYpalSU8bsvRkk4vIMHqvU7OTXQX0ZCqDJlZx7O+UKVbdc1HLzGDrzp0V2Kb2wE6dcVb2CyHaWRsF3gXJ85JUbWrUTDcN7jKQJ9OqSQztRL+g2dPebjutZRI9zPvAZghpzcT7zHfZnaov30XrsZIMygotQhdpDn6Hp+NOyG0y6Spw2dRA6/bRAG4OBFth5N507gMNR7CVZ6yuS/dJdMoH4lyBQFvzpsqnDYUmHc009qUh+8QIZuiMVCRtbxF6JWmG6gZI4qK8utoViUHqLcejArLoTPVrEUKVq4BG6qBZgmA5WFp2swn00zhJQ2BIC75nLUQ7pga/vpfy+Ajtk05evUUBwRzaofFrQgC2eVghs/RLwOr7JB2TCRP5nrXKtPB9VjsrjPGdaJeX8h3txa9M8ZjukX0iLjkE4xoCBWapTwPMWgCN1ruEja0+ajLkxkKoi9xpUEvXjrf7AuJU2QQOJID0XWZiVqWRKazaZTMZ9qAAGCM0k9LV/bxRqWQUkNMLUwbAlXFo6qUrF4oECUGtA106dx7ERTDk1wQS7dRJQ+pM3AFZktPoVvY/UdKg0K20hjmQ7HwE80qlp320UQvRTdonpNozj0t5YdIX2jXfaYJM+J6Obg7tJIUHmlAdAzCjm53WUrpVJTkfB3MK87ek8NcmKS/oSAAQBhCoZRVwECAH0AwuwM62VPo0ui9xxUwJ4vrLwHKjKv0yS/W9FjUIZI8NmCXPcSbYZpjaQAXVaMvQnssk2vtUZho4VrNKz6AuTTv7wVu0E78r7Ypo075YtaVI6hbtSUqHzHfueL3srxdqHTiPIu6HtJP/3ggWJzw8sOvzmnjbHrgAtPPCdID4RZlpTwjSICr34I7AX6RRYQOafJH91KoiWVqTfZx/J50CBVTGUnrJ34AUrY2pQbsIzD54aZCL6/NC7kHVveTYZ6lXBiwh84D3Aay0g6IfLO2IDiScxA1ccQHtWvAgOl5pkms65HwTnV2QjhkE1OD4DoYW4bumXUtZHSevH+pnoKaFeo4D3jfqOicsb3IMCiJQA3diRQ1J7jwY6INdEQgnWU2D8BZFMiCbLZSH2WAueJsDrOo1IKZ8jIRGWwd5RpUpZCqpyvqWO1w2RZj4yQjtQeUFA1ygq8eARlyedqx2jOOXTT+gXQ1YBdx0rbvfwFyaR7t0QAAZ+Ml9UJ1X5aE6wQsFcwpTjbVmUBWVtHwyCupQJFpKlE0KxewQSJqTVOPGR8pUhFooDGBJgR1UicP54RDQAIBO5QV9XzO2PmJPVQ+sp1ReNjPSNfnaNY8g1A1FSL1L5waiGX2h2KAdXN0U0M11bYpyqfilaWfNwlqS8hCNw3wXcwWE/wGHgsTSrujmarBEVmlqvQCqr/nFBXMKZuNNqxhrvj5/c88wiWznTHxhEtLgShqXMFyaVzFZSYKgGbsMHU6CMYil8QXElZm2fjpXMqW4oQgkgW1+BmgyL6h+tSOivDq3iOZKru2QfM31CqoDapkRTI4cF1Q+NTGbbTJ2z0IGlKSu6ZaiGSzfmc+8KLmhnUAr5ikDGXGw4ZW0G8LAyGydt/hsTI5Bp9C/oma5cCApCwLKoOINgVoqAJJkhjpBg1WKo86EH2MbW2qAhglYiTRSgJlHlqq6Jyn0IxIbGBcQNANMvVnDBKKd0RKU1gJdd8VHLY1atNdzpElBHKWdfwLUzgdEOypeMFSlGZE1iGpXqhwaLWlpr+RZMGvaUfO9EV/4AnYFWBU/aBPEAZDBXfPvtJVoNKAd+fsGQGJCYG5nSwHNLKKuYHBbSxUQ8iruOOyGo3S5E7TMMw/XnmB/VTkCwlDjURAkibI2MqzO/3WdYJB3m3aFTAI5eoDDCO0WiyBodPtTiMQOoaLJPSwQDUMyxWxxJGnazMcgDhtSjsqjVNcxhdvNlbcURmN66+XwROtrf48yKPdUkRrY8uYUWN3AmBB7SW9xQYl0e4wCQV0oqSESQz/fArDPSC/sAa7uwRPD0ockMxfm9iscFINQeRkqregb3nQAtHVo0WzOcQjaUhFgyVnpINoNwGEIalO+ohNgfudjfqqOizAHS63rFib9L92bbjhTbLSWAU8thIWCrHOlgco2HD2jwQ1BD+Ra4qIWjIY2dUuBxdI9TKvlgDEQdJ1QgxqgaigCJPuv2YaeR7uyK5envUkwKAMGzFggKBAx7SLRg8qXaCeAByZg0Mw4LLFFO0e0OiBWSBth2IBUE2emTBymyxL6XAMDV65BEVh7jICaEykholV6uV0NKA2yprRoE1V/Rhg693F/Txfd6pRMuxoUV6nlM2gV0Cj9y017TqsEi87pXPhO+bQ6oBE+nP9GwLxEOHdAc8HB1boBbNR+WZYaGvgi/eYxcsT+QEePv4HtpMsyzXhwwNPuAMIheDJeGO3nQrce0M2lXZMHG6AdWvSPgNikASvUBnmeO5hTeGGA1gRsANg5WtMtEgSy0h/uOei7MsK4SoTlgTAmIXS80zZMrpSQcNGhnVkz9L8ItGs6WjT6eJ++QTt7c2paR7sZM+j7uDHacUFHWJTWPRZgfpiWdzKU/5Ey1e9D13rj0FdJUjo4aT2UDjZvW+nyE9QFC4eQB5RolEGllU3DlqhRNOtn1L3RJW7RyyVUQABomloZpx1REXj8pX0HjmbK19RaiAaemBnQ7Mod3ENFM+eNdWyQ2cltizUH7o+opLmlGW2nMGmpDYxbF4c0W9IVzTgfdy6PeWmnzDh9Ax0T6qyXTQtgO4GvVKD0qK8BqQJg03K5YGuueA4amrVMUPR48FJa3Umw0iVxaqTcphkkt1J2nbVUpKoGwDbNFG/GMTDkfYnoVL1KJ9kQzahyD5UHmndgylQ059lcrM/pduBidVr0g/OC9ADu+RbNiJYOVQ+NBXR8ZozKfcp78HJSMxNNqAuDwrWKtuLINYh6CtXzXnqbwlpVtfc4b1XVQXLfKXW95tLMZ452uRPCKF0wXqsB7fYe/yyg2WQ3ntaoJcUaQ3urvceq0alpbj3YxAU0y8ts87NvhWYayvuF29Cjpere2mroxjPB3RiIrbFnwOqnpbiyGGBNurmMFg2A42lg7Bl4cWmXPM+R9nk81+rPP78M7Yjzr1+E8P8B0szv+tLrxRwAAAAASUVORK5CYII=")'}}),Trust=({theme:o="light",...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"44",height:"44",fill:o==="light"?"var(--ck-brand-trust-02)":"var(--ck-brand-trust-02b)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.0246 11.8662C33.4096 11.8662 33.774 12.0243 34.0421 12.2925C34.3102 12.5675 34.4615 12.9387 34.4546 13.3168C34.3859 17.4143 34.2277 20.5493 33.9321 23.0312C33.6433 25.5131 33.2102 27.3556 32.5571 28.8475C32.1171 29.8443 31.574 30.6693 30.9346 31.3706C30.0752 32.2987 29.0921 32.9725 28.0196 33.6119C27.561 33.8861 27.0843 34.1568 26.5842 34.4408C25.5172 35.0468 24.3441 35.713 23.0146 36.6025C22.5333 36.9256 21.9077 36.9256 21.4265 36.6025C20.0766 35.7026 18.8879 35.0281 17.8112 34.4173C17.5718 34.2815 17.3379 34.1488 17.109 34.0175C15.8509 33.2887 14.7165 32.5943 13.7265 31.5906C13.0665 30.9306 12.4959 30.1262 12.0421 29.1706C11.4234 27.8918 11.004 26.345 10.6946 24.3443C10.2821 21.67 10.0759 18.1706 10.0002 13.3168C9.99336 12.9387 10.1377 12.5675 10.4059 12.2925C10.674 12.0243 11.0452 11.8662 11.4302 11.8662H12.0215C13.8433 11.8731 17.8652 11.6943 21.344 8.98559C21.8596 8.58683 22.5815 8.58683 23.0971 8.98559C26.5759 11.6943 30.5977 11.8731 32.4265 11.8662H33.0246ZM29.8277 27.9331C30.2746 27.0118 30.6459 25.74 30.9277 23.9112C31.2646 21.725 31.4709 18.755 31.5671 14.7125C29.4221 14.6506 25.7371 14.2381 22.224 11.8731C18.7109 14.2312 15.0259 14.6437 12.8877 14.7125C12.9633 18.0537 13.1146 20.6525 13.3552 22.6943C13.6302 25.0181 14.0221 26.5925 14.5102 27.6993C14.8333 28.435 15.1909 28.9643 15.6171 29.4318C16.1877 30.0575 16.9096 30.5731 17.8927 31.1643C18.3005 31.409 18.7502 31.6635 19.2396 31.9406C20.1116 32.4341 21.1099 32.9991 22.224 33.7081C23.3175 33.0107 24.3014 32.4515 25.1633 31.9616C25.4231 31.8139 25.6717 31.6725 25.909 31.5356C27.119 30.8412 28.0127 30.2637 28.6796 29.59C29.1265 29.1293 29.4909 28.6275 29.8277 27.9331Z",fill:o==="light"?"var(--ck-brand-trust-01)":"var(--ck-brand-trust-01b)"})]}),Argent=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M18.3242 7.63647H13.6516C13.4955 7.63647 13.3704 7.76611 13.367 7.92726C13.2726 12.4568 10.9768 16.7559 7.02532 19.8009C6.89986 19.8976 6.87128 20.0792 6.963 20.21L9.69685 24.112C9.78986 24.2448 9.97107 24.2747 10.0986 24.1772C12.5694 22.2856 14.5567 20.0038 15.9879 17.4746C17.4191 20.0038 19.4065 22.2856 21.8773 24.1772C22.0047 24.2747 22.186 24.2448 22.2791 24.112L25.013 20.21C25.1045 20.0792 25.0759 19.8976 24.9506 19.8009C20.999 16.7559 18.7033 12.4568 18.609 7.92726C18.6056 7.76611 18.4803 7.63647 18.3242 7.63647Z",fill:"var(--ck-brand-argent)"})]}),ImToken=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:`linear-gradient( 180deg, var(--ck-brand-imtoken-01) 0%, var(--ck-brand-imtoken-02) 100% @@ -144,7 +144,7 @@ Minimum version required to store current data is: `+ot+`. c2.2-2.3,5-3.8,8.1-4.5c2.9-0.7,6-0.5,8.8,0.6c2.9,1,5.5,2.7,7.7,5l150.3,150.3c2.3,2.3,3.9,5.2,4.6,8.4c0.8,4,0.1,8.2-2.1,11.8 l-0.8,0.9L691,674.5c-2.4,2.4-5.4,4-8.7,4.6c-1,0.2-2.1,0.3-3.1,0.3c-4.4,0.1-8.7-1.7-11.7-5L561.6,569.7l5.3-5.3l10.4-10.6 c1.7-1.7,2.3-4.1,1.7-6.4c-0.5-2-2-3.7-3.9-4.4l-95.6-11.7c-8.2,0.1-14.8,6.7-15,15L474.1,644.3z`}),jsxRuntimeExports.jsxs("linearGradient",{id:"ID_InfinityWallet_7",gradientUnits:"userSpaceOnUse",x1:"3824.9182",y1:"1469.7789",x2:"3888.3037",y2:"1522.7949",gradientTransform:"matrix(-1 0 0 -1 4713.1299 1956.6599)",children:[jsxRuntimeExports.jsx("stop",{offset:"3.000000e-02",style:{stopColor:"#1B1464"}}),jsxRuntimeExports.jsx("stop",{offset:"1",style:{stopColor:"#1B1464",stopOpacity:0}})]}),jsxRuntimeExports.jsx("path",{className:"infinityWallet-st6",d:"M843.6,502.2c4.3,4.9,5.1,13.3,1.3,19c0,0,49.7-54.3,25.8-114.4l-31.5-31.3l-45.8,76.2L843.6,502.2z"}),jsxRuntimeExports.jsxs("linearGradient",{id:"ID_InfinityWallet_8",gradientUnits:"userSpaceOnUse",x1:"445.1279",y1:"-730.6945",x2:"414.9359",y2:"-687.8702",gradientTransform:"matrix(1 0 0 1 197.19 1047.96)",children:[jsxRuntimeExports.jsx("stop",{offset:"3.000000e-02",style:{stopColor:"#1B1464"}}),jsxRuntimeExports.jsx("stop",{offset:"1",style:{stopColor:"#1B1464",stopOpacity:0}})]}),jsxRuntimeExports.jsx("path",{className:"infinityWallet-st7",d:`M688.6,347.4c-56.1-51.6-117.9-22.9-117.9-22.9s-8.1,7.5-11.4,17.4c8.3,4,68.6,47.2,68.6,47.2l35.6-35.6 - C676.4,338,688.6,347.4,688.6,347.4z`}),jsxRuntimeExports.jsxs("linearGradient",{id:"ID_InfinityWallet_9",gradientUnits:"userSpaceOnUse",x1:"530.1512",y1:"-337.7953",x2:"552.8069",y2:"-393.8502",gradientTransform:"matrix(1 0 0 1 197.19 1047.96)",children:[jsxRuntimeExports.jsx("stop",{offset:"3.000000e-02",style:{stopColor:"#1B1464"}}),jsxRuntimeExports.jsx("stop",{offset:"1",style:{stopColor:"#1B1464",stopOpacity:0}})]}),jsxRuntimeExports.jsx("path",{className:"infinityWallet-st8",d:"M725.5,640.1c0,0-35.9,36.2-36,36c0,0-9.6,7.7-19.7,0.7c0,0,59.7,49.2,123.6,18.3l18.6-18.7L725.5,640.1z"})]})]})]}),Rabby=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88",height:"88",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"#8697FF"},children:[jsxRuntimeExports.jsx("path",{d:"M76.2062 48.0657C78.7621 42.356 66.1267 26.404 54.0555 19.7581C46.4467 14.6095 38.5183 15.3169 36.9125 17.5775C33.3886 22.5385 48.5814 26.7423 58.742 31.6478C56.5579 32.5964 54.4996 34.2987 53.2893 36.4758C49.5013 32.3404 41.1872 28.7791 31.4315 31.6478C24.8574 33.5809 19.3937 38.1382 17.2821 45.0216C16.7689 44.7936 16.2009 44.6669 15.6032 44.6669C13.3176 44.6669 11.4648 46.5197 11.4648 48.8052C11.4648 51.0908 13.3176 52.9435 15.6032 52.9435C16.0268 52.9435 17.3514 52.6594 17.3514 52.6594L38.5183 52.8128C30.0532 66.2418 23.3634 68.2049 23.3634 70.5314C23.3634 72.8579 29.7643 72.2274 32.1678 71.3602C43.6732 67.2088 56.0306 54.2706 58.1511 50.5462C67.056 51.6572 74.5397 51.7886 76.2062 48.0657Z",fill:"url(#paint0_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.65 31.6053C58.682 31.6193 58.7139 31.6332 58.7458 31.6471C59.2168 31.4616 59.1406 30.766 59.0113 30.2198C58.714 28.9643 53.5856 23.9001 48.7696 21.6318C42.1984 18.5367 37.3618 18.7007 36.6582 20.1307C37.9975 22.8695 44.1927 25.441 50.663 28.1266C53.3909 29.2589 56.1676 30.4114 58.65 31.6053Z",fill:"url(#paint1_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.4154 59.2247C49.0895 58.7182 47.592 58.2536 45.8898 57.8319C47.707 54.5801 48.0884 49.7663 46.3721 46.7226C43.9635 42.4512 40.9399 40.1777 33.9139 40.1777C30.0495 40.1777 19.6451 41.4794 19.4603 50.1648C19.441 51.0763 19.4599 51.9118 19.5259 52.68L38.5175 52.8176C35.9568 56.8798 33.5586 59.8928 31.4589 62.1841C33.9831 62.8309 36.0657 63.3738 37.9775 63.8722C39.7885 64.3443 41.4462 64.7764 43.1809 65.2191C45.8007 63.3102 48.2635 61.2288 50.4154 59.2247Z",fill:"url(#paint2_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{d:"M17.0296 51.7821C17.8058 58.38 21.5555 60.9657 29.2177 61.7309C36.8799 62.4961 41.2751 61.9828 47.1265 62.5151C52.0136 62.9598 56.3772 65.4502 57.996 64.5895C59.4529 63.815 58.6378 61.0167 56.6884 59.2214C54.1614 56.8943 50.6641 55.2763 44.5104 54.7021C45.7368 51.3443 45.3931 46.6362 43.4885 44.0748C40.7345 40.3711 35.6513 38.6967 29.2177 39.4282C22.4962 40.1926 16.0556 43.5018 17.0296 51.7821Z",fill:"url(#paint3_linear_60607_36577)"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_60607_36577",x1:"30.666",y1:"43.0094",x2:"75.6558",y2:"55.7677",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_60607_36577",x1:"68.0842",y1:"42.1521",x2:"35.6221",y2:"9.60636",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#7258DC"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#797DEA",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint2_linear_60607_36577",x1:"51.3184",y1:"60.3591",x2:"20.1383",y2:"42.4347",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#7461EA"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#BFC2FF",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint3_linear_60607_36577",x1:"33.3531",y1:"42.6732",x2:"54.4308",y2:"69.4547",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"0.983895",stopColor:"#D5CEFF"})]})]})]}),TokenPocket=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88px",height:"88px",viewBox:"0 0 88 88",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{x1:"107.511425%",y1:"50.0147427%",x2:"0.0459570557%",y2:"50.0147427%",id:"linearGradient-1",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",offset:"0%"}),jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0.3233",offset:"96.67%"}),jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0.3",offset:"100%"})]})}),jsxRuntimeExports.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:jsxRuntimeExports.jsxs("g",{id:"tokenpocket",fillRule:"nonzero",children:[jsxRuntimeExports.jsx("polygon",{fill:"#2980FE",points:"87.9604864 0 0 0 0 88 87.9604864 88"}),jsxRuntimeExports.jsxs("g",{transform:"translate(16.052385, 23.804688)",children:[jsxRuntimeExports.jsx("path",{d:"M19.6653508,13.8911953 L19.6784508,13.8911953 C19.6653508,13.8236484 19.6653508,13.7448437 19.6653508,13.6772969 L19.6653508,13.8911953 Z",fill:"#29AEFF"}),jsxRuntimeExports.jsx("path",{d:"M41.1271993,16.0301797 L29.2440711,16.0301797 L29.2440711,38.4205938 C29.2440711,39.4787422 30.0635659,40.3343359 31.0771712,40.3343359 L39.2940168,40.3343359 C40.3077044,40.3343359 41.1271993,39.4787422 41.1271993,38.4205938 L41.1271993,16.0301797 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M23.5075248,0 L23.1085201,0 L1.83318241,0 C0.819494855,0 0,0.855507812 0,1.91374219 L0,9.68111719 C0,10.7393516 0.819494855,11.5948594 1.83318241,11.5948594 L6.82580355,11.5948594 L8.80996071,11.5948594 L8.80996071,13.8912813 L8.80996071,38.4768828 C8.80996071,39.5351172 9.62945557,40.390625 10.6430608,40.390625 L18.4502002,40.390625 C19.4638054,40.390625 20.2833003,39.5351172 20.2833003,38.4768828 L20.2833003,13.8912813 L20.2833003,13.6774688 L20.2833003,11.5948594 L22.2674574,11.5948594 L23.0761684,11.5948594 L23.4751731,11.5948594 C26.5376389,11.5948594 29.0285575,8.99447656 29.0285575,5.79742969 C29.0609093,2.60038281 26.5699906,0 23.5075248,0 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M41.1381478,16.0301797 L41.1381478,31.6550781 C41.5479364,31.7563984 41.9684266,31.8352031 42.399783,31.90275 C43.0036819,31.9928125 43.6290664,32.0491016 44.2545332,32.0603594 C44.2868849,32.0603594 44.3192367,32.0603594 44.3623723,32.0603594 L44.3623723,19.6324219 C42.5615416,19.5085859 41.1381478,17.9438359 41.1381478,16.0301797 Z",fill:"url(#linearGradient-1)"}),jsxRuntimeExports.jsx("path",{d:"M44.5993714,0 C36.1237942,0 29.2440711,7.18205469 29.2440711,16.0301797 C29.2440711,23.6400312 34.3229635,30.0115234 41.1379832,31.6550781 L41.1379832,16.0301797 C41.1379832,14.0376328 42.6907839,12.4165937 44.5993714,12.4165937 C46.5080412,12.4165937 48.0608419,14.0376328 48.0608419,16.0301797 C48.0608419,17.7075078 46.9717493,19.1146484 45.483652,19.5198437 C45.2032703,19.5986484 44.9013209,19.6436797 44.5993714,19.6436797 L44.5993714,32.0603594 C44.9013209,32.0603594 45.1924864,32.0491016 45.483652,32.0378438 C53.5495229,31.5537578 59.9547666,24.5743438 59.9547666,16.0301797 C59.9655379,7.18205469 53.0858148,0 44.5993714,0 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M44.5992891,32.0603594 L44.5992891,19.6436797 C44.5131001,19.6436797 44.4376127,19.6436797 44.3513414,19.6324219 L44.3513414,32.0603594 C44.4376127,32.0603594 44.523884,32.0603594 44.5992891,32.0603594 Z",fill:"#FFFFFF"})]})]})})]}),Talisman=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"82",height:"82",viewBox:"0 0 82 82",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"82",height:"82",rx:"12",fill:"#D5FF5C"}),jsxRuntimeExports.jsx("path",{d:"M35.04 55C35.04 58.2905 37.6887 60.9623 40.9703 60.9996C44.2519 60.9623 46.9006 58.2905 46.9006 55C46.9006 51.7096 44.2519 49.0377 40.9703 49.0004C37.6887 49.0377 35.04 51.7096 35.04 55Z",fill:"#FD4848"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.8544 44.6623C22.2462 45.9868 20.4553 46.4546 19.4248 45.4241L17.5356 43.5349C15.583 41.5823 12.4171 41.5823 10.4645 43.5349C8.51184 45.4875 8.51184 48.6534 10.4645 50.606L25.7391 65.8807C29.3942 70.2176 34.8595 72.9788 40.9703 72.9994C47.0811 72.9788 52.5464 70.2176 56.2014 65.8807L71.4761 50.606C73.4287 48.6534 73.4287 45.4875 71.4761 43.5349C69.5234 41.5823 66.3576 41.5823 64.4049 43.5349L62.5158 45.4241C61.4852 46.4546 59.6943 45.9868 59.0861 44.6623C58.9663 44.4013 58.901 44.1213 58.901 43.8341L58.901 20.9995C58.901 18.2381 56.6624 15.9995 53.901 15.9995C51.1396 15.9995 48.901 18.2381 48.901 20.9995L48.901 32.5568C48.901 33.5506 47.8829 34.2252 46.9353 33.9257C46.3356 33.7361 45.9023 33.1901 45.9023 32.5611L45.9023 13.9996C45.9023 11.2608 43.7004 9.03637 40.9703 9C38.2402 9.03637 36.0382 11.2608 36.0382 13.9996L36.0382 32.5611C36.0382 33.1901 35.605 33.7361 35.0052 33.9257C34.0576 34.2252 33.0395 33.5506 33.0395 32.5568L33.0396 20.9995C33.0396 18.2381 30.801 15.9995 28.0395 15.9995C25.2781 15.9995 23.0395 18.2381 23.0395 20.9995L23.0395 43.8341C23.0395 44.1213 22.9743 44.4013 22.8544 44.6623ZM40.9703 44.9999C32.1659 45.0525 25.0403 54.9997 25.0403 54.9997C25.0403 54.9997 32.1659 64.9469 40.9703 64.9995C49.7746 64.9469 56.9002 54.9997 56.9002 54.9997C56.9002 54.9997 49.7746 45.0525 40.9703 44.9999Z",fill:"#FD4848"})]}),OtherWallets=({...o})=>{const et={position:"relative",display:"flex",flexDirection:"column",gap:2},tt={position:"relative",display:"flex",gap:2},nt={width:"50%",overflow:"hidden",borderRadius:"27.5%"};return jsxRuntimeExports.jsxs("div",{style:et,...o,children:[jsxRuntimeExports.jsxs("div",{style:tt,children:[jsxRuntimeExports.jsx("div",{style:nt,children:jsxRuntimeExports.jsx(WalletConnect,{background:!0})}),jsxRuntimeExports.jsx("div",{style:nt,children:isZerion()?jsxRuntimeExports.jsx(Phantom,{}):jsxRuntimeExports.jsx(Zerion,{})})]}),jsxRuntimeExports.jsxs("div",{style:tt,children:[jsxRuntimeExports.jsx("div",{style:nt,children:isFamily()?jsxRuntimeExports.jsx(ImToken,{}):jsxRuntimeExports.jsx(Family,{})}),jsxRuntimeExports.jsx("div",{style:nt,children:isRainbow()?jsxRuntimeExports.jsx(Trust,{}):jsxRuntimeExports.jsx(Rainbow,{})})]})]})},Fordefi=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88",height:"88",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{clipPath:"url(#clip0_14298_75627)",children:[jsxRuntimeExports.jsx("path",{d:"M43.5075 62.5508H6V73.5954C6 79.2046 10.5379 83.7515 16.1357 83.7515H32.9997L43.5075 62.5508Z",fill:"#7994FF"}),jsxRuntimeExports.jsx("path",{d:"M6.00098 39.1016H76.2075L68.0567 55.4841H6.00098V39.1016Z",fill:"#486DFF"}),jsxRuntimeExports.jsx("path",{d:"M30.6398 12H6.09766V32.0282H89.8447V12H65.3025V26.9577H60.2423V12H35.7001V26.9577H30.6398V12Z",fill:"#5CD1FA"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_14298_75627",children:jsxRuntimeExports.jsx("rect",{width:"84",height:"72",fill:"white",transform:"translate(6 12)"})})})]});var Logos={Mock,Injected,OtherWallets,WalletConnect,MetaMask,Coinbase,Family,Trust,Argent,ImToken,Rainbow,Crypto,Ledger,Brave:Brave$1,Steak,Unstoppable,ONTO,Slope,Safe,Frontier,Zerion,Phantom,PlaceHolder,Frame,Dawn,InfinityWallet,Rabby,Fordefi,TokenPocket,Talisman};const truncateRegex=/^(0x[a-zA-Z0-9]{4})[a-zA-Z0-9]+([a-zA-Z0-9]{4})$/,truncateEthAddress=(o,et="••••")=>{if(!o)return"";const tt=o.match(truncateRegex);return tt?`${tt[1]}${et}${tt[2]}`:o},truncateENSAddress=(o,et)=>o.length>et?o.replace(".eth","").slice(0,et)+"...":o,nFormatter=(o,et=2)=>{if(o<1e4)return o.toFixed(2);const tt=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"m"},{value:1e9,symbol:"g"},{value:1e12,symbol:"t"},{value:1e15,symbol:"p"},{value:1e18,symbol:"e"}],nt=/\.0+$|(\.[0-9]*[1-9])0+$/;var rt=tt.slice().reverse().find(function(ot){return o>=ot.value});return rt?(o/rt.value).toFixed(et).replace(nt,"$1")+rt.symbol:"0"},detectBrowser=()=>{var o;const et=detect();return(o=et==null?void 0:et.name)!==null&&o!==void 0?o:""},detectOS=()=>{var o;const et=detect();return(o=et==null?void 0:et.os)!==null&&o!==void 0?o:""},isIOS=()=>detectOS().toLowerCase().includes("ios"),isAndroid=()=>detectOS().toLowerCase().includes("android"),isMobile=()=>isAndroid()||isIOS();function flattenChildren(o){return React.Children.toArray(o).reduce((tt,nt)=>nt.type===React.Fragment?tt.concat(flattenChildren(nt.props.children)):(tt.push(nt),tt),[])}const isWalletConnectConnector=o=>o==="walletConnect",isCoinbaseWalletConnector=o=>o==="coinbaseWalletSDK",isSafeConnector=o=>o==="safe",isInjectedConnector=o=>o==="injected",walletConfigs={mock:{icon:jsxRuntimeExports.jsx(Logos.Mock,{})},argent:{name:"Argent",icon:jsxRuntimeExports.jsx(Logos.Argent,{}),downloadUrls:{download:"https://connect.family.co/v0/download/argent",android:"https://play.google.com/store/apps/details?id=im.argent.contractwalletclient",ios:"https://apps.apple.com/app/argent/id1358741926"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://argent.link/app/wc?uri=${encodeURIComponent(o)}`},"coinbaseWallet, coinbaseWalletSDK":{name:"Coinbase Wallet",shortName:"Coinbase",icon:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/coinbasewallet",website:"https://www.coinbase.com/wallet/getting-started-extension",android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad"},getWalletConnectDeeplink:o=>`https://go.cb-w.com/wc?uri=${encodeURIComponent(o)}`},"com.coinbase.wallet":{name:"Coinbase Wallet",shortName:"Coinbase",icon:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),iconShape:"circle",downloadUrls:{download:"https://connect.family.co/v0/download/coinbasewallet",website:"https://www.coinbase.com/wallet/getting-started-extension",android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad"},getWalletConnectDeeplink:o=>`https://go.cb-w.com/wc?uri=${encodeURIComponent(o)}`},"com.crypto.wallet":{name:"Crypto.com",shortName:"Crypto"},dawn:{name:"Dawn Wallet",shortName:"Dawn",downloadUrls:{download:"https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782",website:"https://www.dawnwallet.xyz/",ios:"https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782"}},"co.family.wallet":{name:"Family",shortName:"Family",icon:jsxRuntimeExports.jsx(Logos.Family,{}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/family",website:"https://family.co",ios:"https://family.co/download"},getWalletConnectDeeplink:o=>isAndroid()?o:`familywallet://wc?uri=${encodeURIComponent(o)}`},frame:{name:"Frame",icon:jsxRuntimeExports.jsx(Logos.Frame,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/frame",website:"https://frame.sh",chrome:"https://chrome.google.com/webstore/detail/frame-companion/ldcoohedfbjoobcadoglnnmmfbdlmmhf",firefox:"https://addons.mozilla.org/en-US/firefox/addon/frame-extension",brave:"https://chrome.google.com/webstore/detail/frame-companion/ldcoohedfbjoobcadoglnnmmfbdlmmhf"},getWalletConnectDeeplink:o=>o},frontier:{name:"Frontier Wallet",shortName:"Frontier",icon:jsxRuntimeExports.jsx(Logos.Frontier,{}),downloadUrls:{download:"https://connect.family.co/v0/download/frontier",ios:"https://apps.apple.com/app/frontier-crypto-defi-wallet/id1482380988",android:"https://play.google.com/store/apps/details?id=com.frontierwallet",website:"https://frontier.xyz/",chrome:"https://chrome.google.com/webstore/detail/frontier-wallet/kppfdiipphfccemcignhifpjkapfbihd"},getWalletConnectDeeplink:o=>isAndroid()?o:`frontier://wc?uri=${encodeURIComponent(o)}`},injected:{name:"Browser Wallet",shortName:"Browser",icon:jsxRuntimeExports.jsx(Logos.Injected,{})},"metaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK":{name:"MetaMask",icon:jsxRuntimeExports.jsx(Logos.MetaMask,{}),iconConnector:jsxRuntimeExports.jsx(Logos.MetaMask,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/metamask",website:"https://metamask.io/download/",android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/app/metamask/id1438144202",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask/",brave:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://metamask.app.link/wc?uri=${encodeURIComponent(o)}`},"app.phantom":{name:"Phantom",iconShape:"squircle"},"me.rainbow":{name:"Rainbow Wallet",shortName:"Rainbow",icon:jsxRuntimeExports.jsx(Logos.Rainbow,{}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/rainbow",website:"https://rainbow.me/?utm_source=connectkit",android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Dconnectkit&utm_source=connectkit",ios:"https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021?pt=119997837&ct=connectkit&mt=8",chrome:"https://rainbow.me/extension?utm_source=connectkit",edge:"https://rainbow.me/extension?utm_source=connectkit",brave:"https://rainbow.me/extension?utm_source=connectkit"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://rnbwapp.com/wc?uri=${encodeURIComponent(o)}&connector=connectkit`},"io.rabby":{name:"Rabby Wallet",shortName:"Rabby",downloadUrls:{website:"https://rabby.io",chrome:"https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch"}},safe:{name:"Safe",icon:jsxRuntimeExports.jsx(Logos.Safe,{}),downloadUrls:{download:"https://connect.family.co/v0/download/safe",website:"https://safe.global/",ios:"https://apps.apple.com/app/id1515759131",android:"https://play.google.com/store/apps/details?id=io.gnosis.safe"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://gnosis-safe.io/wc?uri=${encodeURIComponent(o)}`},"xyz.talisman":{name:"Talisman",shortName:"Talisman",iconShape:"squircle",downloadUrls:{download:"https://talisman.xyz/download",website:"https://talisman.xyz",chrome:"https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",firefox:"https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/"}},"com.trustwallet.app":{name:"Trust Wallet",shortName:"Trust",icon:jsxRuntimeExports.jsx(Logos.Trust,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/trust",android:"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",ios:"https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409"},getWalletConnectDeeplink(o){return isAndroid()?o:`https://link.trustwallet.com/wc?uri=${encodeURIComponent(o)}`}},infinityWallet:{name:"Infinity Wallet",icon:jsxRuntimeExports.jsx(Logos.InfinityWallet,{}),downloadUrls:{download:"https://connect.family.co/v0/download/infinityWallet",website:"https://infinitywallet.io/download",chrome:"https://infinitywallet.io/download",firefox:"https://infinitywallet.io/download",brave:"https://infinitywallet.io/download",edge:"https://infinitywallet.io/download"}},imToken:{name:"imToken",icon:jsxRuntimeExports.jsx(Logos.ImToken,{}),downloadUrls:{download:"https://connect.family.co/v0/download/imToken",android:"https://play.google.com/store/apps/details?id=im.token.app",ios:"https://itunes.apple.com/us/app/imtoken2/id1384798940"},getWalletConnectDeeplink:o=>`imtokenv2://wc?uri=${encodeURIComponent(o)}`},unstoppable:{name:"Unstoppable",icon:jsxRuntimeExports.jsx(Logos.Unstoppable,{}),downloadUrls:{download:"https://connect.family.co/v0/download/unstoppable",ios:"https://apps.apple.com/app/bank-bitcoin-wallet/id1447619907",android:"https://play.google.com/store/apps/details?id=io.horizontalsystems.bankwallet"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://unstoppable.money/wc?uri=${encodeURIComponent(o)}`},onto:{name:"ONTO",icon:jsxRuntimeExports.jsx(Logos.ONTO,{}),downloadUrls:{download:"https://connect.family.co/v0/download/onto",ios:"https://apps.apple.com/app/onto-an-ontology-dapp/id1436009823",android:"https://play.google.com/store/apps/details?id=com.github.ontio.onto",website:"https://onto.app/en/download/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://onto.app/wc?uri=${encodeURIComponent(o)}`},steak:{name:"Steak",icon:jsxRuntimeExports.jsx(Logos.Steak,{}),downloadUrls:{download:"https://connect.family.co/v0/download/steak",android:"https://play.google.com/store/apps/details?id=fi.steakwallet.app",ios:"https://apps.apple.com/app/steakwallet/id1569375204",website:"https://steakwallet.fi/download"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://links.steakwallet.fi/wc?uri=${encodeURIComponent(o)}`},ledger:{name:"Ledger Live",shortName:"Ledger",icon:jsxRuntimeExports.jsx(Logos.Ledger,{}),downloadUrls:{download:"https://connect.family.co/v0/download/ledger",website:"https://www.ledger.com/ledger-live/download#download-device-2",android:"https://play.google.com/store/apps/details?id=com.ledger.live",ios:"https://apps.apple.com/app/ledger-live-web3-wallet/id1361671700"},getWalletConnectDeeplink:o=>isAndroid()?o:`ledgerlive://wc?uri=${encodeURIComponent(o)}`,shouldDeeplinkDesktop:!0},zerion:{name:"Zerion",icon:jsxRuntimeExports.jsx(Logos.Zerion,{}),downloadUrls:{download:"https://connect.family.co/v0/download/zerion",ios:"https://apps.apple.com/app/apple-store/id1456732565",android:"https://play.google.com/store/apps/details?id=io.zerion.android",website:"https://zerion.io/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://app.zerion.io/wc?uri=${encodeURIComponent(o)}`},slope:{name:"Slope",icon:jsxRuntimeExports.jsx(Logos.Slope,{}),downloadUrls:{download:"https://connect.family.co/v0/download/slope",ios:"https://apps.apple.com/app/slope-wallet/id1574624530",android:"https://play.google.com/store/apps/details?id=com.wd.wallet",chrome:"https://chrome.google.com/webstore/detail/slope-wallet/pocmplpaccanhmnllbbkpgfliimjljgo",website:"https://slope.finance/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://slope.finance/app/wc?uri=${encodeURIComponent(o)}`},tokenPocket:{name:"TokenPocket Wallet",icon:jsxRuntimeExports.jsx(Logos.TokenPocket,{}),downloadUrls:{website:"https://www.tokenpocket.pro/en/download/app",download:"https://www.tokenpocket.pro/en/download/app",android:"https://play.google.com/store/apps/details?id=vip.mytokenpocket",ios:"https://apps.apple.com/us/app/tp-global-wallet/id6444625622",chrome:"https://chrome.google.com/webstore/detail/tokenpocket/mfgccjchihfkkindfppnaooecgfneiii"}},talisman:{name:"Talisman",icon:jsxRuntimeExports.jsx(Logos.Talisman,{}),downloadUrls:{download:"https://talisman.xyz/download",website:"https://talisman.xyz",chrome:"https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",firefox:"https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/"}},walletConnect:{name:"Other Wallets",shortName:"Other",icon:jsxRuntimeExports.jsx(Logos.WalletConnect,{background:!0}),iconConnector:jsxRuntimeExports.jsx(Logos.OtherWallets,{}),iconShape:"square",getWalletConnectDeeplink:o=>o}};Object.keys(walletConfigs).reduce((o,et)=>{var tt,nt,rt,ot,it,st;const at=walletConfigs[et];if(!(at!=null&&at.getWalletConnectDeeplink))return o;const ct=et.split(",")[0].trim(),lt=(nt=(tt=at.name)===null||tt===void 0?void 0:tt.replace("Wallet","").replace(" ",""))!==null&&nt!==void 0?nt:ct[0].toUpperCase()+ct.slice(1),dt=injected({target:{id:ct,name:(ot=(rt=at.name)!==null&&rt!==void 0?rt:at.shortName)!==null&&ot!==void 0?ot:et,provider:pt=>{var mt;return(mt=pt==null?void 0:pt.ethereum)===null||mt===void 0?void 0:mt[`is${lt}`]}}}),ht=((st=(it=at.name)!==null&&it!==void 0?it:at.shortName)!==null&&st!==void 0?st:et).toLowerCase().replace(/(?:^|\s)\S/g,pt=>pt.toUpperCase()).replace(/\s/g,"").replace(/(?:^|\s)\S/g,pt=>pt.toLowerCase());return o[ht]=dt,o},{});const defaultLightTheme={font:{family:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji'"},text:{primary:{color:"#373737"},secondary:{color:"#999999",hover:{color:"#111111"}},error:"#FC6464",valid:"#32D74B"},buttons:{primary:{borderRadius:16,color:"#000373737000",background:"#FFFFFF",border:"#F0F0F0",hover:{color:"#000000",border:"#1A88F8"}},secondary:{borderRadius:16,background:"#F6F7F9",color:"#000000"}},navigation:{color:"#999999"},modal:{background:"#ffffff",divider:"#f7f6f8"},tooltips:{color:"#999999",background:"#ffffff",hover:{background:"#f6f7f9"}},overlay:{background:"rgba(0, 0, 0, 0.06)"},qrCode:{accentColor:"#F7F6F8"}},parseTheme=o=>o,userPrefersDarkMode=()=>typeof window>"u"?!1:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;userPrefersDarkMode();const defaultTheme$1={connectKit:{options:{iconStyle:"light"},theme:{preferred:"dark",light:parseTheme(defaultLightTheme),dark:parseTheme(defaultLightTheme)}}};var styled=typeof qe.div=="function"?qe:qe.default;const hexToP3=o=>{const et=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);if(et==null)return o;const tt={r:parseInt(et[1],16),g:parseInt(et[2],16),b:parseInt(et[3],16)};return`color(display-p3 ${tt.r/255} ${tt.g/255} ${tt.b/255})`};var base$2={light:{"--ck-connectbutton-font-size":"15px","--ck-connectbutton-color":"#373737","--ck-connectbutton-background":"#F6F7F9","--ck-connectbutton-background-secondary":"#FFFFFF","--ck-connectbutton-hover-color":"#373737","--ck-connectbutton-hover-background":"#F0F2F5","--ck-connectbutton-active-color":"#373737","--ck-connectbutton-active-background":"#EAECF1","--ck-connectbutton-balance-color":"#373737","--ck-connectbutton-balance-background":"#fff","--ck-connectbutton-balance-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-background)","--ck-connectbutton-balance-hover-background":"#F6F7F9","--ck-connectbutton-balance-hover-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-hover-background)","--ck-connectbutton-balance-active-background":"#F0F2F5","--ck-connectbutton-balance-active-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-active-background)","--ck-primary-button-border-radius":"16px","--ck-primary-button-color":"#373737","--ck-primary-button-background":"#F6F7F9","--ck-primary-button-font-weight":"600","--ck-primary-button-hover-color":"#373737","--ck-primary-button-hover-background":"#F0F2F5","--ck-secondary-button-border-radius":"16px","--ck-secondary-button-color":"#373737","--ck-secondary-button-background":"#F6F7F9","--ck-tertiary-button-background":"#FFFFFF","--ck-secondary-button-hover-background":"#e0e4eb","--ck-modal-box-shadow":"0px 2px 4px rgba(0, 0, 0, 0.02)","--ck-overlay-background":"rgba(71, 88, 107, 0.24)","--ck-body-color":"#373737","--ck-body-color-muted":"#999999","--ck-body-color-muted-hover":"#111111","--ck-body-background":"#ffffff","--ck-body-background-transparent":"rgba(255,255,255,0)","--ck-body-background-secondary":"#f6f7f9","--ck-body-background-secondary-hover-background":"#e0e4eb","--ck-body-background-secondary-hover-outline":"#4282FF","--ck-body-background-tertiary":"#F3F4F7","--ck-body-action-color":"#999999","--ck-body-divider":"#f7f6f8","--ck-body-divider-secondary":"rgba(0, 0, 0, 0.06)","--ck-body-color-danger":"#FF4E4E","--ck-body-color-valid":"#32D74B","--ck-siwe-border":"#F0F0F0","--ck-body-disclaimer-color":"#AAAAAB","--ck-body-disclaimer-link-color":"#838485","--ck-body-disclaimer-link-hover-color":"#000000","--ck-tooltip-background":"#ffffff","--ck-tooltip-background-secondary":"#ffffff","--ck-tooltip-color":"#999999","--ck-tooltip-shadow":"0px 2px 10px rgba(0, 0, 0, 0.08)","--ck-dropdown-button-color":"#999999","--ck-dropdown-button-box-shadow":"0 0 0 1px rgba(0,0,0,0.01), 0px 0px 7px rgba(0, 0, 0, 0.05)","--ck-dropdown-button-background":"#fff","--ck-dropdown-button-hover-color":"#8B8B8B","--ck-dropdown-button-hover-background":"#F5F7F9","--ck-qr-dot-color":"#000000","--ck-qr-border-color":"#f7f6f8","--ck-focus-color":"#1A88F8","--ck-spinner-color":"var(--ck-focus-color)","--ck-copytoclipboard-stroke":"#CCCCCC"},dark:{"--ck-connectbutton-font-size":"15px","--ck-connectbutton-color":"#ffffff","--ck-connectbutton-background":"#383838","--ck-connectbutton-background-secondary":"#282828","--ck-connectbutton-hover-background":"#404040","--ck-connectbutton-active-background":"#4D4D4D","--ck-connectbutton-balance-color":"#fff","--ck-connectbutton-balance-background":"#282828","--ck-connectbutton-balance-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-background)","--ck-connectbutton-balance-hover-background":"#383838","--ck-connectbutton-balance-hover-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-hover-background)","--ck-connectbutton-balance-active-background":"#404040","--ck-connectbutton-balance-active-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-active-background)","--ck-primary-button-color":"#ffffff","--ck-primary-button-background":"#383838","--ck-primary-button-border-radius":"16px","--ck-primary-button-font-weight":"600","--ck-primary-button-hover-background":"#404040","--ck-primary-button-active-border-radius":"16px","--ck-secondary-button-color":"#ffffff","--ck-secondary-button-background":"#333333","--ck-secondary-button-hover-background":"#4D4D4D","--ck-tertiary-button-background":"#424242","--ck-focus-color":"#1A88F8","--ck-overlay-background":"rgba(0,0,0,0.4)","--ck-body-color":"#ffffff","--ck-body-color-muted":"rgba(255, 255, 255, 0.4)","--ck-body-color-muted-hover":"rgba(255, 255, 255, 0.8)","--ck-body-background":"#2B2B2B","--ck-body-background-transparent":"rgba(0,0,0,0)","--ck-body-background-secondary":"#333333","--ck-body-background-secondary-hover-background":"#4D4D4D","--ck-body-background-secondary-hover-outline":"#ffffff","--ck-body-background-tertiary":"#333333","--ck-body-action-color":"#808080","--ck-body-divider":"#383838","--ck-body-color-danger":"#FF4E4E","--ck-body-disclaimer-color":"#858585","--ck-body-disclaimer-link-color":"#ADADAD","--ck-body-disclaimer-link-hover-color":"#FFFFFF","--ck-modal-box-shadow":"0px 2px 4px rgba(0, 0, 0, 0.02)","--ck-copytoclipboard-stroke":"#555555","--ck-tooltip-background":"#2B2B2B","--ck-tooltip-background-secondary":"#333333","--ck-tooltip-color":"#999999","--ck-tooltip-shadow":"0px 2px 10px rgba(0, 0, 0, 0.08)","--ck-dropdown-button-color":"#6C7381","--ck-spinner-color":"var(--ck-focus-color)","--ck-qr-dot-color":"#ffffff","--ck-qr-border-color":"#3d3d3d"}},web95={"--ck-font-family":"Lato","--ck-border-radius":"0px","--ck-connectbutton-color":"#373737","--ck-connectbutton-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 100% / 200% 200%, #F5F5F1","--ck-connectbutton-box-shadow":" 0 0 0 1px #003C74, 2px 2px 0px rgba(255, 255, 255, 0.75), -2px -2px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 0px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-connectbutton-border-radius":"4.5px","--ck-connectbutton-hover-color":"#373737","--ck-connectbutton-hover-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 0% / 200% 200%, #F5F5F1","--ck-connectbutton-active-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 100% / 200% 200%, #F5F5F1","--ck-connectbutton-balance-color":"#373737","--ck-connectbutton-balance-background":"#fff","--ck-connectbutton-balance-box-shadow":"0 0 0 1px #E4E7E7","--ck-connectbutton-balance-hover-box-shadow":"0 0 0 1px #d7dbdb","--ck-connectbutton-balance-active-box-shadow":"0 0 0 1px #bbc0c0","--ck-focus-color":"#1A88F8","--ck-overlay-background":"rgba(0, 127, 128, 0.8)","--ck-body-color":"#373737","--ck-body-color-muted":"#808080","--ck-body-color-muted-hover":"#111111","--ck-body-background":"#F0EDE2","--ck-body-background-transparent":"rgba(255,255,255,0)","--ck-body-background-secondary-hover-background":"#FAFAFA","--ck-body-background-secondary-hover-outline":"#4282FF","--ck-body-action-color":"#373737","--ck-body-color-danger":"#FC6464","--ck-body-color-valid":"#32D74B","--ck-body-divider":"#919B9C","--ck-body-divider-box-shadow":"0px 1px 0px #FBFBF8","--ck-primary-button-background":"linear-gradient(180deg, #FFFFFF 0%, #F0F0EA 100%), #F5F5F1","--ck-primary-button-box-shadow":"inset 0 0 0 1px #003C74, 1px 1px 0px rgba(255, 255, 255, 0.75), -1px -1px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 0px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-primary-button-border-radius":"6px","--ck-primary-button-hover-box-shadow":"inset 0 0 0 1px #003C74, 1px 1px 0px rgba(255, 255, 255, 0.75), -1px -1px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 5px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-primary-button-hover-border-radius":"6px","--ck-modal-heading-font-weight":400,"--ck-modal-box-shadow":` + C676.4,338,688.6,347.4,688.6,347.4z`}),jsxRuntimeExports.jsxs("linearGradient",{id:"ID_InfinityWallet_9",gradientUnits:"userSpaceOnUse",x1:"530.1512",y1:"-337.7953",x2:"552.8069",y2:"-393.8502",gradientTransform:"matrix(1 0 0 1 197.19 1047.96)",children:[jsxRuntimeExports.jsx("stop",{offset:"3.000000e-02",style:{stopColor:"#1B1464"}}),jsxRuntimeExports.jsx("stop",{offset:"1",style:{stopColor:"#1B1464",stopOpacity:0}})]}),jsxRuntimeExports.jsx("path",{className:"infinityWallet-st8",d:"M725.5,640.1c0,0-35.9,36.2-36,36c0,0-9.6,7.7-19.7,0.7c0,0,59.7,49.2,123.6,18.3l18.6-18.7L725.5,640.1z"})]})]})]}),Rabby=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88",height:"88",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"#8697FF"},children:[jsxRuntimeExports.jsx("path",{d:"M76.2062 48.0657C78.7621 42.356 66.1267 26.404 54.0555 19.7581C46.4467 14.6095 38.5183 15.3169 36.9125 17.5775C33.3886 22.5385 48.5814 26.7423 58.742 31.6478C56.5579 32.5964 54.4996 34.2987 53.2893 36.4758C49.5013 32.3404 41.1872 28.7791 31.4315 31.6478C24.8574 33.5809 19.3937 38.1382 17.2821 45.0216C16.7689 44.7936 16.2009 44.6669 15.6032 44.6669C13.3176 44.6669 11.4648 46.5197 11.4648 48.8052C11.4648 51.0908 13.3176 52.9435 15.6032 52.9435C16.0268 52.9435 17.3514 52.6594 17.3514 52.6594L38.5183 52.8128C30.0532 66.2418 23.3634 68.2049 23.3634 70.5314C23.3634 72.8579 29.7643 72.2274 32.1678 71.3602C43.6732 67.2088 56.0306 54.2706 58.1511 50.5462C67.056 51.6572 74.5397 51.7886 76.2062 48.0657Z",fill:"url(#paint0_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.65 31.6053C58.682 31.6193 58.7139 31.6332 58.7458 31.6471C59.2168 31.4616 59.1406 30.766 59.0113 30.2198C58.714 28.9643 53.5856 23.9001 48.7696 21.6318C42.1984 18.5367 37.3618 18.7007 36.6582 20.1307C37.9975 22.8695 44.1927 25.441 50.663 28.1266C53.3909 29.2589 56.1676 30.4114 58.65 31.6053Z",fill:"url(#paint1_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.4154 59.2247C49.0895 58.7182 47.592 58.2536 45.8898 57.8319C47.707 54.5801 48.0884 49.7663 46.3721 46.7226C43.9635 42.4512 40.9399 40.1777 33.9139 40.1777C30.0495 40.1777 19.6451 41.4794 19.4603 50.1648C19.441 51.0763 19.4599 51.9118 19.5259 52.68L38.5175 52.8176C35.9568 56.8798 33.5586 59.8928 31.4589 62.1841C33.9831 62.8309 36.0657 63.3738 37.9775 63.8722C39.7885 64.3443 41.4462 64.7764 43.1809 65.2191C45.8007 63.3102 48.2635 61.2288 50.4154 59.2247Z",fill:"url(#paint2_linear_60607_36577)"}),jsxRuntimeExports.jsx("path",{d:"M17.0296 51.7821C17.8058 58.38 21.5555 60.9657 29.2177 61.7309C36.8799 62.4961 41.2751 61.9828 47.1265 62.5151C52.0136 62.9598 56.3772 65.4502 57.996 64.5895C59.4529 63.815 58.6378 61.0167 56.6884 59.2214C54.1614 56.8943 50.6641 55.2763 44.5104 54.7021C45.7368 51.3443 45.3931 46.6362 43.4885 44.0748C40.7345 40.3711 35.6513 38.6967 29.2177 39.4282C22.4962 40.1926 16.0556 43.5018 17.0296 51.7821Z",fill:"url(#paint3_linear_60607_36577)"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_60607_36577",x1:"30.666",y1:"43.0094",x2:"75.6558",y2:"55.7677",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_60607_36577",x1:"68.0842",y1:"42.1521",x2:"35.6221",y2:"9.60636",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#7258DC"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#797DEA",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint2_linear_60607_36577",x1:"51.3184",y1:"60.3591",x2:"20.1383",y2:"42.4347",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#7461EA"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#BFC2FF",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint3_linear_60607_36577",x1:"33.3531",y1:"42.6732",x2:"54.4308",y2:"69.4547",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"0.983895",stopColor:"#D5CEFF"})]})]})]}),TokenPocket=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88px",height:"88px",viewBox:"0 0 88 88",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{x1:"107.511425%",y1:"50.0147427%",x2:"0.0459570557%",y2:"50.0147427%",id:"linearGradient-1",children:[jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",offset:"0%"}),jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0.3233",offset:"96.67%"}),jsxRuntimeExports.jsx("stop",{stopColor:"#FFFFFF",stopOpacity:"0.3",offset:"100%"})]})}),jsxRuntimeExports.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:jsxRuntimeExports.jsxs("g",{id:"tokenpocket",fillRule:"nonzero",children:[jsxRuntimeExports.jsx("polygon",{fill:"#2980FE",points:"87.9604864 0 0 0 0 88 87.9604864 88"}),jsxRuntimeExports.jsxs("g",{transform:"translate(16.052385, 23.804688)",children:[jsxRuntimeExports.jsx("path",{d:"M19.6653508,13.8911953 L19.6784508,13.8911953 C19.6653508,13.8236484 19.6653508,13.7448437 19.6653508,13.6772969 L19.6653508,13.8911953 Z",fill:"#29AEFF"}),jsxRuntimeExports.jsx("path",{d:"M41.1271993,16.0301797 L29.2440711,16.0301797 L29.2440711,38.4205938 C29.2440711,39.4787422 30.0635659,40.3343359 31.0771712,40.3343359 L39.2940168,40.3343359 C40.3077044,40.3343359 41.1271993,39.4787422 41.1271993,38.4205938 L41.1271993,16.0301797 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M23.5075248,0 L23.1085201,0 L1.83318241,0 C0.819494855,0 0,0.855507812 0,1.91374219 L0,9.68111719 C0,10.7393516 0.819494855,11.5948594 1.83318241,11.5948594 L6.82580355,11.5948594 L8.80996071,11.5948594 L8.80996071,13.8912813 L8.80996071,38.4768828 C8.80996071,39.5351172 9.62945557,40.390625 10.6430608,40.390625 L18.4502002,40.390625 C19.4638054,40.390625 20.2833003,39.5351172 20.2833003,38.4768828 L20.2833003,13.8912813 L20.2833003,13.6774688 L20.2833003,11.5948594 L22.2674574,11.5948594 L23.0761684,11.5948594 L23.4751731,11.5948594 C26.5376389,11.5948594 29.0285575,8.99447656 29.0285575,5.79742969 C29.0609093,2.60038281 26.5699906,0 23.5075248,0 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M41.1381478,16.0301797 L41.1381478,31.6550781 C41.5479364,31.7563984 41.9684266,31.8352031 42.399783,31.90275 C43.0036819,31.9928125 43.6290664,32.0491016 44.2545332,32.0603594 C44.2868849,32.0603594 44.3192367,32.0603594 44.3623723,32.0603594 L44.3623723,19.6324219 C42.5615416,19.5085859 41.1381478,17.9438359 41.1381478,16.0301797 Z",fill:"url(#linearGradient-1)"}),jsxRuntimeExports.jsx("path",{d:"M44.5993714,0 C36.1237942,0 29.2440711,7.18205469 29.2440711,16.0301797 C29.2440711,23.6400312 34.3229635,30.0115234 41.1379832,31.6550781 L41.1379832,16.0301797 C41.1379832,14.0376328 42.6907839,12.4165937 44.5993714,12.4165937 C46.5080412,12.4165937 48.0608419,14.0376328 48.0608419,16.0301797 C48.0608419,17.7075078 46.9717493,19.1146484 45.483652,19.5198437 C45.2032703,19.5986484 44.9013209,19.6436797 44.5993714,19.6436797 L44.5993714,32.0603594 C44.9013209,32.0603594 45.1924864,32.0491016 45.483652,32.0378438 C53.5495229,31.5537578 59.9547666,24.5743438 59.9547666,16.0301797 C59.9655379,7.18205469 53.0858148,0 44.5993714,0 Z",fill:"#FFFFFF"}),jsxRuntimeExports.jsx("path",{d:"M44.5992891,32.0603594 L44.5992891,19.6436797 C44.5131001,19.6436797 44.4376127,19.6436797 44.3513414,19.6324219 L44.3513414,32.0603594 C44.4376127,32.0603594 44.523884,32.0603594 44.5992891,32.0603594 Z",fill:"#FFFFFF"})]})]})})]}),Talisman=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"82",height:"82",viewBox:"0 0 82 82",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"82",height:"82",rx:"12",fill:"#D5FF5C"}),jsxRuntimeExports.jsx("path",{d:"M35.04 55C35.04 58.2905 37.6887 60.9623 40.9703 60.9996C44.2519 60.9623 46.9006 58.2905 46.9006 55C46.9006 51.7096 44.2519 49.0377 40.9703 49.0004C37.6887 49.0377 35.04 51.7096 35.04 55Z",fill:"#FD4848"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.8544 44.6623C22.2462 45.9868 20.4553 46.4546 19.4248 45.4241L17.5356 43.5349C15.583 41.5823 12.4171 41.5823 10.4645 43.5349C8.51184 45.4875 8.51184 48.6534 10.4645 50.606L25.7391 65.8807C29.3942 70.2176 34.8595 72.9788 40.9703 72.9994C47.0811 72.9788 52.5464 70.2176 56.2014 65.8807L71.4761 50.606C73.4287 48.6534 73.4287 45.4875 71.4761 43.5349C69.5234 41.5823 66.3576 41.5823 64.4049 43.5349L62.5158 45.4241C61.4852 46.4546 59.6943 45.9868 59.0861 44.6623C58.9663 44.4013 58.901 44.1213 58.901 43.8341L58.901 20.9995C58.901 18.2381 56.6624 15.9995 53.901 15.9995C51.1396 15.9995 48.901 18.2381 48.901 20.9995L48.901 32.5568C48.901 33.5506 47.8829 34.2252 46.9353 33.9257C46.3356 33.7361 45.9023 33.1901 45.9023 32.5611L45.9023 13.9996C45.9023 11.2608 43.7004 9.03637 40.9703 9C38.2402 9.03637 36.0382 11.2608 36.0382 13.9996L36.0382 32.5611C36.0382 33.1901 35.605 33.7361 35.0052 33.9257C34.0576 34.2252 33.0395 33.5506 33.0395 32.5568L33.0396 20.9995C33.0396 18.2381 30.801 15.9995 28.0395 15.9995C25.2781 15.9995 23.0395 18.2381 23.0395 20.9995L23.0395 43.8341C23.0395 44.1213 22.9743 44.4013 22.8544 44.6623ZM40.9703 44.9999C32.1659 45.0525 25.0403 54.9997 25.0403 54.9997C25.0403 54.9997 32.1659 64.9469 40.9703 64.9995C49.7746 64.9469 56.9002 54.9997 56.9002 54.9997C56.9002 54.9997 49.7746 45.0525 40.9703 44.9999Z",fill:"#FD4848"})]}),OtherWallets=({...o})=>{const et={position:"relative",display:"flex",flexDirection:"column",gap:2},tt={position:"relative",display:"flex",gap:2},nt={width:"50%",overflow:"hidden",borderRadius:"27.5%"};return jsxRuntimeExports.jsxs("div",{style:et,...o,children:[jsxRuntimeExports.jsxs("div",{style:tt,children:[jsxRuntimeExports.jsx("div",{style:nt,children:jsxRuntimeExports.jsx(WalletConnect,{background:!0})}),jsxRuntimeExports.jsx("div",{style:nt,children:isZerion()?jsxRuntimeExports.jsx(Phantom,{}):jsxRuntimeExports.jsx(Zerion,{})})]}),jsxRuntimeExports.jsxs("div",{style:tt,children:[jsxRuntimeExports.jsx("div",{style:nt,children:isFamily()?jsxRuntimeExports.jsx(ImToken,{}):jsxRuntimeExports.jsx(Family,{})}),jsxRuntimeExports.jsx("div",{style:nt,children:isRainbow()?jsxRuntimeExports.jsx(Trust,{}):jsxRuntimeExports.jsx(Rainbow,{})})]})]})},Fordefi=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"88",height:"88",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{clipPath:"url(#clip0_14298_75627)",children:[jsxRuntimeExports.jsx("path",{d:"M43.5075 62.5508H6V73.5954C6 79.2046 10.5379 83.7515 16.1357 83.7515H32.9997L43.5075 62.5508Z",fill:"#7994FF"}),jsxRuntimeExports.jsx("path",{d:"M6.00098 39.1016H76.2075L68.0567 55.4841H6.00098V39.1016Z",fill:"#486DFF"}),jsxRuntimeExports.jsx("path",{d:"M30.6398 12H6.09766V32.0282H89.8447V12H65.3025V26.9577H60.2423V12H35.7001V26.9577H30.6398V12Z",fill:"#5CD1FA"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_14298_75627",children:jsxRuntimeExports.jsx("rect",{width:"84",height:"72",fill:"white",transform:"translate(6 12)"})})})]});var Logos={Mock,Injected,OtherWallets,WalletConnect,MetaMask,Coinbase,Family,Trust,Argent,ImToken,Rainbow,Crypto,Ledger,Brave:Brave$1,Steak,Unstoppable,ONTO,Slope,Safe,Frontier,Zerion,Phantom,PlaceHolder,Frame,Dawn,InfinityWallet,Rabby,Fordefi,TokenPocket,Talisman};const truncateRegex=/^(0x[a-zA-Z0-9]{4})[a-zA-Z0-9]+([a-zA-Z0-9]{4})$/,truncateEthAddress=(o,et="••••")=>{if(!o)return"";const tt=o.match(truncateRegex);return tt?`${tt[1]}${et}${tt[2]}`:o},truncateENSAddress=(o,et)=>o.length>et?o.replace(".eth","").slice(0,et)+"...":o,nFormatter=(o,et=2)=>{if(o<1e4)return o.toFixed(2);const tt=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"m"},{value:1e9,symbol:"g"},{value:1e12,symbol:"t"},{value:1e15,symbol:"p"},{value:1e18,symbol:"e"}],nt=/\.0+$|(\.[0-9]*[1-9])0+$/;var rt=tt.slice().reverse().find(function(ot){return o>=ot.value});return rt?(o/rt.value).toFixed(et).replace(nt,"$1")+rt.symbol:"0"},detectBrowser=()=>{var o;const et=detect();return(o=et==null?void 0:et.name)!==null&&o!==void 0?o:""},detectOS=()=>{var o;const et=detect();return(o=et==null?void 0:et.os)!==null&&o!==void 0?o:""},isIOS=()=>detectOS().toLowerCase().includes("ios"),isAndroid=()=>detectOS().toLowerCase().includes("android"),isMobile=()=>isAndroid()||isIOS();function flattenChildren(o){return React.Children.toArray(o).reduce((tt,nt)=>nt.type===React.Fragment?tt.concat(flattenChildren(nt.props.children)):(tt.push(nt),tt),[])}const isWalletConnectConnector=o=>o==="walletConnect",isCoinbaseWalletConnector=o=>o==="coinbaseWalletSDK",isSafeConnector=o=>o==="safe",isInjectedConnector=o=>o==="injected",walletConfigs={mock:{icon:jsxRuntimeExports.jsx(Logos.Mock,{})},argent:{name:"Argent",icon:jsxRuntimeExports.jsx(Logos.Argent,{}),downloadUrls:{download:"https://connect.family.co/v0/download/argent",android:"https://play.google.com/store/apps/details?id=im.argent.contractwalletclient",ios:"https://apps.apple.com/app/argent/id1358741926"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://argent.link/app/wc?uri=${encodeURIComponent(o)}`},"coinbaseWallet, coinbaseWalletSDK":{name:"Coinbase Wallet",shortName:"Coinbase",icon:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/coinbasewallet",website:"https://www.coinbase.com/wallet/getting-started-extension",android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad"},getWalletConnectDeeplink:o=>`https://go.cb-w.com/wc?uri=${encodeURIComponent(o)}`},"com.coinbase.wallet":{name:"Coinbase Wallet",shortName:"Coinbase",icon:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),iconShape:"circle",downloadUrls:{download:"https://connect.family.co/v0/download/coinbasewallet",website:"https://www.coinbase.com/wallet/getting-started-extension",android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad"},getWalletConnectDeeplink:o=>`https://go.cb-w.com/wc?uri=${encodeURIComponent(o)}`},"com.crypto.wallet":{name:"Crypto.com",shortName:"Crypto"},dawn:{name:"Dawn Wallet",shortName:"Dawn",downloadUrls:{download:"https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782",website:"https://www.dawnwallet.xyz/",ios:"https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782"}},"co.family.wallet":{name:"Family",shortName:"Family",icon:jsxRuntimeExports.jsx(Logos.Family,{}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/family",website:"https://family.co",ios:"https://family.co/download"},getWalletConnectDeeplink:o=>isAndroid()?o:`familywallet://wc?uri=${encodeURIComponent(o)}`},frame:{name:"Frame",icon:jsxRuntimeExports.jsx(Logos.Frame,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/frame",website:"https://frame.sh",chrome:"https://chrome.google.com/webstore/detail/frame-companion/ldcoohedfbjoobcadoglnnmmfbdlmmhf",firefox:"https://addons.mozilla.org/en-US/firefox/addon/frame-extension",brave:"https://chrome.google.com/webstore/detail/frame-companion/ldcoohedfbjoobcadoglnnmmfbdlmmhf"},getWalletConnectDeeplink:o=>o},frontier:{name:"Frontier Wallet",shortName:"Frontier",icon:jsxRuntimeExports.jsx(Logos.Frontier,{}),downloadUrls:{download:"https://connect.family.co/v0/download/frontier",ios:"https://apps.apple.com/app/frontier-crypto-defi-wallet/id1482380988",android:"https://play.google.com/store/apps/details?id=com.frontierwallet",website:"https://frontier.xyz/",chrome:"https://chrome.google.com/webstore/detail/frontier-wallet/kppfdiipphfccemcignhifpjkapfbihd"},getWalletConnectDeeplink:o=>isAndroid()?o:`frontier://wc?uri=${encodeURIComponent(o)}`},injected:{name:"Browser Wallet",shortName:"Browser",icon:jsxRuntimeExports.jsx(Logos.Injected,{})},"metaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK":{name:"MetaMask",icon:jsxRuntimeExports.jsx(Logos.MetaMask,{}),iconConnector:jsxRuntimeExports.jsx(Logos.MetaMask,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/metamask",website:"https://metamask.io/download/",android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/app/metamask/id1438144202",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask/",brave:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://metamask.app.link/wc?uri=${encodeURIComponent(o)}`},"app.phantom":{name:"Phantom",iconShape:"squircle"},"me.rainbow":{name:"Rainbow Wallet",shortName:"Rainbow",icon:jsxRuntimeExports.jsx(Logos.Rainbow,{}),iconShape:"squircle",downloadUrls:{download:"https://connect.family.co/v0/download/rainbow",website:"https://rainbow.me/?utm_source=connectkit",android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Dconnectkit&utm_source=connectkit",ios:"https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021?pt=119997837&ct=connectkit&mt=8",chrome:"https://rainbow.me/extension?utm_source=connectkit",edge:"https://rainbow.me/extension?utm_source=connectkit",brave:"https://rainbow.me/extension?utm_source=connectkit"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://rnbwapp.com/wc?uri=${encodeURIComponent(o)}&connector=connectkit`},"io.rabby":{name:"Rabby Wallet",shortName:"Rabby",downloadUrls:{website:"https://rabby.io",chrome:"https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch"}},safe:{name:"Safe",icon:jsxRuntimeExports.jsx(Logos.Safe,{}),downloadUrls:{download:"https://connect.family.co/v0/download/safe",website:"https://safe.global/",ios:"https://apps.apple.com/app/id1515759131",android:"https://play.google.com/store/apps/details?id=io.gnosis.safe"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://gnosis-safe.io/wc?uri=${encodeURIComponent(o)}`},"xyz.talisman":{name:"Talisman",shortName:"Talisman",iconShape:"squircle",downloadUrls:{download:"https://talisman.xyz/download",website:"https://talisman.xyz",chrome:"https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",firefox:"https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/"}},"com.trustwallet.app":{name:"Trust Wallet",shortName:"Trust",icon:jsxRuntimeExports.jsx(Logos.Trust,{}),iconShouldShrink:!0,downloadUrls:{download:"https://connect.family.co/v0/download/trust",android:"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",ios:"https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409"},getWalletConnectDeeplink(o){return isAndroid()?o:`https://link.trustwallet.com/wc?uri=${encodeURIComponent(o)}`}},infinityWallet:{name:"Infinity Wallet",icon:jsxRuntimeExports.jsx(Logos.InfinityWallet,{}),downloadUrls:{download:"https://connect.family.co/v0/download/infinityWallet",website:"https://infinitywallet.io/download",chrome:"https://infinitywallet.io/download",firefox:"https://infinitywallet.io/download",brave:"https://infinitywallet.io/download",edge:"https://infinitywallet.io/download"}},imToken:{name:"imToken",icon:jsxRuntimeExports.jsx(Logos.ImToken,{}),downloadUrls:{download:"https://connect.family.co/v0/download/imToken",android:"https://play.google.com/store/apps/details?id=im.token.app",ios:"https://itunes.apple.com/us/app/imtoken2/id1384798940"},getWalletConnectDeeplink:o=>`imtokenv2://wc?uri=${encodeURIComponent(o)}`},unstoppable:{name:"Unstoppable",icon:jsxRuntimeExports.jsx(Logos.Unstoppable,{}),downloadUrls:{download:"https://connect.family.co/v0/download/unstoppable",ios:"https://apps.apple.com/app/bank-bitcoin-wallet/id1447619907",android:"https://play.google.com/store/apps/details?id=io.horizontalsystems.bankwallet"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://unstoppable.money/wc?uri=${encodeURIComponent(o)}`},onto:{name:"ONTO",icon:jsxRuntimeExports.jsx(Logos.ONTO,{}),downloadUrls:{download:"https://connect.family.co/v0/download/onto",ios:"https://apps.apple.com/app/onto-an-ontology-dapp/id1436009823",android:"https://play.google.com/store/apps/details?id=com.github.ontio.onto",website:"https://onto.app/en/download/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://onto.app/wc?uri=${encodeURIComponent(o)}`},steak:{name:"Steak",icon:jsxRuntimeExports.jsx(Logos.Steak,{}),downloadUrls:{download:"https://connect.family.co/v0/download/steak",android:"https://play.google.com/store/apps/details?id=fi.steakwallet.app",ios:"https://apps.apple.com/app/steakwallet/id1569375204",website:"https://steakwallet.fi/download"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://links.steakwallet.fi/wc?uri=${encodeURIComponent(o)}`},ledger:{name:"Ledger Live",shortName:"Ledger",icon:jsxRuntimeExports.jsx(Logos.Ledger,{}),downloadUrls:{download:"https://connect.family.co/v0/download/ledger",website:"https://www.ledger.com/ledger-live/download#download-device-2",android:"https://play.google.com/store/apps/details?id=com.ledger.live",ios:"https://apps.apple.com/app/ledger-live-web3-wallet/id1361671700"},getWalletConnectDeeplink:o=>isAndroid()?o:`ledgerlive://wc?uri=${encodeURIComponent(o)}`,shouldDeeplinkDesktop:!0},zerion:{name:"Zerion",icon:jsxRuntimeExports.jsx(Logos.Zerion,{}),downloadUrls:{download:"https://connect.family.co/v0/download/zerion",ios:"https://apps.apple.com/app/apple-store/id1456732565",android:"https://play.google.com/store/apps/details?id=io.zerion.android",website:"https://zerion.io/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://app.zerion.io/wc?uri=${encodeURIComponent(o)}`},slope:{name:"Slope",icon:jsxRuntimeExports.jsx(Logos.Slope,{}),downloadUrls:{download:"https://connect.family.co/v0/download/slope",ios:"https://apps.apple.com/app/slope-wallet/id1574624530",android:"https://play.google.com/store/apps/details?id=com.wd.wallet",chrome:"https://chrome.google.com/webstore/detail/slope-wallet/pocmplpaccanhmnllbbkpgfliimjljgo",website:"https://slope.finance/"},getWalletConnectDeeplink:o=>isAndroid()?o:`https://slope.finance/app/wc?uri=${encodeURIComponent(o)}`},tokenPocket:{name:"TokenPocket Wallet",icon:jsxRuntimeExports.jsx(Logos.TokenPocket,{}),downloadUrls:{website:"https://www.tokenpocket.pro/en/download/app",download:"https://www.tokenpocket.pro/en/download/app",android:"https://play.google.com/store/apps/details?id=vip.mytokenpocket",ios:"https://apps.apple.com/us/app/tp-global-wallet/id6444625622",chrome:"https://chrome.google.com/webstore/detail/tokenpocket/mfgccjchihfkkindfppnaooecgfneiii"}},talisman:{name:"Talisman",icon:jsxRuntimeExports.jsx(Logos.Talisman,{}),downloadUrls:{download:"https://talisman.xyz/download",website:"https://talisman.xyz",chrome:"https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",firefox:"https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/"}},walletConnect:{name:"Other Wallets",shortName:"Other",icon:jsxRuntimeExports.jsx(Logos.WalletConnect,{background:!0}),iconConnector:jsxRuntimeExports.jsx(Logos.OtherWallets,{}),iconShape:"square",getWalletConnectDeeplink:o=>o}};Object.keys(walletConfigs).reduce((o,et)=>{var tt,nt,rt,ot,it,st;const at=walletConfigs[et];if(!(at!=null&&at.getWalletConnectDeeplink))return o;const ct=et.split(",")[0].trim(),lt=(nt=(tt=at.name)===null||tt===void 0?void 0:tt.replace("Wallet","").replace(" ",""))!==null&&nt!==void 0?nt:ct[0].toUpperCase()+ct.slice(1),dt=injected({target:{id:ct,name:(ot=(rt=at.name)!==null&&rt!==void 0?rt:at.shortName)!==null&&ot!==void 0?ot:et,provider:ft=>{var mt;return(mt=ft==null?void 0:ft.ethereum)===null||mt===void 0?void 0:mt[`is${lt}`]}}}),ht=((st=(it=at.name)!==null&&it!==void 0?it:at.shortName)!==null&&st!==void 0?st:et).toLowerCase().replace(/(?:^|\s)\S/g,ft=>ft.toUpperCase()).replace(/\s/g,"").replace(/(?:^|\s)\S/g,ft=>ft.toLowerCase());return o[ht]=dt,o},{});const defaultLightTheme={font:{family:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji'"},text:{primary:{color:"#373737"},secondary:{color:"#999999",hover:{color:"#111111"}},error:"#FC6464",valid:"#32D74B"},buttons:{primary:{borderRadius:16,color:"#000373737000",background:"#FFFFFF",border:"#F0F0F0",hover:{color:"#000000",border:"#1A88F8"}},secondary:{borderRadius:16,background:"#F6F7F9",color:"#000000"}},navigation:{color:"#999999"},modal:{background:"#ffffff",divider:"#f7f6f8"},tooltips:{color:"#999999",background:"#ffffff",hover:{background:"#f6f7f9"}},overlay:{background:"rgba(0, 0, 0, 0.06)"},qrCode:{accentColor:"#F7F6F8"}},parseTheme=o=>o,userPrefersDarkMode=()=>typeof window>"u"?!1:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;userPrefersDarkMode();const defaultTheme$1={connectKit:{options:{iconStyle:"light"},theme:{preferred:"dark",light:parseTheme(defaultLightTheme),dark:parseTheme(defaultLightTheme)}}};var styled=typeof qe.div=="function"?qe:qe.default;const hexToP3=o=>{const et=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);if(et==null)return o;const tt={r:parseInt(et[1],16),g:parseInt(et[2],16),b:parseInt(et[3],16)};return`color(display-p3 ${tt.r/255} ${tt.g/255} ${tt.b/255})`};var base$2={light:{"--ck-connectbutton-font-size":"15px","--ck-connectbutton-color":"#373737","--ck-connectbutton-background":"#F6F7F9","--ck-connectbutton-background-secondary":"#FFFFFF","--ck-connectbutton-hover-color":"#373737","--ck-connectbutton-hover-background":"#F0F2F5","--ck-connectbutton-active-color":"#373737","--ck-connectbutton-active-background":"#EAECF1","--ck-connectbutton-balance-color":"#373737","--ck-connectbutton-balance-background":"#fff","--ck-connectbutton-balance-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-background)","--ck-connectbutton-balance-hover-background":"#F6F7F9","--ck-connectbutton-balance-hover-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-hover-background)","--ck-connectbutton-balance-active-background":"#F0F2F5","--ck-connectbutton-balance-active-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-active-background)","--ck-primary-button-border-radius":"16px","--ck-primary-button-color":"#373737","--ck-primary-button-background":"#F6F7F9","--ck-primary-button-font-weight":"600","--ck-primary-button-hover-color":"#373737","--ck-primary-button-hover-background":"#F0F2F5","--ck-secondary-button-border-radius":"16px","--ck-secondary-button-color":"#373737","--ck-secondary-button-background":"#F6F7F9","--ck-tertiary-button-background":"#FFFFFF","--ck-secondary-button-hover-background":"#e0e4eb","--ck-modal-box-shadow":"0px 2px 4px rgba(0, 0, 0, 0.02)","--ck-overlay-background":"rgba(71, 88, 107, 0.24)","--ck-body-color":"#373737","--ck-body-color-muted":"#999999","--ck-body-color-muted-hover":"#111111","--ck-body-background":"#ffffff","--ck-body-background-transparent":"rgba(255,255,255,0)","--ck-body-background-secondary":"#f6f7f9","--ck-body-background-secondary-hover-background":"#e0e4eb","--ck-body-background-secondary-hover-outline":"#4282FF","--ck-body-background-tertiary":"#F3F4F7","--ck-body-action-color":"#999999","--ck-body-divider":"#f7f6f8","--ck-body-divider-secondary":"rgba(0, 0, 0, 0.06)","--ck-body-color-danger":"#FF4E4E","--ck-body-color-valid":"#32D74B","--ck-siwe-border":"#F0F0F0","--ck-body-disclaimer-color":"#AAAAAB","--ck-body-disclaimer-link-color":"#838485","--ck-body-disclaimer-link-hover-color":"#000000","--ck-tooltip-background":"#ffffff","--ck-tooltip-background-secondary":"#ffffff","--ck-tooltip-color":"#999999","--ck-tooltip-shadow":"0px 2px 10px rgba(0, 0, 0, 0.08)","--ck-dropdown-button-color":"#999999","--ck-dropdown-button-box-shadow":"0 0 0 1px rgba(0,0,0,0.01), 0px 0px 7px rgba(0, 0, 0, 0.05)","--ck-dropdown-button-background":"#fff","--ck-dropdown-button-hover-color":"#8B8B8B","--ck-dropdown-button-hover-background":"#F5F7F9","--ck-qr-dot-color":"#000000","--ck-qr-border-color":"#f7f6f8","--ck-focus-color":"#1A88F8","--ck-spinner-color":"var(--ck-focus-color)","--ck-copytoclipboard-stroke":"#CCCCCC"},dark:{"--ck-connectbutton-font-size":"15px","--ck-connectbutton-color":"#ffffff","--ck-connectbutton-background":"#383838","--ck-connectbutton-background-secondary":"#282828","--ck-connectbutton-hover-background":"#404040","--ck-connectbutton-active-background":"#4D4D4D","--ck-connectbutton-balance-color":"#fff","--ck-connectbutton-balance-background":"#282828","--ck-connectbutton-balance-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-background)","--ck-connectbutton-balance-hover-background":"#383838","--ck-connectbutton-balance-hover-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-hover-background)","--ck-connectbutton-balance-active-background":"#404040","--ck-connectbutton-balance-active-box-shadow":"inset 0 0 0 1px var(--ck-connectbutton-active-background)","--ck-primary-button-color":"#ffffff","--ck-primary-button-background":"#383838","--ck-primary-button-border-radius":"16px","--ck-primary-button-font-weight":"600","--ck-primary-button-hover-background":"#404040","--ck-primary-button-active-border-radius":"16px","--ck-secondary-button-color":"#ffffff","--ck-secondary-button-background":"#333333","--ck-secondary-button-hover-background":"#4D4D4D","--ck-tertiary-button-background":"#424242","--ck-focus-color":"#1A88F8","--ck-overlay-background":"rgba(0,0,0,0.4)","--ck-body-color":"#ffffff","--ck-body-color-muted":"rgba(255, 255, 255, 0.4)","--ck-body-color-muted-hover":"rgba(255, 255, 255, 0.8)","--ck-body-background":"#2B2B2B","--ck-body-background-transparent":"rgba(0,0,0,0)","--ck-body-background-secondary":"#333333","--ck-body-background-secondary-hover-background":"#4D4D4D","--ck-body-background-secondary-hover-outline":"#ffffff","--ck-body-background-tertiary":"#333333","--ck-body-action-color":"#808080","--ck-body-divider":"#383838","--ck-body-color-danger":"#FF4E4E","--ck-body-disclaimer-color":"#858585","--ck-body-disclaimer-link-color":"#ADADAD","--ck-body-disclaimer-link-hover-color":"#FFFFFF","--ck-modal-box-shadow":"0px 2px 4px rgba(0, 0, 0, 0.02)","--ck-copytoclipboard-stroke":"#555555","--ck-tooltip-background":"#2B2B2B","--ck-tooltip-background-secondary":"#333333","--ck-tooltip-color":"#999999","--ck-tooltip-shadow":"0px 2px 10px rgba(0, 0, 0, 0.08)","--ck-dropdown-button-color":"#6C7381","--ck-spinner-color":"var(--ck-focus-color)","--ck-qr-dot-color":"#ffffff","--ck-qr-border-color":"#3d3d3d"}},web95={"--ck-font-family":"Lato","--ck-border-radius":"0px","--ck-connectbutton-color":"#373737","--ck-connectbutton-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 100% / 200% 200%, #F5F5F1","--ck-connectbutton-box-shadow":" 0 0 0 1px #003C74, 2px 2px 0px rgba(255, 255, 255, 0.75), -2px -2px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 0px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-connectbutton-border-radius":"4.5px","--ck-connectbutton-hover-color":"#373737","--ck-connectbutton-hover-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 0% / 200% 200%, #F5F5F1","--ck-connectbutton-active-background":"linear-gradient(180deg, #F0F0EA 0%, #FFFFFF 50%, #F0F0EA 100%) 100% 100% / 200% 200%, #F5F5F1","--ck-connectbutton-balance-color":"#373737","--ck-connectbutton-balance-background":"#fff","--ck-connectbutton-balance-box-shadow":"0 0 0 1px #E4E7E7","--ck-connectbutton-balance-hover-box-shadow":"0 0 0 1px #d7dbdb","--ck-connectbutton-balance-active-box-shadow":"0 0 0 1px #bbc0c0","--ck-focus-color":"#1A88F8","--ck-overlay-background":"rgba(0, 127, 128, 0.8)","--ck-body-color":"#373737","--ck-body-color-muted":"#808080","--ck-body-color-muted-hover":"#111111","--ck-body-background":"#F0EDE2","--ck-body-background-transparent":"rgba(255,255,255,0)","--ck-body-background-secondary-hover-background":"#FAFAFA","--ck-body-background-secondary-hover-outline":"#4282FF","--ck-body-action-color":"#373737","--ck-body-color-danger":"#FC6464","--ck-body-color-valid":"#32D74B","--ck-body-divider":"#919B9C","--ck-body-divider-box-shadow":"0px 1px 0px #FBFBF8","--ck-primary-button-background":"linear-gradient(180deg, #FFFFFF 0%, #F0F0EA 100%), #F5F5F1","--ck-primary-button-box-shadow":"inset 0 0 0 1px #003C74, 1px 1px 0px rgba(255, 255, 255, 0.75), -1px -1px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 0px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-primary-button-border-radius":"6px","--ck-primary-button-hover-box-shadow":"inset 0 0 0 1px #003C74, 1px 1px 0px rgba(255, 255, 255, 0.75), -1px -1px 0px rgba(0, 0, 0, 0.05), inset 0px 0px 0px 5px #97B9EC, inset -1px -2px 2px rgba(0, 0, 0, 0.2)","--ck-primary-button-hover-border-radius":"6px","--ck-modal-heading-font-weight":400,"--ck-modal-box-shadow":` inset 0px -3px 0px #0F37A9, inset -2px 0px 0px #0F37A9, inset 0px -4px 0px #0D5DDF, @@ -854,7 +854,7 @@ from { opacity: 1; transform: scale(1); } input[type="radio"]:not(:disabled), input[type="checkbox"]:not(:disabled), select:not(:disabled) - `),rt=nt[0],ot=nt[nt.length-1],it=tt.key==="Tab"||tt.keyCode===KEYCODE_TAB;it&&(tt.shiftKey?document.activeElement===rt&&(ot.focus(),tt.preventDefault()):document.activeElement===ot&&(rt.focus(),tt.preventDefault()))}}return reactExports.useEffect(()=>(o.current&&(o.current.addEventListener("keydown",et),o.current.focus({preventScroll:!0})),()=>{o.current&&o.current.removeEventListener("keydown",et)}),[]),o}function FocusTrap(o){const et=useFocusTrap();return reactExports.useEffect(()=>{et.current&&et.current.focus({preventScroll:!0})},[]),jsxRuntimeExports.jsx("div",{ref:et,tabIndex:0,children:o.children})}function usePrevious(o,et){const tt=reactExports.useRef({target:o,previous:et});return tt.current.target!==o&&(tt.current.previous=tt.current.target,tt.current.target=o),tt.current.previous}const Context$1=reactExports.createContext(null),ConnectKitThemeProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt})=>{const rt={theme:et,mode:tt,customTheme:nt};return reactExports.createElement(Context$1.Provider,{value:rt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o}))},useThemeContext=()=>{const o=React.useContext(Context$1);if(!o)throw Error("ConnectKitThemeProvider must be inside a Provider.");return o},ExternalLinkIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{left:0,top:0},...o,children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4C2.89543 4 2 4.89543 2 6V12C2 13.1046 2.89543 14 4 14H10C11.1046 14 12 13.1046 12 12V9.66667C12 9.11438 12.4477 8.66667 13 8.66667C13.5523 8.66667 14 9.11438 14 9.66667V12C14 14.2091 12.2091 16 10 16H4C1.79086 16 0 14.2091 0 12V6C0 3.79086 1.79086 2 4 2H6.33333C6.88562 2 7.33333 2.44772 7.33333 3C7.33333 3.55228 6.88562 4 6.33333 4H4Z",fill:"currentColor",fillOpacity:.3}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.5 1C9.5 0.447715 9.94772 0 10.5 0H15C15.5523 0 16 0.447715 16 1V5.5C16 6.05228 15.5523 6.5 15 6.5C14.4477 6.5 14 6.05228 14 5.5V3.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L12.5858 2H10.5C9.94772 2 9.5 1.55228 9.5 1Z",fill:"currentColor",fillOpacity:.3})]}),AlertIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.81753 1.60122C7.39283 0.530035 8.46953 0 9.50409 0C10.5507 0 11.6022 0.539558 12.1805 1.59767L18.6047 13.3334C18.882 13.8283 19 14.3568 19 14.8622C19 16.5296 17.7949 18 15.9149 18H3.08514C1.20508 18 0 16.5296 0 14.8622C0 14.3454 0.131445 13.8172 0.405555 13.3379L6.81753 1.60122ZM9.50409 2C9.13355 2 8.77256 2.18675 8.57866 2.54907L8.57458 2.5567L2.14992 14.3166L2.144 14.3268C2.04638 14.4959 2 14.6817 2 14.8622C2 15.5497 2.43032 16 3.08514 16H15.9149C16.5697 16 17 15.5497 17 14.8622C17 14.6681 16.9554 14.4805 16.8588 14.309L16.8529 14.2986L10.4259 2.55741C10.2191 2.1792 9.86395 2 9.50409 2Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M9.5 11.2297C9.01639 11.2297 8.7459 10.9419 8.72951 10.4186L8.60656 6.4157C8.59016 5.88372 8.95902 5.5 9.4918 5.5C10.0164 5.5 10.4016 5.89244 10.3852 6.42442L10.2623 10.4099C10.2377 10.9419 9.96721 11.2297 9.5 11.2297ZM9.5 14.5C8.95082 14.5 8.5 14.0901 8.5 13.5058C8.5 12.9215 8.95082 12.5116 9.5 12.5116C10.0492 12.5116 10.5 12.9128 10.5 13.5058C10.5 14.0988 10.041 14.5 9.5 14.5Z",fill:"currentColor"})]}),DisconnectIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{left:0,top:0},...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 0C1.79086 0 0 1.79086 0 4V10C0 12.2091 1.79086 14 4 14H6C6.55228 14 7 13.5523 7 13C7 12.4477 6.55228 12 6 12H4C2.89543 12 2 11.1046 2 10V4C2 2.89543 2.89543 2 4 2H6C6.55228 2 7 1.55228 7 1C7 0.447715 6.55228 0 6 0H4ZM11.7071 3.29289C11.3166 2.90237 10.6834 2.90237 10.2929 3.29289C9.90237 3.68342 9.90237 4.31658 10.2929 4.70711L11.5858 6H9.5H6C5.44772 6 5 6.44772 5 7C5 7.55228 5.44772 8 6 8H9.5H11.5858L10.2929 9.29289C9.90237 9.68342 9.90237 10.3166 10.2929 10.7071C10.6834 11.0976 11.3166 11.0976 11.7071 10.7071L14.7071 7.70711C15.0976 7.31658 15.0976 6.68342 14.7071 6.29289L11.7071 3.29289Z",fill:"currentColor",fillOpacity:"0.4"})}),TickIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C13.9706 18 18 13.9706 18 9C18 4.02944 13.9706 0 9 0C4.02944 0 0 4.02944 0 9C0 13.9706 4.02944 18 9 18ZM13.274 7.13324C13.6237 6.70579 13.5607 6.07577 13.1332 5.72604C12.7058 5.37632 12.0758 5.43932 11.726 5.86676L7.92576 10.5115L6.20711 8.79289C5.81658 8.40237 5.18342 8.40237 4.79289 8.79289C4.40237 9.18342 4.40237 9.81658 4.79289 10.2071L7.29289 12.7071C7.49267 12.9069 7.76764 13.0128 8.04981 12.9988C8.33199 12.9847 8.59505 12.8519 8.77396 12.6332L13.274 7.13324Z",fill:"currentColor"})}),RetryIconCircle=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16ZM24.5001 8.74263C25.0834 8.74263 25.5563 9.21551 25.5563 9.79883V14.5997C25.5563 15.183 25.0834 15.6559 24.5001 15.6559H19.6992C19.1159 15.6559 18.643 15.183 18.643 14.5997C18.643 14.0164 19.1159 13.5435 19.6992 13.5435H21.8378L20.071 11.8798C20.0632 11.8724 20.0555 11.865 20.048 11.8574C19.1061 10.915 17.8835 10.3042 16.5643 10.1171C15.2452 9.92999 13.9009 10.1767 12.7341 10.82C11.5674 11.4634 10.6413 12.4685 10.0955 13.684C9.54968 14.8994 9.41368 16.2593 9.70801 17.5588C10.0023 18.8583 10.711 20.0269 11.7273 20.8885C12.7436 21.7502 14.0124 22.2582 15.3425 22.336C16.6726 22.4138 17.9919 22.0572 19.1017 21.3199C19.5088 21.0495 19.8795 20.7333 20.2078 20.3793C20.6043 19.9515 21.2726 19.9262 21.7004 20.3228C22.1282 20.7194 22.1534 21.3876 21.7569 21.8154C21.3158 22.2912 20.8176 22.7161 20.2706 23.0795C18.7793 24.0702 17.0064 24.5493 15.2191 24.4448C13.4318 24.3402 11.7268 23.6576 10.3612 22.4998C8.9956 21.3419 8.0433 19.7716 7.6478 18.0254C7.2523 16.2793 7.43504 14.4519 8.16848 12.8186C8.90192 11.1854 10.1463 9.83471 11.7142 8.97021C13.282 8.10572 15.0884 7.77421 16.861 8.02565C18.6282 8.27631 20.2664 9.09278 21.5304 10.3525L23.4439 12.1544V9.79883C23.4439 9.21551 23.9168 8.74263 24.5001 8.74263Z",fill:"currentColor"})}),RetryIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"16",height:"14",viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{d:"M14.5 2V6H10.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14 5.66537L10.9899 2.75871C10.0931 1.83853 8.92897 1.24216 7.6729 1.05947C6.41683 0.876774 5.13688 1.11765 4.02592 1.7458C2.91497 2.37395 2.0332 3.35534 1.5135 4.54208C0.993792 5.72883 0.864305 7.05663 1.14455 8.3254C1.42479 9.59418 2.09958 10.7352 3.06724 11.5765C4.03489 12.4178 5.24298 12.9138 6.50946 12.9898C7.77594 13.0657 9.03219 12.7176 10.0889 11.9977C10.4765 11.7337 10.8295 11.4249 11.142 11.0792",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),CopyToClipboardIcon$1=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{d:"M14 9.5V7C14 5.89543 13.1046 5 12 5H7C5.89543 5 5 5.89543 5 7V12C5 13.1046 5.89543 14 7 14H9.5",stroke:"var(--ck-body-color-muted)",strokeWidth:"2"}),jsxRuntimeExports.jsx("rect",{x:"10",y:"10",width:"9",height:"9",rx:"2",stroke:"var(--ck-body-color-muted)",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M1 3L3 5L7 1",stroke:"var(--ck-body-color)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]}),AuthIcon=({...o})=>jsxRuntimeExports.jsx("div",{...o,style:{zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",bottom:0,right:0,background:"#34C759",borderRadius:10,boxShadow:"0 0 0 1.5px var(--background)",width:10,height:10,...o==null?void 0:o.style},children:jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"6",height:"6",viewBox:"0 0 6 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M0.75 3L2.25 4.5L5.25 1.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})});var StatusState;(function(o){o.READY="ready",o.LOADING="loading",o.SUCCESS="success",o.REJECTED="rejected",o.ERROR="error"})(StatusState||(StatusState={}));const SIWEContext=reactExports.createContext(null),useSIWE=({onSignIn:o,onSignOut:et}={})=>{const tt=reactExports.useContext(SIWEContext);if(!tt)return{isSignedIn:!1,data:void 0,status:StatusState.ERROR,error:new Error("useSIWE hook must be inside a SIWEProvider."),isRejected:!1,isError:!0,isLoading:!1,isSuccess:!1,isReady:!1,reset:()=>{},signIn:()=>Promise.reject(),signOut:()=>Promise.reject()};const{session:nt,nonce:rt,status:ot,signOut:it,signIn:st,resetStatus:at}=tt,{address:ct,chainId:lt}=nt.data||{},dt=ct?StatusState.SUCCESS:nt.isLoading||rt.isLoading?StatusState.LOADING:ot,ht=dt===StatusState.LOADING,pt=dt===StatusState.SUCCESS,mt=dt===StatusState.REJECTED,ft=dt===StatusState.ERROR,yt=!ct||rt.isFetching||ht||pt,gt=()=>at(),xt=!!ct;return{isSignedIn:xt,data:xt?{address:ct,chainId:lt}:void 0,status:dt,error:nt.error||rt.error,isRejected:mt,isError:ft,isLoading:ht,isSuccess:pt,isReady:yt,signIn:async()=>{if(!xt){const vt=await st();vt&&(o==null||o(vt))}},signOut:async()=>{xt&&(await it(),et==null||et())},reset:gt}},arAE={connectWallet:"الاتصال بالمحفظة",disconnect:"قطع الاتصال",connected:"متصل",wrongNetwork:"شبكة خاطئة",switchNetworks:"تغيير الشبكات",chainNetwork:"شبكة {{ CHAIN }}",copyToClipboard:"نسخ إلى الحافظة",copyCode:"نسخ الكود",moreInformation:"مزيد من المعلومات",back:"عودة",close:"إغلاق",or:"أو",more:"المزيد",tryAgain:"حاول مجددًا",tryAgainQuestion:"هل نحاول مرة أخرى؟",dontHaveTheApp:"ليس لديك التطبيق؟",scanTheQRCode:"مسح رمز الاستجابة السريعة",useWalletConnectModal:"استخدم نموذج ولِيت‌كنيكت",useModal:"استخدم النموذج",installTheExtension:"تثبيت الإضافة",getWalletName:"الحصول على {{ CONNECTORNAME }}",otherWallets:"محافظ أخرى",learnMore:"تعرف على المزيد",getWallet:"الحصول على محفظة",approveInWallet:"الموافقة في المحفظة",confirmInWallet:"تأكيد في المحفظة",awaitingConfirmation:"بانتظار التأكيد",signIn:"تسجيل الدخول",signOut:"تسجيل الخروج",signedIn:"تم تسجيل الدخول",signedOut:"تم تسجيل الخروج",walletNotConnected:"المحفظة غير متصلة",warnings_walletSwitchingUnsupported:"عذرًا، لا تدعم محفظتك تغيير الشبكات من هذا التطبيق.",warnings_walletSwitchingUnsupportedResolve:"حاول تغيير الشبكات من داخل محفظتك بدلاً من ذلك.",warnings_chainUnsupported:"هذا التطبيق غير متوافق مع الشبكة المتصلة حاليًا.",warnings_chainUnsupportedResolve:"للمتابعة، قم بتغيير الشبكة أو قطع الاتصال.",onboardingScreen_heading:"الحصول على محفظة",onboardingScreen_h1:"ابدأ استكشاف الويب3",onboardingScreen_p:"تعتبر محفظتك بوابتك إلى عوالم إيثريوم، التكنولوجيا السحرية التي تمكن استكشاف الويب3.",onboardingScreen_ctaText:"اختر محفظتك الأولى",onboardingScreen_ctaUrl:"https://ethereum.org/ar/wallets/find-wallet/",aboutScreen_heading:"حول المحافظ",aboutScreen_a_h1:"حافظ على أصولك الرقمية",aboutScreen_a_p:"تمكنك المحافظ من إرسال واستقبال وتخزين والتفاعل مع الأصول الرقمية مثل NFTs ورموز إيثريوم الأخرى.",aboutScreen_b_h1:"وسيلة أفضل لتسجيل الدخول",aboutScreen_b_p:"في تطبيقات العصر الحديث، يمكن استخدام محفظتك كوسيلة سهلة لتسجيل الدخول بدلاً من الحاجة إلى تذكر كلمة مرور.",aboutScreen_c_h1:"استكشاف عالم الويب3",aboutScreen_c_p:"تعتبر محفظتك أداة أساسية تمكنك من استكشاف والمشاركة في عالم الويب3 الذي يتطور بسرعة.",aboutScreen_ctaText:"استزيد من المعرفة",aboutScreen_ctaUrl:"https://ethereum.org/ar/wallets/",connectorsScreen_heading:"الاتصال بالمحفظة",connectorsScreen_newcomer:"ليس لدي محفظة",connectorsScreen_h1:"ما هي المحافظ؟",connectorsScreen_p:"تُستخدم المحافظ لإرسال واستقبال وتخزين الأصول الرقمية. يمكنك الاتصال بمحفظة للتفاعل مع التطبيقات.",mobileConnectorsScreen_heading:"اختر محفظة",scanScreen_heading:"مسح باستخدام الهاتف",scanScreen_heading_withConnector:"مسح باستخدام {{ CONNECTORNAME }}",scanScreen_tooltip_walletConnect:`افتح محفظة تدعم ولِيت‌كنيكت + `),rt=nt[0],ot=nt[nt.length-1],it=tt.key==="Tab"||tt.keyCode===KEYCODE_TAB;it&&(tt.shiftKey?document.activeElement===rt&&(ot.focus(),tt.preventDefault()):document.activeElement===ot&&(rt.focus(),tt.preventDefault()))}}return reactExports.useEffect(()=>(o.current&&(o.current.addEventListener("keydown",et),o.current.focus({preventScroll:!0})),()=>{o.current&&o.current.removeEventListener("keydown",et)}),[]),o}function FocusTrap(o){const et=useFocusTrap();return reactExports.useEffect(()=>{et.current&&et.current.focus({preventScroll:!0})},[]),jsxRuntimeExports.jsx("div",{ref:et,tabIndex:0,children:o.children})}function usePrevious(o,et){const tt=reactExports.useRef({target:o,previous:et});return tt.current.target!==o&&(tt.current.previous=tt.current.target,tt.current.target=o),tt.current.previous}const Context$1=reactExports.createContext(null),ConnectKitThemeProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt})=>{const rt={theme:et,mode:tt,customTheme:nt};return reactExports.createElement(Context$1.Provider,{value:rt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o}))},useThemeContext=()=>{const o=React.useContext(Context$1);if(!o)throw Error("ConnectKitThemeProvider must be inside a Provider.");return o},ExternalLinkIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{left:0,top:0},...o,children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4C2.89543 4 2 4.89543 2 6V12C2 13.1046 2.89543 14 4 14H10C11.1046 14 12 13.1046 12 12V9.66667C12 9.11438 12.4477 8.66667 13 8.66667C13.5523 8.66667 14 9.11438 14 9.66667V12C14 14.2091 12.2091 16 10 16H4C1.79086 16 0 14.2091 0 12V6C0 3.79086 1.79086 2 4 2H6.33333C6.88562 2 7.33333 2.44772 7.33333 3C7.33333 3.55228 6.88562 4 6.33333 4H4Z",fill:"currentColor",fillOpacity:.3}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.5 1C9.5 0.447715 9.94772 0 10.5 0H15C15.5523 0 16 0.447715 16 1V5.5C16 6.05228 15.5523 6.5 15 6.5C14.4477 6.5 14 6.05228 14 5.5V3.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L12.5858 2H10.5C9.94772 2 9.5 1.55228 9.5 1Z",fill:"currentColor",fillOpacity:.3})]}),AlertIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.81753 1.60122C7.39283 0.530035 8.46953 0 9.50409 0C10.5507 0 11.6022 0.539558 12.1805 1.59767L18.6047 13.3334C18.882 13.8283 19 14.3568 19 14.8622C19 16.5296 17.7949 18 15.9149 18H3.08514C1.20508 18 0 16.5296 0 14.8622C0 14.3454 0.131445 13.8172 0.405555 13.3379L6.81753 1.60122ZM9.50409 2C9.13355 2 8.77256 2.18675 8.57866 2.54907L8.57458 2.5567L2.14992 14.3166L2.144 14.3268C2.04638 14.4959 2 14.6817 2 14.8622C2 15.5497 2.43032 16 3.08514 16H15.9149C16.5697 16 17 15.5497 17 14.8622C17 14.6681 16.9554 14.4805 16.8588 14.309L16.8529 14.2986L10.4259 2.55741C10.2191 2.1792 9.86395 2 9.50409 2Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M9.5 11.2297C9.01639 11.2297 8.7459 10.9419 8.72951 10.4186L8.60656 6.4157C8.59016 5.88372 8.95902 5.5 9.4918 5.5C10.0164 5.5 10.4016 5.89244 10.3852 6.42442L10.2623 10.4099C10.2377 10.9419 9.96721 11.2297 9.5 11.2297ZM9.5 14.5C8.95082 14.5 8.5 14.0901 8.5 13.5058C8.5 12.9215 8.95082 12.5116 9.5 12.5116C10.0492 12.5116 10.5 12.9128 10.5 13.5058C10.5 14.0988 10.041 14.5 9.5 14.5Z",fill:"currentColor"})]}),DisconnectIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{left:0,top:0},...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 0C1.79086 0 0 1.79086 0 4V10C0 12.2091 1.79086 14 4 14H6C6.55228 14 7 13.5523 7 13C7 12.4477 6.55228 12 6 12H4C2.89543 12 2 11.1046 2 10V4C2 2.89543 2.89543 2 4 2H6C6.55228 2 7 1.55228 7 1C7 0.447715 6.55228 0 6 0H4ZM11.7071 3.29289C11.3166 2.90237 10.6834 2.90237 10.2929 3.29289C9.90237 3.68342 9.90237 4.31658 10.2929 4.70711L11.5858 6H9.5H6C5.44772 6 5 6.44772 5 7C5 7.55228 5.44772 8 6 8H9.5H11.5858L10.2929 9.29289C9.90237 9.68342 9.90237 10.3166 10.2929 10.7071C10.6834 11.0976 11.3166 11.0976 11.7071 10.7071L14.7071 7.70711C15.0976 7.31658 15.0976 6.68342 14.7071 6.29289L11.7071 3.29289Z",fill:"currentColor",fillOpacity:"0.4"})}),TickIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C13.9706 18 18 13.9706 18 9C18 4.02944 13.9706 0 9 0C4.02944 0 0 4.02944 0 9C0 13.9706 4.02944 18 9 18ZM13.274 7.13324C13.6237 6.70579 13.5607 6.07577 13.1332 5.72604C12.7058 5.37632 12.0758 5.43932 11.726 5.86676L7.92576 10.5115L6.20711 8.79289C5.81658 8.40237 5.18342 8.40237 4.79289 8.79289C4.40237 9.18342 4.40237 9.81658 4.79289 10.2071L7.29289 12.7071C7.49267 12.9069 7.76764 13.0128 8.04981 12.9988C8.33199 12.9847 8.59505 12.8519 8.77396 12.6332L13.274 7.13324Z",fill:"currentColor"})}),RetryIconCircle=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16ZM24.5001 8.74263C25.0834 8.74263 25.5563 9.21551 25.5563 9.79883V14.5997C25.5563 15.183 25.0834 15.6559 24.5001 15.6559H19.6992C19.1159 15.6559 18.643 15.183 18.643 14.5997C18.643 14.0164 19.1159 13.5435 19.6992 13.5435H21.8378L20.071 11.8798C20.0632 11.8724 20.0555 11.865 20.048 11.8574C19.1061 10.915 17.8835 10.3042 16.5643 10.1171C15.2452 9.92999 13.9009 10.1767 12.7341 10.82C11.5674 11.4634 10.6413 12.4685 10.0955 13.684C9.54968 14.8994 9.41368 16.2593 9.70801 17.5588C10.0023 18.8583 10.711 20.0269 11.7273 20.8885C12.7436 21.7502 14.0124 22.2582 15.3425 22.336C16.6726 22.4138 17.9919 22.0572 19.1017 21.3199C19.5088 21.0495 19.8795 20.7333 20.2078 20.3793C20.6043 19.9515 21.2726 19.9262 21.7004 20.3228C22.1282 20.7194 22.1534 21.3876 21.7569 21.8154C21.3158 22.2912 20.8176 22.7161 20.2706 23.0795C18.7793 24.0702 17.0064 24.5493 15.2191 24.4448C13.4318 24.3402 11.7268 23.6576 10.3612 22.4998C8.9956 21.3419 8.0433 19.7716 7.6478 18.0254C7.2523 16.2793 7.43504 14.4519 8.16848 12.8186C8.90192 11.1854 10.1463 9.83471 11.7142 8.97021C13.282 8.10572 15.0884 7.77421 16.861 8.02565C18.6282 8.27631 20.2664 9.09278 21.5304 10.3525L23.4439 12.1544V9.79883C23.4439 9.21551 23.9168 8.74263 24.5001 8.74263Z",fill:"currentColor"})}),RetryIcon=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"16",height:"14",viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{d:"M14.5 2V6H10.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14 5.66537L10.9899 2.75871C10.0931 1.83853 8.92897 1.24216 7.6729 1.05947C6.41683 0.876774 5.13688 1.11765 4.02592 1.7458C2.91497 2.37395 2.0332 3.35534 1.5135 4.54208C0.993792 5.72883 0.864305 7.05663 1.14455 8.3254C1.42479 9.59418 2.09958 10.7352 3.06724 11.5765C4.03489 12.4178 5.24298 12.9138 6.50946 12.9898C7.77594 13.0657 9.03219 12.7176 10.0889 11.9977C10.4765 11.7337 10.8295 11.4249 11.142 11.0792",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),CopyToClipboardIcon$1=({...o})=>jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[jsxRuntimeExports.jsx("path",{d:"M14 9.5V7C14 5.89543 13.1046 5 12 5H7C5.89543 5 5 5.89543 5 7V12C5 13.1046 5.89543 14 7 14H9.5",stroke:"var(--ck-body-color-muted)",strokeWidth:"2"}),jsxRuntimeExports.jsx("rect",{x:"10",y:"10",width:"9",height:"9",rx:"2",stroke:"var(--ck-body-color-muted)",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M1 3L3 5L7 1",stroke:"var(--ck-body-color)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]}),AuthIcon=({...o})=>jsxRuntimeExports.jsx("div",{...o,style:{zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",bottom:0,right:0,background:"#34C759",borderRadius:10,boxShadow:"0 0 0 1.5px var(--background)",width:10,height:10,...o==null?void 0:o.style},children:jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"6",height:"6",viewBox:"0 0 6 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M0.75 3L2.25 4.5L5.25 1.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})});var StatusState;(function(o){o.READY="ready",o.LOADING="loading",o.SUCCESS="success",o.REJECTED="rejected",o.ERROR="error"})(StatusState||(StatusState={}));const SIWEContext=reactExports.createContext(null),useSIWE=({onSignIn:o,onSignOut:et}={})=>{const tt=reactExports.useContext(SIWEContext);if(!tt)return{isSignedIn:!1,data:void 0,status:StatusState.ERROR,error:new Error("useSIWE hook must be inside a SIWEProvider."),isRejected:!1,isError:!0,isLoading:!1,isSuccess:!1,isReady:!1,reset:()=>{},signIn:()=>Promise.reject(),signOut:()=>Promise.reject()};const{session:nt,nonce:rt,status:ot,signOut:it,signIn:st,resetStatus:at}=tt,{address:ct,chainId:lt}=nt.data||{},dt=ct?StatusState.SUCCESS:nt.isLoading||rt.isLoading?StatusState.LOADING:ot,ht=dt===StatusState.LOADING,ft=dt===StatusState.SUCCESS,mt=dt===StatusState.REJECTED,pt=dt===StatusState.ERROR,yt=!ct||rt.isFetching||ht||ft,gt=()=>at(),xt=!!ct;return{isSignedIn:xt,data:xt?{address:ct,chainId:lt}:void 0,status:dt,error:nt.error||rt.error,isRejected:mt,isError:pt,isLoading:ht,isSuccess:ft,isReady:yt,signIn:async()=>{if(!xt){const vt=await st();vt&&(o==null||o(vt))}},signOut:async()=>{xt&&(await it(),et==null||et())},reset:gt}},arAE={connectWallet:"الاتصال بالمحفظة",disconnect:"قطع الاتصال",connected:"متصل",wrongNetwork:"شبكة خاطئة",switchNetworks:"تغيير الشبكات",chainNetwork:"شبكة {{ CHAIN }}",copyToClipboard:"نسخ إلى الحافظة",copyCode:"نسخ الكود",moreInformation:"مزيد من المعلومات",back:"عودة",close:"إغلاق",or:"أو",more:"المزيد",tryAgain:"حاول مجددًا",tryAgainQuestion:"هل نحاول مرة أخرى؟",dontHaveTheApp:"ليس لديك التطبيق؟",scanTheQRCode:"مسح رمز الاستجابة السريعة",useWalletConnectModal:"استخدم نموذج ولِيت‌كنيكت",useModal:"استخدم النموذج",installTheExtension:"تثبيت الإضافة",getWalletName:"الحصول على {{ CONNECTORNAME }}",otherWallets:"محافظ أخرى",learnMore:"تعرف على المزيد",getWallet:"الحصول على محفظة",approveInWallet:"الموافقة في المحفظة",confirmInWallet:"تأكيد في المحفظة",awaitingConfirmation:"بانتظار التأكيد",signIn:"تسجيل الدخول",signOut:"تسجيل الخروج",signedIn:"تم تسجيل الدخول",signedOut:"تم تسجيل الخروج",walletNotConnected:"المحفظة غير متصلة",warnings_walletSwitchingUnsupported:"عذرًا، لا تدعم محفظتك تغيير الشبكات من هذا التطبيق.",warnings_walletSwitchingUnsupportedResolve:"حاول تغيير الشبكات من داخل محفظتك بدلاً من ذلك.",warnings_chainUnsupported:"هذا التطبيق غير متوافق مع الشبكة المتصلة حاليًا.",warnings_chainUnsupportedResolve:"للمتابعة، قم بتغيير الشبكة أو قطع الاتصال.",onboardingScreen_heading:"الحصول على محفظة",onboardingScreen_h1:"ابدأ استكشاف الويب3",onboardingScreen_p:"تعتبر محفظتك بوابتك إلى عوالم إيثريوم، التكنولوجيا السحرية التي تمكن استكشاف الويب3.",onboardingScreen_ctaText:"اختر محفظتك الأولى",onboardingScreen_ctaUrl:"https://ethereum.org/ar/wallets/find-wallet/",aboutScreen_heading:"حول المحافظ",aboutScreen_a_h1:"حافظ على أصولك الرقمية",aboutScreen_a_p:"تمكنك المحافظ من إرسال واستقبال وتخزين والتفاعل مع الأصول الرقمية مثل NFTs ورموز إيثريوم الأخرى.",aboutScreen_b_h1:"وسيلة أفضل لتسجيل الدخول",aboutScreen_b_p:"في تطبيقات العصر الحديث، يمكن استخدام محفظتك كوسيلة سهلة لتسجيل الدخول بدلاً من الحاجة إلى تذكر كلمة مرور.",aboutScreen_c_h1:"استكشاف عالم الويب3",aboutScreen_c_p:"تعتبر محفظتك أداة أساسية تمكنك من استكشاف والمشاركة في عالم الويب3 الذي يتطور بسرعة.",aboutScreen_ctaText:"استزيد من المعرفة",aboutScreen_ctaUrl:"https://ethereum.org/ar/wallets/",connectorsScreen_heading:"الاتصال بالمحفظة",connectorsScreen_newcomer:"ليس لدي محفظة",connectorsScreen_h1:"ما هي المحافظ؟",connectorsScreen_p:"تُستخدم المحافظ لإرسال واستقبال وتخزين الأصول الرقمية. يمكنك الاتصال بمحفظة للتفاعل مع التطبيقات.",mobileConnectorsScreen_heading:"اختر محفظة",scanScreen_heading:"مسح باستخدام الهاتف",scanScreen_heading_withConnector:"مسح باستخدام {{ CONNECTORNAME }}",scanScreen_tooltip_walletConnect:`افتح محفظة تدعم ولِيت‌كنيكت لبدء المسح.`,scanScreen_tooltip_default:"افتح {{ CONNECTORNAME }} على هاتفك للمسح",downloadAppScreen_heading:"الحصول على {{ CONNECTORNAME }}",downloadAppScreen_iosAndroid:`استخدم كاميرا هاتفك للمسح وتنزيله على نظامي iOS أو Android .`,downloadAppScreen_ios:"استخدم كاميرا هاتفك للمسح وتنزيله على نظام iOS.",downloadAppScreen_android:"استخدم كاميرا هاتفك للمسح وتنزيله على نظام Android.",injectionScreen_unavailable_h1:"المتصفح غير مدعوم",injectionScreen_unavailable_p:"لتوصيل محفظتك {{ CONNECTORSHORTNAME }}، قم بتثبيت الإضافة على متصفح {{ SUGGESTEDEXTENSIONBROWSER }}.",injectionScreen_install_h1:"تثبيت {{ CONNECTORNAME }}",injectionScreen_install_p:"لتوصيل محفظتك {{ CONNECTORSHORTNAME }}، قم بتثبيت الإضافة على المتصفح.",injectionScreen_connecting_h1:"طلب الاتصال",injectionScreen_connecting_p:"افتح إضافة المتصفح {{ CONNECTORSHORTNAME }} لتوصيل محفظتك.",injectionScreen_connecting_injected_h1:"طلب الاتصال",injectionScreen_connecting_injected_p:"قبل الطلب من خلال محفظتك للاتصال بتطبيقنا.",injectionScreen_connected_h1:"الاتصال بالفعل",injectionScreen_connected_p:"من الآمن الآن إغلاق هذه النافذة المنبثقة.",injectionScreen_rejected_h1:"تم رفض الطلب",injectionScreen_rejected_p:"لقد قمت برفض الطلب. انقر أعلى للمحاولة مرة أخرى.",injectionScreen_failed_h1:"فشل الاتصال",injectionScreen_failed_p:"عذرًا، حدث خطأ ما. يُرجى المحاولة مرة أخرى للاتصال.",injectionScreen_notconnected_h1:"تسجيل الدخول إلى {{ CONNECTORNAME }}",injectionScreen_notconnected_p:"للمتابعة، يُرجى تسجيل الدخول إلى إضافة {{ CONNECTORNAME }}.",profileScreen_heading:"متصل",switchNetworkScreen_heading:"تبديل الشبكات",signInWithEthereumScreen_tooltip:`أنت غير مسجل الدخول حاليًا إلى هذا التطبيق. @@ -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=o=>{switch(o){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(o){var et,tt;const rt=(tt=(et=useContext().options)===null||et===void 0?void 0:et.language)!==null&&tt!==void 0?tt:"en-US",ot=reactExports.useMemo(()=>getLocale(rt),[rt]);if(!ot)return console.error(`Missing translations for: ${rt}`),`Missing translations for: ${rt}`;const it={};return Object.keys(ot).map(st=>{const at=ot[st];return it[st]=localize(at,o)}),it}const localize=(o,et)=>{let tt=o;return et&&Object.keys(et).forEach(nt=>{tt=tt.replace(new RegExp(`({{ ${nt} }})`,"g"),et[nt])}),replaceMarkdown(tt)},replaceMarkdown=o=>{let et=o;return et=et.split(` -`),et=et.map((tt,nt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),nto.split(/(\*\*[^\*]*\*\*)/g).map((nt,rt)=>/(\*\*.*\*\*)/g.test(nt)?jsxRuntimeExports.jsx("strong",{children:nt.replace(/\*\*/g,"")},rt):`${nt}`).map(nt=>typeof nt=="string"?nt.split(/(\[WALLETCONNECTLOGO\])/g).map(rt=>rt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},rt):rt):nt),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:o="info",maxFontSize:et=100,minFontSize:tt=20,onFinish:nt,onStart:rt,resolution:ot=5}={})=>{const it=LOG_LEVEL[o],st=reactExports.useCallback(()=>({calcKey:0,fontSize:et,fontSizePrev:tt,fontSizeMax:et,fontSizeMin:tt}),[et,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:pt,fontSize:mt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt}=dt;let xt=null;const[vt]=reactExports.useState(()=>new index$1(()=>{xt=window.requestAnimationFrame(()=>{lt.current||(rt&&rt(),lt.current=!0,ht({...st(),calcKey:pt+1}))})}));reactExports.useEffect(()=>(at.current&&vt.observe(at.current),()=>{xt&&window.cancelAnimationFrame(xt),vt.disconnect()}),[xt,vt]);const bt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{pt===0||lt.current||(bt!==ct.current&&(rt&&rt(),ht({...st(),calcKey:pt+1})),ct.current=bt)},[pt,st,bt,rt]),useIsoLayoutEffect(()=>{if(pt===0)return;const Et=Math.abs(mt-gt)<=ot,wt=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),kt=wt&&mt===gt,It=mt>gt;if(Et){kt?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):wt?ht({fontSize:It?gt:yt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt,calcKey:pt}):(lt.current=!1,nt&&nt(mt));return}let Rt,Pt=ft,jt=yt;wt?(Rt=It?gt-mt:yt-mt,Pt=Math.min(ft,mt)):(Rt=It?ft-mt:gt-mt,jt=Math.max(yt,mt)),ht({calcKey:pt,fontSize:mt+Rt/2,fontSizeMax:Pt,fontSizeMin:jt,fontSizePrev:mt})},[pt,mt,ft,yt,gt,nt,at,ot]),{fontSize:mt,ref:at}},FitText=({children:o})=>{const[et,tt]=React.useState(!1),{fontSize:nt,ref:rt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:rt,style:{visibility:et?"visible":"hidden",fontSize:`${nt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:o})};FitText.displayName="FitText";function useConnectors(){const o=useConnectors$1();return o??[]}function useConnector(o,et){const tt=useConnectors();return o==="injected"&&et?tt.find(nt=>nt.id===o&&nt.name===et):o==="injected"?tt.find(nt=>nt.id===o&&nt.name.includes("Injected")):tt.find(nt=>nt.id===o)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=o=>{const tt=useWallets().find(nt=>nt.id===o);return tt||null},useWallets=()=>{const o=useConnectors(),et=useContext();return o.map(nt=>{var rt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(nt.id)!==-1),st={id:nt.id,name:(ot=(rt=nt.name)!==null&&rt!==void 0?rt:nt.id)!==null&&ot!==void 0?ot:nt.type,icon:jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}),connector:nt,iconShape:"squircle",isInstalled:nt.type==="mock"||nt.type==="injected"&&nt.id!=="metaMask"||isCoinbaseWalletConnector(nt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:nt.icon?jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((nt,rt,ot)=>ot.findIndex(it=>it.id===nt.id)===rt).map(nt=>{var rt,ot;return nt.id==="walletConnect"?{...nt,name:((rt=et.options)===null||rt===void 0?void 0:rt.walletConnectName)||nt.name,shortName:((ot=et.options)===null||ot===void 0?void 0:ot.walletConnectName)||nt.shortName}:nt}).filter((nt,rt,ot)=>!(nt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((nt,rt,ot)=>!((nt.id==="metaMaskSDK"||nt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((nt,rt)=>{const ot=nt.isInstalled&&isInjectedConnector(nt.connector.type),it=rt.isInstalled&&isInjectedConnector(rt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((nt,rt)=>nt.id==="walletConnect"?1:rt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:o})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[o?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=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,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=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,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:o,pages:et,pageId:tt,positionInside:nt,inline:rt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt;const Et=useContext(),wt=useThemeContext(),kt=isMobile(),{isSignedIn:It,reset:Rt}=useSIWE(),Pt=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),jt={name:Pt==null?void 0:Pt.name,shortName:(lt=Pt==null?void 0:Pt.shortName)!==null&<!==void 0?lt:Pt==null?void 0:Pt.name,icon:(dt=Pt==null?void 0:Pt.iconConnector)!==null&&dt!==void 0?dt:Pt==null?void 0:Pt.icon,iconShape:(ht=Pt==null?void 0:Pt.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:Pt==null?void 0:Pt.iconShouldShrink},Ot=useLocales({CONNECTORNAME:jt==null?void 0:jt.name}),[Bt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ft=!(Bt==="exited"||Bt==="unmounted"),Yt=Bt==="preEnter"||Bt!=="exiting",Ht=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ut=usePrevious(Ht,Ht);nt||useLockBodyScroll(Ft),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(o),o&&Qt(void 0)},[o]);const[qt,Lt]=reactExports.useState({width:void 0,height:void 0}),[Zt,Qt]=reactExports.useState(void 0),Nt=Vt=>{const en={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Lt({width:`${en==null?void 0:en.width}px`,height:`${en==null?void 0:en.height}px`})};let Gt;const nn=reactExports.useCallback(Vt=>{Vt&&(Xt.current=Vt,Qt(Zt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),Nt(Vt))},[o,Zt]),{chain:Wt}=useAccount(),{switchChain:hn}=useSwitchChain(),Xt=reactExports.useRef(null);reactExports.useEffect(()=>{Xt.current&&Nt(Xt.current)},[Wt,hn,kt,It,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ft){Lt({width:void 0,height:void 0});return}const Vt=en=>{en.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ft,it]);const Jt={"--height":qt.height,"--width":qt.width};function tn(){return Pt?!(!Pt.getWalletConnectDeeplink||Pt.isInstalled):!1}function _t(){var Vt;switch(Et.route){case routes.ABOUT:return Ot.aboutScreen_heading;case routes.CONNECT:return tn()?isWalletConnectConnector((Vt=Pt==null?void 0:Pt.connector)===null||Vt===void 0?void 0:Vt.id)?Ot.scanScreen_heading:Ot.scanScreen_heading_withConnector:jt==null?void 0:jt.name;case routes.CONNECTORS:return Ot.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Ot.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Ot.downloadAppScreen_heading;case routes.ONBOARDING:return Ot.onboardingScreen_heading;case routes.PROFILE:return Ot.profileScreen_heading;case routes.SWITCHNETWORKS:return Ot.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return It?Ot.signInWithEthereumScreen_signedIn_heading:Ot.signInWithEthereumScreen_signedOut_heading;default:return""}}const Dt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(pt=ot==null?void 0:ot.theme)!==null&&pt!==void 0?pt:wt.theme,$useMode:(mt=ot==null?void 0:ot.mode)!==null&&mt!==void 0?mt:wt.mode,$customTheme:(ft=ot==null?void 0:ot.customTheme)!==null&&ft!==void 0?ft:wt.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Yt?"auto":"none",position:nt?"absolute":void 0},children:[!rt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Yt,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:Zt?"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:`${Yt&&"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:(xt=Et.options)===null||xt===void 0?void 0:xt.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(Ot.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:Zt,"aria-label":flattenChildren(Ot.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!It&&!(!((vt=Et.options)===null||vt===void 0)&&vt.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:kt?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Ot.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Zt,"aria-label":Ot.signInWithEthereumScreen_signedOut_heading,onClick:()=>{Rt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:It})},"siweButton")]}):at&&!(!((bt=Et.options)===null||bt===void 0)&&bt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Zt,"aria-label":flattenChildren(Ot.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.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:kt?0:.17,delay:kt?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:_t()})},`${Et.route}-${It?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(et).map(Vt=>{const en=et[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!nt&&Bt!=="entered",enterAnim:Vt===tt?Ht>Ut?"active-scale-up":"active":"",exitAnim:Vt!==tt?Ht{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:et,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(et)},[et]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:o}):null},OrDivider=({children:o})=>{const et=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:o??et.or})})},Graphic=styled(motion.div)` +`),et=et.map((tt,nt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),nto.split(/(\*\*[^\*]*\*\*)/g).map((nt,rt)=>/(\*\*.*\*\*)/g.test(nt)?jsxRuntimeExports.jsx("strong",{children:nt.replace(/\*\*/g,"")},rt):`${nt}`).map(nt=>typeof nt=="string"?nt.split(/(\[WALLETCONNECTLOGO\])/g).map(rt=>rt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},rt):rt):nt),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:o="info",maxFontSize:et=100,minFontSize:tt=20,onFinish:nt,onStart:rt,resolution:ot=5}={})=>{const it=LOG_LEVEL[o],st=reactExports.useCallback(()=>({calcKey:0,fontSize:et,fontSizePrev:tt,fontSizeMax:et,fontSizeMin:tt}),[et,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:ft,fontSize:mt,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt}=dt;let xt=null;const[vt]=reactExports.useState(()=>new index$1(()=>{xt=window.requestAnimationFrame(()=>{lt.current||(rt&&rt(),lt.current=!0,ht({...st(),calcKey:ft+1}))})}));reactExports.useEffect(()=>(at.current&&vt.observe(at.current),()=>{xt&&window.cancelAnimationFrame(xt),vt.disconnect()}),[xt,vt]);const bt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{ft===0||lt.current||(bt!==ct.current&&(rt&&rt(),ht({...st(),calcKey:ft+1})),ct.current=bt)},[ft,st,bt,rt]),useIsoLayoutEffect(()=>{if(ft===0)return;const Et=Math.abs(mt-gt)<=ot,wt=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),kt=wt&&mt===gt,It=mt>gt;if(Et){kt?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):wt?ht({fontSize:It?gt:yt,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt,calcKey:ft}):(lt.current=!1,nt&&nt(mt));return}let Rt,$t=pt,Nt=yt;wt?(Rt=It?gt-mt:yt-mt,$t=Math.min(pt,mt)):(Rt=It?pt-mt:gt-mt,Nt=Math.max(yt,mt)),ht({calcKey:ft,fontSize:mt+Rt/2,fontSizeMax:$t,fontSizeMin:Nt,fontSizePrev:mt})},[ft,mt,pt,yt,gt,nt,at,ot]),{fontSize:mt,ref:at}},FitText=({children:o})=>{const[et,tt]=React.useState(!1),{fontSize:nt,ref:rt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:rt,style:{visibility:et?"visible":"hidden",fontSize:`${nt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:o})};FitText.displayName="FitText";function useConnectors(){const o=useConnectors$1();return o??[]}function useConnector(o,et){const tt=useConnectors();return o==="injected"&&et?tt.find(nt=>nt.id===o&&nt.name===et):o==="injected"?tt.find(nt=>nt.id===o&&nt.name.includes("Injected")):tt.find(nt=>nt.id===o)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=o=>{const tt=useWallets().find(nt=>nt.id===o);return tt||null},useWallets=()=>{const o=useConnectors(),et=useContext();return o.map(nt=>{var rt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(nt.id)!==-1),st={id:nt.id,name:(ot=(rt=nt.name)!==null&&rt!==void 0?rt:nt.id)!==null&&ot!==void 0?ot:nt.type,icon:jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}),connector:nt,iconShape:"squircle",isInstalled:nt.type==="mock"||nt.type==="injected"&&nt.id!=="metaMask"||isCoinbaseWalletConnector(nt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:nt.icon?jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((nt,rt,ot)=>ot.findIndex(it=>it.id===nt.id)===rt).map(nt=>{var rt,ot;return nt.id==="walletConnect"?{...nt,name:((rt=et.options)===null||rt===void 0?void 0:rt.walletConnectName)||nt.name,shortName:((ot=et.options)===null||ot===void 0?void 0:ot.walletConnectName)||nt.shortName}:nt}).filter((nt,rt,ot)=>!(nt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((nt,rt,ot)=>!((nt.id==="metaMaskSDK"||nt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((nt,rt)=>{const ot=nt.isInstalled&&isInjectedConnector(nt.connector.type),it=rt.isInstalled&&isInjectedConnector(rt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((nt,rt)=>nt.id==="walletConnect"?1:rt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:o})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[o?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=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,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=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,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:o,pages:et,pageId:tt,positionInside:nt,inline:rt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,ft,mt,pt,yt,gt,xt,vt,bt;const Et=useContext(),wt=useThemeContext(),kt=isMobile(),{isSignedIn:It,reset:Rt}=useSIWE(),$t=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),Nt={name:$t==null?void 0:$t.name,shortName:(lt=$t==null?void 0:$t.shortName)!==null&<!==void 0?lt:$t==null?void 0:$t.name,icon:(dt=$t==null?void 0:$t.iconConnector)!==null&&dt!==void 0?dt:$t==null?void 0:$t.icon,iconShape:(ht=$t==null?void 0:$t.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:$t==null?void 0:$t.iconShouldShrink},Mt=useLocales({CONNECTORNAME:Nt==null?void 0:Nt.name}),[Bt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ft=!(Bt==="exited"||Bt==="unmounted"),Yt=Bt==="preEnter"||Bt!=="exiting",Ht=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ut=usePrevious(Ht,Ht);nt||useLockBodyScroll(Ft),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(o),o&&Qt(void 0)},[o]);const[qt,Pt]=reactExports.useState({width:void 0,height:void 0}),[Zt,Qt]=reactExports.useState(void 0),Lt=Vt=>{const en={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Pt({width:`${en==null?void 0:en.width}px`,height:`${en==null?void 0:en.height}px`})};let Gt;const nn=reactExports.useCallback(Vt=>{Vt&&(Xt.current=Vt,Qt(Zt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),Lt(Vt))},[o,Zt]),{chain:Wt}=useAccount(),{switchChain:hn}=useSwitchChain(),Xt=reactExports.useRef(null);reactExports.useEffect(()=>{Xt.current&&Lt(Xt.current)},[Wt,hn,kt,It,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ft){Pt({width:void 0,height:void 0});return}const Vt=en=>{en.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ft,it]);const Jt={"--height":qt.height,"--width":qt.width};function tn(){return $t?!(!$t.getWalletConnectDeeplink||$t.isInstalled):!1}function Tt(){var Vt;switch(Et.route){case routes.ABOUT:return Mt.aboutScreen_heading;case routes.CONNECT:return tn()?isWalletConnectConnector((Vt=$t==null?void 0:$t.connector)===null||Vt===void 0?void 0:Vt.id)?Mt.scanScreen_heading:Mt.scanScreen_heading_withConnector:Nt==null?void 0:Nt.name;case routes.CONNECTORS:return Mt.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Mt.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Mt.downloadAppScreen_heading;case routes.ONBOARDING:return Mt.onboardingScreen_heading;case routes.PROFILE:return Mt.profileScreen_heading;case routes.SWITCHNETWORKS:return Mt.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return It?Mt.signInWithEthereumScreen_signedIn_heading:Mt.signInWithEthereumScreen_signedOut_heading;default:return""}}const Dt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(ft=ot==null?void 0:ot.theme)!==null&&ft!==void 0?ft:wt.theme,$useMode:(mt=ot==null?void 0:ot.mode)!==null&&mt!==void 0?mt:wt.mode,$customTheme:(pt=ot==null?void 0:ot.customTheme)!==null&&pt!==void 0?pt:wt.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Yt?"auto":"none",position:nt?"absolute":void 0},children:[!rt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Yt,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:Zt?"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:`${Yt&&"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:(xt=Et.options)===null||xt===void 0?void 0:xt.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(Mt.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:Zt,"aria-label":flattenChildren(Mt.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!It&&!(!((vt=Et.options)===null||vt===void 0)&&vt.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:kt?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Mt.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Zt,"aria-label":Mt.signInWithEthereumScreen_signedOut_heading,onClick:()=>{Rt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:It})},"siweButton")]}):at&&!(!((bt=Et.options)===null||bt===void 0)&&bt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Zt,"aria-label":flattenChildren(Mt.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.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:kt?0:.17,delay:kt?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:Tt()})},`${Et.route}-${It?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(et).map(Vt=>{const en=et[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!nt&&Bt!=="entered",enterAnim:Vt===tt?Ht>Ut?"active-scale-up":"active":"",exitAnim:Vt!==tt?Ht{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:et,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(et)},[et]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:o}):null},OrDivider=({children:o})=>{const et=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:o??et.or})})},Graphic=styled(motion.div)` position: relative; margin: 16px auto 20px; height: 190px; @@ -1356,7 +1356,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C position: relative; animation: ${Spin$1} 1s ease-in-out infinite; } -`,transition$2={duration:.4,ease:[.175,.885,.32,.98]},Spinner$4=()=>jsxRuntimeExports.jsx(SpinnerContainer$2,{initial:{opacity:0,rotate:180},animate:{opacity:1,rotate:0},exit:{position:"absolute",opacity:0,rotate:-180,transition:{...transition$2}},transition:{...transition$2,delay:.2},children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"9",cy:"9",r:"7",stroke:"currentColor",strokeOpacity:"0.1",strokeWidth:"2.5"}),jsxRuntimeExports.jsx("path",{d:"M16 9C16 5.13401 12.866 2 9 2",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})}),transition$1={duration:.4,ease:[.175,.885,.32,.98]},Button$1=({children:o,variant:et="secondary",disabled:tt,icon:nt,iconPosition:rt="left",roundedIcon:ot,waiting:it,arrow:st,download:at,href:ct,style:lt,onClick:dt})=>{const ht=typeof o=="string"?o:flattenChildren(o).join(""),pt=typeof ct=="string"?ct:flattenChildren(ct).join("");return jsxRuntimeExports.jsx(ButtonContainer$1,{as:ct?"a":void 0,onClick:mt=>{!tt&&dt&&dt(mt)},href:pt,target:ct&&"_blank",rel:ct&&"noopener noreferrer",disabled:tt,$variant:et,style:lt,children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[jsxRuntimeExports.jsxs(ButtonContainerInner,{initial:{opacity:0,y:-10},animate:{opacity:1,y:-1},exit:{position:"absolute",opacity:0,y:10,transition:{...transition$1}},transition:{...transition$1,delay:.2},children:[nt&&rt==="left"&&jsxRuntimeExports.jsx(IconContainer$4,{$rounded:ot,children:nt}),at&&jsxRuntimeExports.jsx(DownloadArrow,{children:jsxRuntimeExports.jsx(DownloadArrowInner,{children:jsxRuntimeExports.jsxs(Arrow,{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx(ArrowLine,{stroke:"currentColor",x1:"1",y1:"6",x2:"12",y2:"6",strokeWidth:"var(--stroke-width)",strokeLinecap:"round"}),jsxRuntimeExports.jsx(ArrowChevron,{stroke:"currentColor",d:"M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314",strokeWidth:"var(--stroke-width)",strokeLinecap:"round"})]})})}),jsxRuntimeExports.jsx(InnerContainer,{style:{paddingLeft:st?6:0},children:jsxRuntimeExports.jsx(FitText,{children:o})}),nt&&rt==="right"&&jsxRuntimeExports.jsx(IconContainer$4,{$rounded:ot,children:nt}),st&&jsxRuntimeExports.jsxs(Arrow,{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx(ArrowLine,{stroke:"currentColor",x1:"1",y1:"6",x2:"12",y2:"6",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntimeExports.jsx(ArrowChevron,{stroke:"currentColor",d:"M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314",strokeWidth:"2",strokeLinecap:"round"})]})]},ht),it&&jsxRuntimeExports.jsx(SpinnerContainer$3,{children:jsxRuntimeExports.jsx(Spinner$4,{})})]})})},Introduction=()=>{var o,et;const tt=useContext(),nt=useLocales({}),rt=(et=(o=tt.options)===null||o===void 0?void 0:o.walletOnboardingUrl)!==null&&et!==void 0?et:nt.onboardingScreen_ctaUrl;return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Graphic,{children:[jsxRuntimeExports.jsxs(LogoGroup,{children:[jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.MetaMask,{background:!0})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Trust,{})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Argent,{})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.ImToken,{})})})})})})})]}),jsxRuntimeExports.jsx(GraphicBackground,{children:wave})]}),jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{$small:!0,children:nt.onboardingScreen_h1}),jsxRuntimeExports.jsx(ModalBody,{children:nt.onboardingScreen_p})]}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:nt.onboardingScreen_ctaText})]})},imageHeight=208,ImageContainer$1=styled.div` +`,transition$2={duration:.4,ease:[.175,.885,.32,.98]},Spinner$4=()=>jsxRuntimeExports.jsx(SpinnerContainer$2,{initial:{opacity:0,rotate:180},animate:{opacity:1,rotate:0},exit:{position:"absolute",opacity:0,rotate:-180,transition:{...transition$2}},transition:{...transition$2,delay:.2},children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"9",cy:"9",r:"7",stroke:"currentColor",strokeOpacity:"0.1",strokeWidth:"2.5"}),jsxRuntimeExports.jsx("path",{d:"M16 9C16 5.13401 12.866 2 9 2",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})}),transition$1={duration:.4,ease:[.175,.885,.32,.98]},Button$1=({children:o,variant:et="secondary",disabled:tt,icon:nt,iconPosition:rt="left",roundedIcon:ot,waiting:it,arrow:st,download:at,href:ct,style:lt,onClick:dt})=>{const ht=typeof o=="string"?o:flattenChildren(o).join(""),ft=typeof ct=="string"?ct:flattenChildren(ct).join("");return jsxRuntimeExports.jsx(ButtonContainer$1,{as:ct?"a":void 0,onClick:mt=>{!tt&&dt&&dt(mt)},href:ft,target:ct&&"_blank",rel:ct&&"noopener noreferrer",disabled:tt,$variant:et,style:lt,children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[jsxRuntimeExports.jsxs(ButtonContainerInner,{initial:{opacity:0,y:-10},animate:{opacity:1,y:-1},exit:{position:"absolute",opacity:0,y:10,transition:{...transition$1}},transition:{...transition$1,delay:.2},children:[nt&&rt==="left"&&jsxRuntimeExports.jsx(IconContainer$4,{$rounded:ot,children:nt}),at&&jsxRuntimeExports.jsx(DownloadArrow,{children:jsxRuntimeExports.jsx(DownloadArrowInner,{children:jsxRuntimeExports.jsxs(Arrow,{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx(ArrowLine,{stroke:"currentColor",x1:"1",y1:"6",x2:"12",y2:"6",strokeWidth:"var(--stroke-width)",strokeLinecap:"round"}),jsxRuntimeExports.jsx(ArrowChevron,{stroke:"currentColor",d:"M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314",strokeWidth:"var(--stroke-width)",strokeLinecap:"round"})]})})}),jsxRuntimeExports.jsx(InnerContainer,{style:{paddingLeft:st?6:0},children:jsxRuntimeExports.jsx(FitText,{children:o})}),nt&&rt==="right"&&jsxRuntimeExports.jsx(IconContainer$4,{$rounded:ot,children:nt}),st&&jsxRuntimeExports.jsxs(Arrow,{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx(ArrowLine,{stroke:"currentColor",x1:"1",y1:"6",x2:"12",y2:"6",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntimeExports.jsx(ArrowChevron,{stroke:"currentColor",d:"M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314",strokeWidth:"2",strokeLinecap:"round"})]})]},ht),it&&jsxRuntimeExports.jsx(SpinnerContainer$3,{children:jsxRuntimeExports.jsx(Spinner$4,{})})]})})},Introduction=()=>{var o,et;const tt=useContext(),nt=useLocales({}),rt=(et=(o=tt.options)===null||o===void 0?void 0:o.walletOnboardingUrl)!==null&&et!==void 0?et:nt.onboardingScreen_ctaUrl;return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Graphic,{children:[jsxRuntimeExports.jsxs(LogoGroup,{children:[jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.MetaMask,{background:!0})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Trust,{})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.Argent,{})})})})})})}),jsxRuntimeExports.jsx(Logo$2,{children:jsxRuntimeExports.jsx(LogoPosition,{children:jsxRuntimeExports.jsx(LogoInner,{children:jsxRuntimeExports.jsx(FloatWrapper,{children:jsxRuntimeExports.jsx(RotateWrapper,{children:jsxRuntimeExports.jsx(LogoGraphic,{children:jsxRuntimeExports.jsx(Logos.ImToken,{})})})})})})})]}),jsxRuntimeExports.jsx(GraphicBackground,{children:wave})]}),jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{$small:!0,children:nt.onboardingScreen_h1}),jsxRuntimeExports.jsx(ModalBody,{children:nt.onboardingScreen_p})]}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:nt.onboardingScreen_ctaText})]})},imageHeight=208,ImageContainer$1=styled.div` pointer-events: none; user-select: none; height: ${imageHeight}px; @@ -1516,7 +1516,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0) 100% ), - linear-gradient(180deg, #3897FB 0%, #5004F1 100%))`,boxShadow:"var(--ck-graphic-globe-box-shadow, 0px -6px 20px rgba(56, 151, 251, 0.23))"},children:jsxRuntimeExports.jsx(SpinContainer,{style:o?void 0:{animationPlayState:"paused"},children:jsxRuntimeExports.jsxs("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("circle",{cx:"30",cy:"141",r:"64",stroke:`url(#networkRadialA-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"78.8515",cy:"131.123",r:"54.1005",transform:"rotate(-37.4016 78.8515 131.123)",stroke:`url(#networkRadialB-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"63.6053",cy:"2.12794",r:"50.8338",transform:"rotate(134.702 63.6053 2.12794)",stroke:`url(#networkRadialC-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"126.658",cy:"56.6577",r:"50.3433",transform:"rotate(-105 126.658 56.6577)",stroke:`url(#networkRadialD-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"13.6619",cy:"18.9603",r:"46.0247",transform:"rotate(107.362 13.6619 18.9603)",stroke:`url(#networkRadialE-${et})`,strokeWidth:"3"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialA-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(60.5 84) rotate(104.668) scale(77.0097)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialB-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.1805 81.6717) rotate(97.125) scale(64.7443)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialC-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.3816 -36.4455) rotate(114.614) scale(57.7177)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialD-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(137.86 7.73234) rotate(92.3288) scale(62.743)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialE-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.3203 -21.566) rotate(104.513) scale(54.8617)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]})]})]})})},"SlideThreeInner"),jsxRuntimeExports.jsxs(motion.div,{exit:{opacity:0},children:[jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.1},animate:o?pulseAnim:void 0,transition:{...pulseTransition},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseA"),jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.2,opacity:.25},animate:o?pulseAnim:void 0,transition:{...pulseTransition,delay:.5},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseB")]})]},o),jsxRuntimeExports.jsxs(motion.div,{initial:{rotate:-20,scale:.1,y:-10,x:-10},animate:{rotate:0,scale:1,y:0,x:0},exit:{zIndex:3,scale:.2,y:-25,x:15},style:{zIndex:12,borderRadius:"50%",position:"absolute",bottom:-4,right:-4,width:54,height:54,display:"flex",alignItems:"center",justifyContent:"center",padding:13,background:"var(--ck-graphic-compass-background, var(--ck-body-background))",boxShadow:"var(--ck-graphic-compass-box-shadow, 0px 2px 9px rgba(0, 0, 0, 0.15))"},children:[jsxRuntimeExports.jsx(BgLighten,{}),jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute"},initial:{rotate:-170},animate:{rotate:0},exit:{rotate:-180,transition:{duration:0}},transition:{type:"spring",stiffness:6,damping:.9,mass:.2},children:Compass})]})]},"SlideThree")})},About=()=>{var o,et;const tt=useLocales({}),nt=useContext(),rt=(et=(o=nt.options)===null||o===void 0?void 0:o.ethereumOnboardingUrl)!==null&&et!==void 0?et:tt.aboutScreen_ctaUrl,[ot,it]=reactExports.useState(!0),[st,at]=reactExports.useState(0),ct=reactExports.useRef(!1),lt=reactExports.useRef(0),dt=[.16,1,.3,1],ht=600;let pt;reactExports.useEffect(()=>()=>clearInterval(pt),[]);const mt=()=>{if(Et.current){const{overflow:Pt}=getComputedStyle(Et.current);return Pt!=="visible"}return!1},ft=Pt=>{it(!1),mt()?yt(Pt):at(Pt)},yt=Pt=>{if(Et.current){const{offsetWidth:jt}=Et.current;Et.current.scrollLeft=jt*Pt,setTimeout(()=>at(Pt),100)}},gt=()=>{if(!Et.current)return;const{offsetWidth:Pt,scrollLeft:jt}=Et.current,Ot=lt.current;lt.current=jt;const Bt=4;if(Ot-jt>-Bt&&Ot-jt{bt()},vt=()=>{const{offsetWidth:Pt,scrollLeft:jt}=Et.current,Ot=Math.round(jt/Pt);at(Ot)},bt=()=>{ct.current=!0,clearTimeout(pt)},Et=reactExports.useRef(null);reactExports.useEffect(()=>{if(Et.current)return Et.current.addEventListener("scroll",gt),Et.current.addEventListener("touchmove",xt),Et.current.addEventListener("touchend",vt),()=>{Et.current&&(Et.current.removeEventListener("scroll",gt),Et.current.removeEventListener("touchmove",xt),Et.current.removeEventListener("touchend",vt))}},[Et]);const wt=[jsxRuntimeExports.jsx(SlideOne,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{layoutId:"graphicCircle",duration:ht,ease:dt})],kt=[jsxRuntimeExports.jsx(SlideOne,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{duration:ht,ease:dt})],It=(()=>{var Pt;switch((Pt=nt.options)===null||Pt===void 0?void 0:Pt.language){case"en-US":case"zh-CN":return 64;default:return 84}})(),Rt=[jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_p})})]})];return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Slider,{children:[jsxRuntimeExports.jsx(ImageContainer$1,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:ht/1e3,ease:dt},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,onExitComplete:()=>it(!0),children:wt.map((Pt,jt)=>st===jt&&jsxRuntimeExports.jsx(ImageContainerInner,{style:{position:"absolute"},children:Pt},jt))})})}),jsxRuntimeExports.jsx(Slides,{ref:Et,children:jsxRuntimeExports.jsx(AnimatePresence,{children:Rt.map((Pt,jt)=>jsxRuntimeExports.jsxs(Slide,{$active:st===jt,children:[jsxRuntimeExports.jsx(MobileImageContainer,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:0},children:jsxRuntimeExports.jsx(ImageContainerInner,{children:kt[jt]})})}),jsxRuntimeExports.jsx(ModalContent,{style:{gap:8,paddingBottom:0},children:Pt})]},jt))})})]}),jsxRuntimeExports.jsx(OrDivider,{children:jsxRuntimeExports.jsx(Dots,{children:Rt.map((Pt,jt)=>jsxRuntimeExports.jsx(Dot,{$active:st===jt,onClick:()=>{bt(),ft(jt)}},jt))})}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:tt.aboutScreen_ctaText})]})},Shimmer$1=We` + linear-gradient(180deg, #3897FB 0%, #5004F1 100%))`,boxShadow:"var(--ck-graphic-globe-box-shadow, 0px -6px 20px rgba(56, 151, 251, 0.23))"},children:jsxRuntimeExports.jsx(SpinContainer,{style:o?void 0:{animationPlayState:"paused"},children:jsxRuntimeExports.jsxs("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("circle",{cx:"30",cy:"141",r:"64",stroke:`url(#networkRadialA-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"78.8515",cy:"131.123",r:"54.1005",transform:"rotate(-37.4016 78.8515 131.123)",stroke:`url(#networkRadialB-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"63.6053",cy:"2.12794",r:"50.8338",transform:"rotate(134.702 63.6053 2.12794)",stroke:`url(#networkRadialC-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"126.658",cy:"56.6577",r:"50.3433",transform:"rotate(-105 126.658 56.6577)",stroke:`url(#networkRadialD-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"13.6619",cy:"18.9603",r:"46.0247",transform:"rotate(107.362 13.6619 18.9603)",stroke:`url(#networkRadialE-${et})`,strokeWidth:"3"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialA-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(60.5 84) rotate(104.668) scale(77.0097)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialB-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.1805 81.6717) rotate(97.125) scale(64.7443)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialC-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.3816 -36.4455) rotate(114.614) scale(57.7177)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialD-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(137.86 7.73234) rotate(92.3288) scale(62.743)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialE-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.3203 -21.566) rotate(104.513) scale(54.8617)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]})]})]})})},"SlideThreeInner"),jsxRuntimeExports.jsxs(motion.div,{exit:{opacity:0},children:[jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.1},animate:o?pulseAnim:void 0,transition:{...pulseTransition},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseA"),jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.2,opacity:.25},animate:o?pulseAnim:void 0,transition:{...pulseTransition,delay:.5},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseB")]})]},o),jsxRuntimeExports.jsxs(motion.div,{initial:{rotate:-20,scale:.1,y:-10,x:-10},animate:{rotate:0,scale:1,y:0,x:0},exit:{zIndex:3,scale:.2,y:-25,x:15},style:{zIndex:12,borderRadius:"50%",position:"absolute",bottom:-4,right:-4,width:54,height:54,display:"flex",alignItems:"center",justifyContent:"center",padding:13,background:"var(--ck-graphic-compass-background, var(--ck-body-background))",boxShadow:"var(--ck-graphic-compass-box-shadow, 0px 2px 9px rgba(0, 0, 0, 0.15))"},children:[jsxRuntimeExports.jsx(BgLighten,{}),jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute"},initial:{rotate:-170},animate:{rotate:0},exit:{rotate:-180,transition:{duration:0}},transition:{type:"spring",stiffness:6,damping:.9,mass:.2},children:Compass})]})]},"SlideThree")})},About=()=>{var o,et;const tt=useLocales({}),nt=useContext(),rt=(et=(o=nt.options)===null||o===void 0?void 0:o.ethereumOnboardingUrl)!==null&&et!==void 0?et:tt.aboutScreen_ctaUrl,[ot,it]=reactExports.useState(!0),[st,at]=reactExports.useState(0),ct=reactExports.useRef(!1),lt=reactExports.useRef(0),dt=[.16,1,.3,1],ht=600;let ft;reactExports.useEffect(()=>()=>clearInterval(ft),[]);const mt=()=>{if(Et.current){const{overflow:$t}=getComputedStyle(Et.current);return $t!=="visible"}return!1},pt=$t=>{it(!1),mt()?yt($t):at($t)},yt=$t=>{if(Et.current){const{offsetWidth:Nt}=Et.current;Et.current.scrollLeft=Nt*$t,setTimeout(()=>at($t),100)}},gt=()=>{if(!Et.current)return;const{offsetWidth:$t,scrollLeft:Nt}=Et.current,Mt=lt.current;lt.current=Nt;const Bt=4;if(Mt-Nt>-Bt&&Mt-Nt{bt()},vt=()=>{const{offsetWidth:$t,scrollLeft:Nt}=Et.current,Mt=Math.round(Nt/$t);at(Mt)},bt=()=>{ct.current=!0,clearTimeout(ft)},Et=reactExports.useRef(null);reactExports.useEffect(()=>{if(Et.current)return Et.current.addEventListener("scroll",gt),Et.current.addEventListener("touchmove",xt),Et.current.addEventListener("touchend",vt),()=>{Et.current&&(Et.current.removeEventListener("scroll",gt),Et.current.removeEventListener("touchmove",xt),Et.current.removeEventListener("touchend",vt))}},[Et]);const wt=[jsxRuntimeExports.jsx(SlideOne,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{layoutId:"graphicCircle",duration:ht,ease:dt})],kt=[jsxRuntimeExports.jsx(SlideOne,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{duration:ht,ease:dt})],It=(()=>{var $t;switch(($t=nt.options)===null||$t===void 0?void 0:$t.language){case"en-US":case"zh-CN":return 64;default:return 84}})(),Rt=[jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_p})})]})];return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Slider,{children:[jsxRuntimeExports.jsx(ImageContainer$1,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:ht/1e3,ease:dt},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,onExitComplete:()=>it(!0),children:wt.map(($t,Nt)=>st===Nt&&jsxRuntimeExports.jsx(ImageContainerInner,{style:{position:"absolute"},children:$t},Nt))})})}),jsxRuntimeExports.jsx(Slides,{ref:Et,children:jsxRuntimeExports.jsx(AnimatePresence,{children:Rt.map(($t,Nt)=>jsxRuntimeExports.jsxs(Slide,{$active:st===Nt,children:[jsxRuntimeExports.jsx(MobileImageContainer,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:0},children:jsxRuntimeExports.jsx(ImageContainerInner,{children:kt[Nt]})})}),jsxRuntimeExports.jsx(ModalContent,{style:{gap:8,paddingBottom:0},children:$t})]},Nt))})})]}),jsxRuntimeExports.jsx(OrDivider,{children:jsxRuntimeExports.jsx(Dots,{children:Rt.map(($t,Nt)=>jsxRuntimeExports.jsx(Dot,{$active:st===Nt,onClick:()=>{bt(),pt(Nt)}},Nt))})}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:tt.aboutScreen_ctaText})]})},Shimmer$1=We` 0%{ transform: translate(-100%) rotate(-45deg); } 100%{ transform: translate(100%) rotate(-80deg); } `,InfoBox=styled.div` @@ -2048,7 +2048,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C } } `} -`;function useChains(){var o;const et=useConfig();return((o=et==null?void 0:et.chains)!==null&&o!==void 0?o:[]).map(nt=>nt)}function useConnect({...o}={}){const et=useContext(),{connect:tt,connectAsync:nt,connectors:rt,...ot}=useConnect$1({...o,mutation:{...o.mutation,onError(it){it.message?it.message!=="User rejected request"&&et.log(it.message,it):et.log("Could not connect.",it)}}});return{connect:({connector:it,chainId:st,mutation:at})=>{var ct;return tt({connector:it,chainId:st??((ct=et.options)===null||ct===void 0?void 0:ct.initialChainId)},at)},connectAsync:async({connector:it,chainId:st,mutation:at})=>{var ct;return nt({connector:it,chainId:st??((ct=et.options)===null||ct===void 0?void 0:ct.initialChainId)},at)},connectors:rt,...ot}}function useWalletConnectUri({enabled:o}={enabled:!0}){const{log:et}=useContext(),[tt,nt]=reactExports.useState(void 0),rt=useWalletConnectConnector(),{isConnected:ot}=useAccount(),{connectAsync:it}=useConnect();return reactExports.useEffect(()=>{if(!o)return;async function st(dt){const{type:ht,data:pt}=dt;et("WC Message",ht,pt),ht==="display_uri"&&nt(pt)}async function at(){et("WC Disconnect"),rt&&ct(rt)}async function ct(dt){const ht=await it({connector:dt});return ht||!1}async function lt(dt){try{await ct(dt)}catch(ht){if(et("catch error"),et(ht),ht.code)switch(ht.code){case 4001:et("error.code - User rejected"),lt(dt);break;default:et("error.code - Unknown Error");break}else et("WalletConnect cannot connect.",ht)}}if(ot)nt(void 0);else{if(!rt||tt)return;if(rt&&!ot)return lt(rt),et("add wc listeners"),rt.emitter.on("message",st),rt.emitter.on("disconnect",at),()=>{et("remove wc listeners"),rt.emitter.off("message",st),rt.emitter.off("disconnect",at)}}},[o,rt,ot]),{uri:tt}}function useChainIsSupported(o){const{chains:et}=useConfig();return o?et.some(tt=>tt.id===o):!1}const Web3Context=React.createContext({connect:{getUri:()=>""},dapp:{chains:[]},account:void 0}),Web3ContextProvider=({enabled:o,children:et})=>{const{uri:tt}=useWalletConnectUri({enabled:o}),{address:nt,chain:rt}=useAccount(),ot=useChainIsSupported(rt==null?void 0:rt.id),it=useChains(),st={connect:{getUri:at=>tt},dapp:{chains:it},account:nt?{chain:rt,chainIsSupported:ot,address:nt}:void 0};return jsxRuntimeExports.jsx(Web3Context.Provider,{value:st,children:et})},useWeb3=()=>React.useContext(Web3Context);function useIsMobile(){const[o,et]=reactExports.useState(isMobile());return reactExports.useEffect(()=>{const tt=()=>{et(isMobile())};return window.addEventListener("resize",tt),()=>window.removeEventListener("resize",tt)},[]),o}const ScrollContainer=styled.div` +`;function useChains(){var o;const et=useConfig();return((o=et==null?void 0:et.chains)!==null&&o!==void 0?o:[]).map(nt=>nt)}function useConnect({...o}={}){const et=useContext(),{connect:tt,connectAsync:nt,connectors:rt,...ot}=useConnect$1({...o,mutation:{...o.mutation,onError(it){it.message?it.message!=="User rejected request"&&et.log(it.message,it):et.log("Could not connect.",it)}}});return{connect:({connector:it,chainId:st,mutation:at})=>{var ct;return tt({connector:it,chainId:st??((ct=et.options)===null||ct===void 0?void 0:ct.initialChainId)},at)},connectAsync:async({connector:it,chainId:st,mutation:at})=>{var ct;return nt({connector:it,chainId:st??((ct=et.options)===null||ct===void 0?void 0:ct.initialChainId)},at)},connectors:rt,...ot}}function useWalletConnectUri({enabled:o}={enabled:!0}){const{log:et}=useContext(),[tt,nt]=reactExports.useState(void 0),rt=useWalletConnectConnector(),{isConnected:ot}=useAccount(),{connectAsync:it}=useConnect();return reactExports.useEffect(()=>{if(!o)return;async function st(dt){const{type:ht,data:ft}=dt;et("WC Message",ht,ft),ht==="display_uri"&&nt(ft)}async function at(){et("WC Disconnect"),rt&&ct(rt)}async function ct(dt){const ht=await it({connector:dt});return ht||!1}async function lt(dt){try{await ct(dt)}catch(ht){if(et("catch error"),et(ht),ht.code)switch(ht.code){case 4001:et("error.code - User rejected"),lt(dt);break;default:et("error.code - Unknown Error");break}else et("WalletConnect cannot connect.",ht)}}if(ot)nt(void 0);else{if(!rt||tt)return;if(rt&&!ot)return lt(rt),et("add wc listeners"),rt.emitter.on("message",st),rt.emitter.on("disconnect",at),()=>{et("remove wc listeners"),rt.emitter.off("message",st),rt.emitter.off("disconnect",at)}}},[o,rt,ot]),{uri:tt}}function useChainIsSupported(o){const{chains:et}=useConfig();return o?et.some(tt=>tt.id===o):!1}const Web3Context=React.createContext({connect:{getUri:()=>""},dapp:{chains:[]},account:void 0}),Web3ContextProvider=({enabled:o,children:et})=>{const{uri:tt}=useWalletConnectUri({enabled:o}),{address:nt,chain:rt}=useAccount(),ot=useChainIsSupported(rt==null?void 0:rt.id),it=useChains(),st={connect:{getUri:at=>tt},dapp:{chains:it},account:nt?{chain:rt,chainIsSupported:ot,address:nt}:void 0};return jsxRuntimeExports.jsx(Web3Context.Provider,{value:st,children:et})},useWeb3=()=>React.useContext(Web3Context);function useIsMobile(){const[o,et]=reactExports.useState(isMobile());return reactExports.useEffect(()=>{const tt=()=>{et(isMobile())};return window.addEventListener("resize",tt),()=>window.removeEventListener("resize",tt)},[]),o}const ScrollContainer=styled.div` position: relative; `,fadeIn=We` 0%{ opacity:0; } @@ -2204,7 +2204,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C &::-webkit-scrollbar-thumb:hover { background: var(--ck-body-color-muted-hover); } -`,ArrowDown=()=>jsxRuntimeExports.jsx("svg",{width:"11",height:"12",viewBox:"0 0 11 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M5.49438 1L5.49438 11M5.49438 11L9.5 7M5.49438 11L1.5 7",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),ScrollArea$2=({children:o,height:et,backgroundColor:tt,mobileDirection:nt})=>{const rt=reactExports.useRef(null),ot=reactExports.useRef(null),it=useIsMobile();return reactExports.useEffect(()=>{const st=rt.current;if(!st)return;st.scrollHeight>st.clientHeight&&ot.current&&ot.current.classList.remove("hide");const at=ct=>{const{scrollTop:lt,scrollHeight:dt,clientHeight:ht,scrollLeft:pt,scrollWidth:mt,clientWidth:ft}=ct.target;ot.current&<>0&&ot.current.classList.add("hide"),lt===0&&pt===0?st.classList.add("scroll-start"):st.classList.remove("scroll-start"),dt-lt===ht&&mt-pt===ft?st.classList.add("scroll-end"):st.classList.remove("scroll-end")};return st.addEventListener("scroll",at),at({target:st}),()=>{st.removeEventListener("scroll",at)}},[rt.current]),jsxRuntimeExports.jsxs(ScrollContainer,{children:[jsxRuntimeExports.jsx(ScrollAreaContainer,{ref:rt,$mobile:it,$height:et,$backgroundColor:tt,$mobileDirection:nt,children:o}),jsxRuntimeExports.jsx(MoreIndicator,{ref:ot,className:"hide",onClick:()=>{rt.current&&rt.current.scrollTo({top:rt.current.scrollHeight,behavior:"smooth"})},children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(ArrowDown,{})," More Available"]})})]})},AlertContainer=styled(motion.div)` +`,ArrowDown=()=>jsxRuntimeExports.jsx("svg",{width:"11",height:"12",viewBox:"0 0 11 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M5.49438 1L5.49438 11M5.49438 11L9.5 7M5.49438 11L1.5 7",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),ScrollArea$2=({children:o,height:et,backgroundColor:tt,mobileDirection:nt})=>{const rt=reactExports.useRef(null),ot=reactExports.useRef(null),it=useIsMobile();return reactExports.useEffect(()=>{const st=rt.current;if(!st)return;st.scrollHeight>st.clientHeight&&ot.current&&ot.current.classList.remove("hide");const at=ct=>{const{scrollTop:lt,scrollHeight:dt,clientHeight:ht,scrollLeft:ft,scrollWidth:mt,clientWidth:pt}=ct.target;ot.current&<>0&&ot.current.classList.add("hide"),lt===0&&ft===0?st.classList.add("scroll-start"):st.classList.remove("scroll-start"),dt-lt===ht&&mt-ft===pt?st.classList.add("scroll-end"):st.classList.remove("scroll-end")};return st.addEventListener("scroll",at),at({target:st}),()=>{st.removeEventListener("scroll",at)}},[rt.current]),jsxRuntimeExports.jsxs(ScrollContainer,{children:[jsxRuntimeExports.jsx(ScrollAreaContainer,{ref:rt,$mobile:it,$height:et,$backgroundColor:tt,$mobileDirection:nt,children:o}),jsxRuntimeExports.jsx(MoreIndicator,{ref:ot,className:"hide",onClick:()=>{rt.current&&rt.current.scrollTo({top:rt.current.scrollHeight,behavior:"smooth"})},children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(ArrowDown,{})," More Available"]})})]})},AlertContainer=styled(motion.div)` display: flex; gap: 8px; position: relative; @@ -2246,7 +2246,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C width: 100%; height: auto; } -`,Alert=({children:o,error:et,icon:tt})=>jsxRuntimeExports.jsxs(AlertContainer,{$error:et,children:[tt&&jsxRuntimeExports.jsx(IconContainer$3,{children:tt}),jsxRuntimeExports.jsx("div",{children:o})]});Alert.displayName="Alert";const useLastConnector=()=>{const{storage:o}=useConfig(),[et,tt]=reactExports.useState(null);return reactExports.useEffect(()=>{(async()=>{const ot=await(o==null?void 0:o.getItem("recentConnectorId"));tt(ot??"")})()},[]),{lastConnectorId:et,updateLastConnectorId:rt=>{o==null||o.setItem("recentConnectorId",rt)}}},ConnectorList=()=>{var o;const et=useContext(),tt=useIsMobile(),nt=useWallets(),{lastConnectorId:rt}=useLastConnector(),ot=!((o=et.options)===null||o===void 0)&&o.hideRecentBadge||rt==="walletConnect"?nt:[...nt.filter(it=>rt===it.connector.id),...nt.filter(it=>rt!==it.connector.id)];return jsxRuntimeExports.jsxs(ScrollArea$2,{mobileDirection:"horizontal",children:[ot.length===0&&jsxRuntimeExports.jsx(Alert,{error:!0,children:"No connectors found in ConnectKit config."}),ot.length>0&&jsxRuntimeExports.jsx(ConnectorsContainer,{$mobile:tt,$totalResults:ot.length,children:ot.map(it=>jsxRuntimeExports.jsx(ConnectorItem,{wallet:it,isRecent:it.id===rt},it.id))})]})},ConnectorItem=({wallet:o,isRecent:et})=>{var tt,nt,rt,ot;const{connect:{getUri:it}}=useWeb3(),st=it(),at=useIsMobile(),ct=useContext(),{connect:lt}=useConnect();let dt=!o.isInstalled&&at||o.shouldDeeplinkDesktop&&!at?(tt=o.getWalletConnectDeeplink)===null||tt===void 0?void 0:tt.call(o,st??""):void 0;const ht=at&&isWalletConnectConnector(o.id),pt=(detectBrowser()==="safari"||detectBrowser()==="ios")&&isCoinbaseWalletConnector(o.connector.id);return(ht||pt)&&(dt=void 0),jsxRuntimeExports.jsxs(ConnectorButton,{type:"button",as:dt?"a":void 0,href:dt||void 0,disabled:ct.route!==routes.CONNECTORS,onClick:dt?void 0:()=>{ht?ct.setRoute(routes.MOBILECONNECTORS):(pt&<({connector:o==null?void 0:o.connector}),ct.setRoute(routes.CONNECT),ct.setConnector({id:o.id}))},children:[jsxRuntimeExports.jsx(ConnectorIcon,{"data-small":o.iconShouldShrink,"data-shape":o.iconShape,children:(nt=o.iconConnector)!==null&&nt!==void 0?nt:o.icon}),jsxRuntimeExports.jsxs(ConnectorLabel,{children:[at&&(rt=o.shortName)!==null&&rt!==void 0?rt:o.name,!(!((ot=ct.options)===null||ot===void 0)&&ot.hideRecentBadge)&&et&&jsxRuntimeExports.jsx(RecentlyUsedTag,{children:jsxRuntimeExports.jsx("span",{children:"Recent"})})]})]})},Wallets=()=>{var o,et,tt,nt,rt;const ot=useContext(),it=useLocales({}),st=useIsMobile();return jsxRuntimeExports.jsxs(PageContent,{style:{width:312},children:[jsxRuntimeExports.jsx(ConnectorList,{}),st?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(InfoBox,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,textAlign:"left"},children:[jsxRuntimeExports.jsx(ModalH1,{$small:!0,children:it.connectorsScreen_h1}),jsxRuntimeExports.jsx(ModalBody,{children:it.connectorsScreen_p})]}),jsxRuntimeExports.jsxs(InfoBoxButtons,{children:[!(!((o=ot.options)===null||o===void 0)&&o.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(Button$1,{variant:"tertiary",onClick:()=>ot.setRoute(routes.ABOUT),children:it.learnMore}),!(!((et=ot.options)===null||et===void 0)&&et.hideNoWalletCTA)&&jsxRuntimeExports.jsx(Button$1,{variant:"tertiary",onClick:()=>ot.setRoute(routes.ONBOARDING),children:it.getWallet})]})]})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:!(!((tt=ot.options)===null||tt===void 0)&&tt.hideNoWalletCTA)&&jsxRuntimeExports.jsx(LearnMoreContainer,{children:jsxRuntimeExports.jsxs(LearnMoreButton,{onClick:()=>ot.setRoute(routes.ONBOARDING),children:[jsxRuntimeExports.jsx(WalletIcon$1,{})," ",it.connectorsScreen_newcomer]})})}),((nt=ot.options)===null||nt===void 0?void 0:nt.disclaimer)&&jsxRuntimeExports.jsx(Disclaimer,{style:{visibility:"hidden",pointerEvents:"none"},children:jsxRuntimeExports.jsx("div",{children:(rt=ot.options)===null||rt===void 0?void 0:rt.disclaimer})})]})},WalletItem=styled.div` +`,Alert=({children:o,error:et,icon:tt})=>jsxRuntimeExports.jsxs(AlertContainer,{$error:et,children:[tt&&jsxRuntimeExports.jsx(IconContainer$3,{children:tt}),jsxRuntimeExports.jsx("div",{children:o})]});Alert.displayName="Alert";const useLastConnector=()=>{const{storage:o}=useConfig(),[et,tt]=reactExports.useState(null);return reactExports.useEffect(()=>{(async()=>{const ot=await(o==null?void 0:o.getItem("recentConnectorId"));tt(ot??"")})()},[]),{lastConnectorId:et,updateLastConnectorId:rt=>{o==null||o.setItem("recentConnectorId",rt)}}},ConnectorList=()=>{var o;const et=useContext(),tt=useIsMobile(),nt=useWallets(),{lastConnectorId:rt}=useLastConnector(),ot=!((o=et.options)===null||o===void 0)&&o.hideRecentBadge||rt==="walletConnect"?nt:[...nt.filter(it=>rt===it.connector.id),...nt.filter(it=>rt!==it.connector.id)];return jsxRuntimeExports.jsxs(ScrollArea$2,{mobileDirection:"horizontal",children:[ot.length===0&&jsxRuntimeExports.jsx(Alert,{error:!0,children:"No connectors found in ConnectKit config."}),ot.length>0&&jsxRuntimeExports.jsx(ConnectorsContainer,{$mobile:tt,$totalResults:ot.length,children:ot.map(it=>jsxRuntimeExports.jsx(ConnectorItem,{wallet:it,isRecent:it.id===rt},it.id))})]})},ConnectorItem=({wallet:o,isRecent:et})=>{var tt,nt,rt,ot;const{connect:{getUri:it}}=useWeb3(),st=it(),at=useIsMobile(),ct=useContext(),{connect:lt}=useConnect();let dt=!o.isInstalled&&at||o.shouldDeeplinkDesktop&&!at?(tt=o.getWalletConnectDeeplink)===null||tt===void 0?void 0:tt.call(o,st??""):void 0;const ht=at&&isWalletConnectConnector(o.id),ft=(detectBrowser()==="safari"||detectBrowser()==="ios")&&isCoinbaseWalletConnector(o.connector.id);return(ht||ft)&&(dt=void 0),jsxRuntimeExports.jsxs(ConnectorButton,{type:"button",as:dt?"a":void 0,href:dt||void 0,disabled:ct.route!==routes.CONNECTORS,onClick:dt?void 0:()=>{ht?ct.setRoute(routes.MOBILECONNECTORS):(ft&<({connector:o==null?void 0:o.connector}),ct.setRoute(routes.CONNECT),ct.setConnector({id:o.id}))},children:[jsxRuntimeExports.jsx(ConnectorIcon,{"data-small":o.iconShouldShrink,"data-shape":o.iconShape,children:(nt=o.iconConnector)!==null&&nt!==void 0?nt:o.icon}),jsxRuntimeExports.jsxs(ConnectorLabel,{children:[at&&(rt=o.shortName)!==null&&rt!==void 0?rt:o.name,!(!((ot=ct.options)===null||ot===void 0)&&ot.hideRecentBadge)&&et&&jsxRuntimeExports.jsx(RecentlyUsedTag,{children:jsxRuntimeExports.jsx("span",{children:"Recent"})})]})]})},Wallets=()=>{var o,et,tt,nt,rt;const ot=useContext(),it=useLocales({}),st=useIsMobile();return jsxRuntimeExports.jsxs(PageContent,{style:{width:312},children:[jsxRuntimeExports.jsx(ConnectorList,{}),st?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(InfoBox,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,textAlign:"left"},children:[jsxRuntimeExports.jsx(ModalH1,{$small:!0,children:it.connectorsScreen_h1}),jsxRuntimeExports.jsx(ModalBody,{children:it.connectorsScreen_p})]}),jsxRuntimeExports.jsxs(InfoBoxButtons,{children:[!(!((o=ot.options)===null||o===void 0)&&o.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(Button$1,{variant:"tertiary",onClick:()=>ot.setRoute(routes.ABOUT),children:it.learnMore}),!(!((et=ot.options)===null||et===void 0)&&et.hideNoWalletCTA)&&jsxRuntimeExports.jsx(Button$1,{variant:"tertiary",onClick:()=>ot.setRoute(routes.ONBOARDING),children:it.getWallet})]})]})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:!(!((tt=ot.options)===null||tt===void 0)&&tt.hideNoWalletCTA)&&jsxRuntimeExports.jsx(LearnMoreContainer,{children:jsxRuntimeExports.jsxs(LearnMoreButton,{onClick:()=>ot.setRoute(routes.ONBOARDING),children:[jsxRuntimeExports.jsx(WalletIcon$1,{})," ",it.connectorsScreen_newcomer]})})}),((nt=ot.options)===null||nt===void 0?void 0:nt.disclaimer)&&jsxRuntimeExports.jsx(Disclaimer,{style:{visibility:"hidden",pointerEvents:"none"},children:jsxRuntimeExports.jsx("div",{children:(rt=ot.options)===null||rt===void 0?void 0:rt.disclaimer})})]})},WalletItem=styled.div` text-align: center; transition: opacity 100ms ease; opacity: ${o=>o.$waiting?.4:1}; @@ -2382,7 +2382,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C margin: 0; margin-left: 4px; } -`,CopyToClipboard=({string:o,children:et,variant:tt})=>{const[nt,rt]=reactExports.useState(!1);let ot;const it=()=>{if(!o)return;const st=o.trim();navigator.clipboard&&navigator.clipboard.writeText(st),rt(!0),clearTimeout(ot),ot=setTimeout(()=>rt(!1),1e3)};return tt==="button"?jsxRuntimeExports.jsx(Button$1,{disabled:!o,onClick:it,icon:jsxRuntimeExports.jsx(CopyToClipboardIcon,{copied:nt}),children:et}):jsxRuntimeExports.jsx(Container$5,{onClick:it,$disabled:!o,children:jsxRuntimeExports.jsxs(OffsetContainer,{children:[et,jsxRuntimeExports.jsx(CopyToClipboardIcon,{copied:nt,small:!0})]})})},MoreIcon=jsxRuntimeExports.jsx("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M30 42V19M19 30.5H42",stroke:"var(--ck-body-color-muted)",strokeWidth:"3",strokeLinecap:"round"})}),MobileConnectors=()=>{var o,et;const tt=useContext(),nt=useLocales(),{connect:{getUri:rt}}=useWeb3(),ot=rt(),{open:it,isOpen:st}=useWalletConnectModal(),at=useWallets(),ct=(o=Object.keys(walletConfigs).filter(dt=>{const ht=walletConfigs[dt];return!(at.find(pt=>pt.connector.id===dt)||!ht.getWalletConnectDeeplink)}))!==null&&o!==void 0?o:[],lt=dt=>{var ht;const pt=(ht=dt.getWalletConnectDeeplink)===null||ht===void 0?void 0:ht.call(dt,ot);pt&&(window.location.href=pt)};return jsxRuntimeExports.jsx(PageContent,{style:{width:312},children:jsxRuntimeExports.jsxs(Container$6,{children:[jsxRuntimeExports.jsx(ModalContent,{style:{paddingBottom:0},children:jsxRuntimeExports.jsx(ScrollArea$2,{height:340,children:jsxRuntimeExports.jsxs(WalletList,{$disabled:!ot,children:[ct.sort((dt,ht)=>{var pt,mt,ft,yt;const gt=walletConfigs[dt],xt=walletConfigs[ht],vt=(mt=(pt=gt.name)!==null&&pt!==void 0?pt:gt.shortName)!==null&&mt!==void 0?mt:dt,bt=(yt=(ft=xt.name)!==null&&ft!==void 0?ft:xt.shortName)!==null&&yt!==void 0?yt:ht;return vt.localeCompare(bt)}).filter(dt=>!(dt==="coinbaseWallet"||dt==="com.coinbase.wallet")).map((dt,ht)=>{const pt=walletConfigs[dt],{name:mt,shortName:ft,iconConnector:yt,icon:gt}=pt;return jsxRuntimeExports.jsxs(WalletItem,{onClick:()=>lt(pt),style:{animationDelay:`${ht*50}ms`},children:[jsxRuntimeExports.jsx(WalletIcon,{$outline:!0,children:yt??gt}),jsxRuntimeExports.jsx(WalletLabel,{children:ft??mt})]},ht)}),jsxRuntimeExports.jsxs(WalletItem,{onClick:it,$waiting:st,children:[jsxRuntimeExports.jsx(WalletIcon,{style:{background:"var(--ck-body-background-secondary)"},children:st?jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntimeExports.jsx("div",{style:{width:"50%"},children:jsxRuntimeExports.jsx(Spinner$4,{})})}):MoreIcon}),jsxRuntimeExports.jsx(WalletLabel,{children:nt.more})]})]})})}),((et=tt.options)===null||et===void 0?void 0:et.walletConnectCTA)!=="modal"&&jsxRuntimeExports.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:14,paddingTop:8},children:jsxRuntimeExports.jsx(CopyToClipboard,{variant:"button",string:ot,children:nt.copyToClipboard})})]})})},Content$1=styled(motion.div)` +`,CopyToClipboard=({string:o,children:et,variant:tt})=>{const[nt,rt]=reactExports.useState(!1);let ot;const it=()=>{if(!o)return;const st=o.trim();navigator.clipboard&&navigator.clipboard.writeText(st),rt(!0),clearTimeout(ot),ot=setTimeout(()=>rt(!1),1e3)};return tt==="button"?jsxRuntimeExports.jsx(Button$1,{disabled:!o,onClick:it,icon:jsxRuntimeExports.jsx(CopyToClipboardIcon,{copied:nt}),children:et}):jsxRuntimeExports.jsx(Container$5,{onClick:it,$disabled:!o,children:jsxRuntimeExports.jsxs(OffsetContainer,{children:[et,jsxRuntimeExports.jsx(CopyToClipboardIcon,{copied:nt,small:!0})]})})},MoreIcon=jsxRuntimeExports.jsx("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M30 42V19M19 30.5H42",stroke:"var(--ck-body-color-muted)",strokeWidth:"3",strokeLinecap:"round"})}),MobileConnectors=()=>{var o,et;const tt=useContext(),nt=useLocales(),{connect:{getUri:rt}}=useWeb3(),ot=rt(),{open:it,isOpen:st}=useWalletConnectModal(),at=useWallets(),ct=(o=Object.keys(walletConfigs).filter(dt=>{const ht=walletConfigs[dt];return!(at.find(ft=>ft.connector.id===dt)||!ht.getWalletConnectDeeplink)}))!==null&&o!==void 0?o:[],lt=dt=>{var ht;const ft=(ht=dt.getWalletConnectDeeplink)===null||ht===void 0?void 0:ht.call(dt,ot);ft&&(window.location.href=ft)};return jsxRuntimeExports.jsx(PageContent,{style:{width:312},children:jsxRuntimeExports.jsxs(Container$6,{children:[jsxRuntimeExports.jsx(ModalContent,{style:{paddingBottom:0},children:jsxRuntimeExports.jsx(ScrollArea$2,{height:340,children:jsxRuntimeExports.jsxs(WalletList,{$disabled:!ot,children:[ct.sort((dt,ht)=>{var ft,mt,pt,yt;const gt=walletConfigs[dt],xt=walletConfigs[ht],vt=(mt=(ft=gt.name)!==null&&ft!==void 0?ft:gt.shortName)!==null&&mt!==void 0?mt:dt,bt=(yt=(pt=xt.name)!==null&&pt!==void 0?pt:xt.shortName)!==null&&yt!==void 0?yt:ht;return vt.localeCompare(bt)}).filter(dt=>!(dt==="coinbaseWallet"||dt==="com.coinbase.wallet")).map((dt,ht)=>{const ft=walletConfigs[dt],{name:mt,shortName:pt,iconConnector:yt,icon:gt}=ft;return jsxRuntimeExports.jsxs(WalletItem,{onClick:()=>lt(ft),style:{animationDelay:`${ht*50}ms`},children:[jsxRuntimeExports.jsx(WalletIcon,{$outline:!0,children:yt??gt}),jsxRuntimeExports.jsx(WalletLabel,{children:pt??mt})]},ht)}),jsxRuntimeExports.jsxs(WalletItem,{onClick:it,$waiting:st,children:[jsxRuntimeExports.jsx(WalletIcon,{style:{background:"var(--ck-body-background-secondary)"},children:st?jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntimeExports.jsx("div",{style:{width:"50%"},children:jsxRuntimeExports.jsx(Spinner$4,{})})}):MoreIcon}),jsxRuntimeExports.jsx(WalletLabel,{children:nt.more})]})]})})}),((et=tt.options)===null||et===void 0?void 0:et.walletConnectCTA)!=="modal"&&jsxRuntimeExports.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:14,paddingTop:8},children:jsxRuntimeExports.jsx(CopyToClipboard,{variant:"button",string:ot,children:nt.copyToClipboard})})]})})},Content$1=styled(motion.div)` display: flex; flex-direction: column; gap: 6px; @@ -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: ${o=>o.$size==="small"?2:3}px 0 0 0; } -`,Tooltip=({children:o,message:et,open:tt,xOffset:nt=0,yOffset:rt=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:o});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[pt,mt]=reactExports.useState("small"),[ft,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),xt=reactExports.useRef(null),[vt,bt]=useMeasure({debounce:ft?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let It=!1;const Rt=nt+bt.left+bt.width,Pt=rt+bt.top+bt.height*.5;return(Rt>window.innerWidth||Rt<0||Pt>window.innerHeight||Pt<0)&&(It=!0),It};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!xt.current||bt.top+bt.bottom+bt.left+bt.right+bt.height+bt.width===0)return;const It=nt+bt.left+bt.width,Rt=rt+bt.top+bt.height*.5;!ft&&It!==0&&Rt!==0&&yt(!0),xt.current.style.left=`${It}px`,xt.current.style.top=`${Rt}px`,mt(xt.current.offsetHeight<=40?"small":"large"),ht(Et())},[bt,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:vt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:o}),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:pt,ref:xt,initial:"collapsed",animate:ft?"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:[et,jsxRuntimeExports.jsx(TooltipTail,{$size:pt})]})})})})})]})},LogoContainer$4=styled(motion.div)` +`,Tooltip=({children:o,message:et,open:tt,xOffset:nt=0,yOffset:rt=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:o});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[ft,mt]=reactExports.useState("small"),[pt,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),xt=reactExports.useRef(null),[vt,bt]=useMeasure({debounce:pt?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let It=!1;const Rt=nt+bt.left+bt.width,$t=rt+bt.top+bt.height*.5;return(Rt>window.innerWidth||Rt<0||$t>window.innerHeight||$t<0)&&(It=!0),It};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!xt.current||bt.top+bt.bottom+bt.left+bt.right+bt.height+bt.width===0)return;const It=nt+bt.left+bt.width,Rt=rt+bt.top+bt.height*.5;!pt&&It!==0&&Rt!==0&&yt(!0),xt.current.style.left=`${It}px`,xt.current.style.top=`${Rt}px`,mt(xt.current.offsetHeight<=40?"small":"large"),ht(Et())},[bt,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:vt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:o}),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:ft,ref:xt,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:[et,jsxRuntimeExports.jsx(TooltipTail,{$size:ft})]})})})})})]})},LogoContainer$4=styled(motion.div)` z-index: 4; position: relative; overflow: hidden; @@ -2742,7 +2742,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C transform: rotate(360deg); } } -`,CircleSpinner=({logo:o,smallLogo:et,connecting:tt=!0,unavailable:nt=!1,countdown:rt=!1})=>jsxRuntimeExports.jsxs(LogoContainer$3,{transition:{duration:.5,ease:[.175,.885,.32,.98]},children:[jsxRuntimeExports.jsx(Logo,{$small:!nt&&et,style:nt?{borderRadius:0}:void 0,children:o}),jsxRuntimeExports.jsx(SpinnerContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{children:[tt&&jsxRuntimeExports.jsx(Spinner$2,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:rt?1:0}},children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]})},"Spinner"),rt&&jsxRuntimeExports.jsxs(ExpiringSpinner,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]},"ExpiringSpinner")]})})]}),states$1={CONNECTED:"connected",CONNECTING:"connecting",EXPIRING:"expiring",FAILED:"failed",REJECTED:"rejected",NOTCONNECTED:"notconnected",UNAVAILABLE:"unavailable"},contentVariants$1={initial:{willChange:"transform,opacity",position:"relative",opacity:0,scale:.95},animate:{position:"relative",opacity:1,scale:1,transition:{ease:[.16,1,.3,1],duration:.4,delay:.05,position:{delay:0}}},exit:{position:"absolute",opacity:0,scale:.95,transition:{ease:[.16,1,.3,1],duration:.3}}},ConnectWithInjector=({switchConnectMethod:o,forceState:et})=>{var tt,nt,rt,ot,it,st,at,ct;const{connect:lt}=useConnect({mutation:{onMutate:jt=>{jt.connector?kt(states$1.CONNECTING):kt(states$1.UNAVAILABLE)},onError(jt){console.error(jt)},onSettled(jt,Ot){if(Ot){if(gt(!0),setTimeout(()=>gt(!1),3500),Ot.code)switch(Ot.code){case-32002:kt(states$1.NOTCONNECTED);break;case 4001:kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}else if(Ot.message)switch(Ot.message){case"User rejected request":kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}}setTimeout(dt,100)}}}),{triggerResize:dt,connector:ht}=useContext(),pt=ht.id,mt=useWallet(pt),ft={name:mt==null?void 0:mt.name,shortName:(tt=mt==null?void 0:mt.shortName)!==null&&tt!==void 0?tt:mt==null?void 0:mt.name,icon:(nt=mt==null?void 0:mt.iconConnector)!==null&&nt!==void 0?nt:mt==null?void 0:mt.icon,iconShape:(rt=mt==null?void 0:mt.iconShape)!==null&&rt!==void 0?rt:"circle",iconShouldShrink:mt==null?void 0:mt.iconShouldShrink},[yt,gt]=reactExports.useState(!1);reactExports.useState(9);const vt=detectBrowser(),bt=(ot=mt==null?void 0:mt.downloadUrls)===null||ot===void 0?void 0:ot[vt],Et=mt!=null&&mt.downloadUrls?{name:Object.keys(mt==null?void 0:mt.downloadUrls)[0],label:((it=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||it===void 0?void 0:it.charAt(0).toUpperCase())+((st=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||st===void 0?void 0:st.slice(1)),url:mt==null?void 0:mt.downloadUrls[Object.keys(mt==null?void 0:mt.downloadUrls)[0]]}:void 0,[wt,kt]=reactExports.useState(et||(mt!=null&&mt.isInstalled?states$1.CONNECTING:states$1.UNAVAILABLE)),It=useLocales({CONNECTORNAME:ft.name,CONNECTORSHORTNAME:(at=ft.shortName)!==null&&at!==void 0?at:ft.name,SUGGESTEDEXTENSIONBROWSER:(ct=Et==null?void 0:Et.label)!==null&&ct!==void 0?ct:"your browser"}),Rt=async()=>{mt!=null&&mt.isInstalled&&(mt!=null&&mt.connector)?lt({connector:mt==null?void 0:mt.connector}):kt(states$1.UNAVAILABLE)};let Pt;return reactExports.useEffect(()=>{if(wt!==states$1.UNAVAILABLE)return Pt=setTimeout(Rt,600),()=>{clearTimeout(Pt)}},[]),mt?isWalletConnectConnector(mt==null?void 0:mt.connector.id)?jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"WalletConnect does not have an injection flow. This state should never happen."})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ConnectingContainer,{children:jsxRuntimeExports.jsxs(ConnectingAnimation,{$shake:wt===states$1.FAILED||wt===states$1.REJECTED,$circle:ft.iconShape==="circle",children:[jsxRuntimeExports.jsx(AnimatePresence,{children:(wt===states$1.FAILED||wt===states$1.REJECTED)&&jsxRuntimeExports.jsx(RetryButton,{"aria-label":"Retry",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileTap:{scale:.9},transition:{duration:.1},onClick:Rt,children:jsxRuntimeExports.jsx(RetryIconContainer,{children:jsxRuntimeExports.jsx(Tooltip,{open:yt&&(wt===states$1.FAILED||wt===states$1.REJECTED),message:It.tryAgainQuestion,xOffset:-6,children:jsxRuntimeExports.jsx(RetryIconCircle,{})})})})}),ft.iconShape==="circle"?jsxRuntimeExports.jsx(CircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),smallLogo:ft.iconShouldShrink,connecting:wt===states$1.CONNECTING,unavailable:wt===states$1.UNAVAILABLE}):jsxRuntimeExports.jsx(SquircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),connecting:wt===states$1.CONNECTING})]})}),jsxRuntimeExports.jsx(ModalContentContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[wt===states$1.FAILED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$error:!0,children:[jsxRuntimeExports.jsx(AlertIcon,{}),It.injectionScreen_failed_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_failed_p})]})},states$1.FAILED),wt===states$1.REJECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_rejected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_rejected_p})]})},states$1.REJECTED),(wt===states$1.CONNECTING||wt===states$1.EXPIRING)&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_h1:It.injectionScreen_connecting_h1}),jsxRuntimeExports.jsx(ModalBody,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_p:It.injectionScreen_connecting_p})]})},states$1.CONNECTING),wt===states$1.CONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$valid:!0,children:[jsxRuntimeExports.jsx(TickIcon,{})," ",It.injectionScreen_connected_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_connected_p})]})},states$1.CONNECTED),wt===states$1.NOTCONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_notconnected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_notconnected_p})]})},states$1.NOTCONNECTED),wt===states$1.UNAVAILABLE&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:bt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_install_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_install_p})]}),!mt.isInstalled&&bt&&jsxRuntimeExports.jsx(Button$1,{href:bt,icon:jsxRuntimeExports.jsx(BrowserIcon,{}),children:It.installTheExtension})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:12},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_unavailable_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_unavailable_p})]}),!mt.isInstalled&&Et&&jsxRuntimeExports.jsxs(Button$1,{href:Et==null?void 0:Et.url,icon:jsxRuntimeExports.jsx(BrowserIcon,{browser:Et==null?void 0:Et.name}),children:["Install on ",Et==null?void 0:Et.label]})]})},states$1.UNAVAILABLE)]})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"No connectors match the id given. This state should never happen."})})]})})},QRCodeContainer=styled(motion.div)` +`,CircleSpinner=({logo:o,smallLogo:et,connecting:tt=!0,unavailable:nt=!1,countdown:rt=!1})=>jsxRuntimeExports.jsxs(LogoContainer$3,{transition:{duration:.5,ease:[.175,.885,.32,.98]},children:[jsxRuntimeExports.jsx(Logo,{$small:!nt&&et,style:nt?{borderRadius:0}:void 0,children:o}),jsxRuntimeExports.jsx(SpinnerContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{children:[tt&&jsxRuntimeExports.jsx(Spinner$2,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:rt?1:0}},children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]})},"Spinner"),rt&&jsxRuntimeExports.jsxs(ExpiringSpinner,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]},"ExpiringSpinner")]})})]}),states$1={CONNECTED:"connected",CONNECTING:"connecting",EXPIRING:"expiring",FAILED:"failed",REJECTED:"rejected",NOTCONNECTED:"notconnected",UNAVAILABLE:"unavailable"},contentVariants$1={initial:{willChange:"transform,opacity",position:"relative",opacity:0,scale:.95},animate:{position:"relative",opacity:1,scale:1,transition:{ease:[.16,1,.3,1],duration:.4,delay:.05,position:{delay:0}}},exit:{position:"absolute",opacity:0,scale:.95,transition:{ease:[.16,1,.3,1],duration:.3}}},ConnectWithInjector=({switchConnectMethod:o,forceState:et})=>{var tt,nt,rt,ot,it,st,at,ct;const{connect:lt}=useConnect({mutation:{onMutate:Nt=>{Nt.connector?kt(states$1.CONNECTING):kt(states$1.UNAVAILABLE)},onError(Nt){console.error(Nt)},onSettled(Nt,Mt){if(Mt){if(gt(!0),setTimeout(()=>gt(!1),3500),Mt.code)switch(Mt.code){case-32002:kt(states$1.NOTCONNECTED);break;case 4001:kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}else if(Mt.message)switch(Mt.message){case"User rejected request":kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}}setTimeout(dt,100)}}}),{triggerResize:dt,connector:ht}=useContext(),ft=ht.id,mt=useWallet(ft),pt={name:mt==null?void 0:mt.name,shortName:(tt=mt==null?void 0:mt.shortName)!==null&&tt!==void 0?tt:mt==null?void 0:mt.name,icon:(nt=mt==null?void 0:mt.iconConnector)!==null&&nt!==void 0?nt:mt==null?void 0:mt.icon,iconShape:(rt=mt==null?void 0:mt.iconShape)!==null&&rt!==void 0?rt:"circle",iconShouldShrink:mt==null?void 0:mt.iconShouldShrink},[yt,gt]=reactExports.useState(!1);reactExports.useState(9);const vt=detectBrowser(),bt=(ot=mt==null?void 0:mt.downloadUrls)===null||ot===void 0?void 0:ot[vt],Et=mt!=null&&mt.downloadUrls?{name:Object.keys(mt==null?void 0:mt.downloadUrls)[0],label:((it=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||it===void 0?void 0:it.charAt(0).toUpperCase())+((st=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||st===void 0?void 0:st.slice(1)),url:mt==null?void 0:mt.downloadUrls[Object.keys(mt==null?void 0:mt.downloadUrls)[0]]}:void 0,[wt,kt]=reactExports.useState(et||(mt!=null&&mt.isInstalled?states$1.CONNECTING:states$1.UNAVAILABLE)),It=useLocales({CONNECTORNAME:pt.name,CONNECTORSHORTNAME:(at=pt.shortName)!==null&&at!==void 0?at:pt.name,SUGGESTEDEXTENSIONBROWSER:(ct=Et==null?void 0:Et.label)!==null&&ct!==void 0?ct:"your browser"}),Rt=async()=>{mt!=null&&mt.isInstalled&&(mt!=null&&mt.connector)?lt({connector:mt==null?void 0:mt.connector}):kt(states$1.UNAVAILABLE)};let $t;return reactExports.useEffect(()=>{if(wt!==states$1.UNAVAILABLE)return $t=setTimeout(Rt,600),()=>{clearTimeout($t)}},[]),mt?isWalletConnectConnector(mt==null?void 0:mt.connector.id)?jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"WalletConnect does not have an injection flow. This state should never happen."})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ConnectingContainer,{children:jsxRuntimeExports.jsxs(ConnectingAnimation,{$shake:wt===states$1.FAILED||wt===states$1.REJECTED,$circle:pt.iconShape==="circle",children:[jsxRuntimeExports.jsx(AnimatePresence,{children:(wt===states$1.FAILED||wt===states$1.REJECTED)&&jsxRuntimeExports.jsx(RetryButton,{"aria-label":"Retry",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileTap:{scale:.9},transition:{duration:.1},onClick:Rt,children:jsxRuntimeExports.jsx(RetryIconContainer,{children:jsxRuntimeExports.jsx(Tooltip,{open:yt&&(wt===states$1.FAILED||wt===states$1.REJECTED),message:It.tryAgainQuestion,xOffset:-6,children:jsxRuntimeExports.jsx(RetryIconCircle,{})})})})}),pt.iconShape==="circle"?jsxRuntimeExports.jsx(CircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:pt.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:pt.icon}),smallLogo:pt.iconShouldShrink,connecting:wt===states$1.CONNECTING,unavailable:wt===states$1.UNAVAILABLE}):jsxRuntimeExports.jsx(SquircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:pt.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:pt.icon}),connecting:wt===states$1.CONNECTING})]})}),jsxRuntimeExports.jsx(ModalContentContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[wt===states$1.FAILED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$error:!0,children:[jsxRuntimeExports.jsx(AlertIcon,{}),It.injectionScreen_failed_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_failed_p})]})},states$1.FAILED),wt===states$1.REJECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_rejected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_rejected_p})]})},states$1.REJECTED),(wt===states$1.CONNECTING||wt===states$1.EXPIRING)&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_h1:It.injectionScreen_connecting_h1}),jsxRuntimeExports.jsx(ModalBody,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_p:It.injectionScreen_connecting_p})]})},states$1.CONNECTING),wt===states$1.CONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$valid:!0,children:[jsxRuntimeExports.jsx(TickIcon,{})," ",It.injectionScreen_connected_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_connected_p})]})},states$1.CONNECTED),wt===states$1.NOTCONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_notconnected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_notconnected_p})]})},states$1.NOTCONNECTED),wt===states$1.UNAVAILABLE&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:bt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_install_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_install_p})]}),!mt.isInstalled&&bt&&jsxRuntimeExports.jsx(Button$1,{href:bt,icon:jsxRuntimeExports.jsx(BrowserIcon,{}),children:It.installTheExtension})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:12},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_unavailable_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_unavailable_p})]}),!mt.isInstalled&&Et&&jsxRuntimeExports.jsxs(Button$1,{href:Et==null?void 0:Et.url,icon:jsxRuntimeExports.jsx(BrowserIcon,{browser:Et==null?void 0:Et.name}),children:["Install on ",Et==null?void 0:Et.label]})]})},states$1.UNAVAILABLE)]})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"No connectors match the id given. This state should never happen."})})]})})},QRCodeContainer=styled(motion.div)` z-index: 3; position: relative; overflow: hidden; @@ -2882,7 +2882,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02); } `} -`,generateMatrix=(o,et)=>{const tt=Array.prototype.slice.call(browser$1.create(o,{errorCorrectionLevel:et}).modules.data,0),nt=Math.sqrt(tt.length);return tt.reduce((rt,ot,it)=>(it%nt===0?rt.push([ot]):rt[rt.length-1].push(ot))&&rt,[])};function QRCode$1({ecl:o="M",size:et=200,uri:tt,clearArea:nt=!1,image:rt,imageBackground:ot="transparent"}){const it=nt?76:0,st=et-10*2,at=reactExports.useMemo(()=>{const ct=[],lt=generateMatrix(tt,o),dt=st/lt.length;if([{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:yt,y:gt})=>{const xt=(lt.length-7)*dt*yt,vt=(lt.length-7)*dt*gt;for(let bt=0;bt<3;bt++)ct.push(jsxRuntimeExports.jsx("rect",{fill:bt%2!==0?"var(--ck-qr-background, var(--ck-body-background))":"var(--ck-qr-dot-color)",rx:(bt-2)*-5+(bt===0?2:3),ry:(bt-2)*-5+(bt===0?2:3),width:dt*(7-bt*2),height:dt*(7-bt*2),x:xt+dt*bt,y:vt+dt*bt},`${bt}-${yt}-${gt}`))}),rt){const yt=(lt.length-7)*dt*1,gt=(lt.length-7)*dt*1;ct.push(jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("rect",{fill:ot,rx:-2*-5+2,ry:-2*-5+2,width:dt*(7-0*2),height:dt*(7-0*2),x:yt+dt*0,y:gt+dt*0}),jsxRuntimeExports.jsx("foreignObject",{width:dt*(7-0*2),height:dt*(7-0*2),x:yt+dt*0,y:gt+dt*0,children:jsxRuntimeExports.jsx("div",{style:{borderRadius:-2*-5+2,overflow:"hidden"},children:rt})})]}))}const pt=Math.floor((it+25)/dt),mt=lt.length/2-pt/2,ft=lt.length/2+pt/2-1;return lt.forEach((yt,gt)=>{yt.forEach((xt,vt)=>{lt[gt][vt]&&(gt<7&&vt<7||gt>lt.length-8&&vt<7||gt<7&&vt>lt.length-8||(rt||!(gt>mt&>mt&&vt{function tt(){et({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",tt),tt(),()=>window.removeEventListener("resize",tt)},[]),o}function CustomQRCode({value:o,image:et,imageBackground:tt,imagePosition:nt="center",tooltipMessage:rt}){const it=useWindowSize().width>920&&rt?jsxRuntimeExports.jsx(Tooltip,{xOffset:139,yOffset:5,delay:.1,message:rt,children:et}):et;return jsxRuntimeExports.jsx(QRCodeContainer,{children:jsxRuntimeExports.jsxs(QRCodeContent,{children:[et&&jsxRuntimeExports.jsx(LogoContainer$2,{children:jsxRuntimeExports.jsx(LogoIcon,{$wcLogo:nt!=="center",style:{background:nt==="center"?tt:void 0},children:it})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:o?jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute",inset:[0,0]},transition:{duration:.2},children:jsxRuntimeExports.jsx(QRCode$1,{uri:o,size:288,ecl:"M",clearArea:!!(nt==="center"&&et)})},o):jsxRuntimeExports.jsxs(QRPlaceholder,{initial:{opacity:.1},animate:{opacity:.1},exit:{opacity:0,position:"absolute",inset:[0,0]},transition:{duration:.2},children:[jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("div",{})]})})]})})}CustomQRCode.displayName="CustomQRCode";const IconContainer$1=styled(motion.div)` +`,generateMatrix=(o,et)=>{const tt=Array.prototype.slice.call(browser$1.create(o,{errorCorrectionLevel:et}).modules.data,0),nt=Math.sqrt(tt.length);return tt.reduce((rt,ot,it)=>(it%nt===0?rt.push([ot]):rt[rt.length-1].push(ot))&&rt,[])};function QRCode$1({ecl:o="M",size:et=200,uri:tt,clearArea:nt=!1,image:rt,imageBackground:ot="transparent"}){const it=nt?76:0,st=et-10*2,at=reactExports.useMemo(()=>{const ct=[],lt=generateMatrix(tt,o),dt=st/lt.length;if([{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:yt,y:gt})=>{const xt=(lt.length-7)*dt*yt,vt=(lt.length-7)*dt*gt;for(let bt=0;bt<3;bt++)ct.push(jsxRuntimeExports.jsx("rect",{fill:bt%2!==0?"var(--ck-qr-background, var(--ck-body-background))":"var(--ck-qr-dot-color)",rx:(bt-2)*-5+(bt===0?2:3),ry:(bt-2)*-5+(bt===0?2:3),width:dt*(7-bt*2),height:dt*(7-bt*2),x:xt+dt*bt,y:vt+dt*bt},`${bt}-${yt}-${gt}`))}),rt){const yt=(lt.length-7)*dt*1,gt=(lt.length-7)*dt*1;ct.push(jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("rect",{fill:ot,rx:-2*-5+2,ry:-2*-5+2,width:dt*(7-0*2),height:dt*(7-0*2),x:yt+dt*0,y:gt+dt*0}),jsxRuntimeExports.jsx("foreignObject",{width:dt*(7-0*2),height:dt*(7-0*2),x:yt+dt*0,y:gt+dt*0,children:jsxRuntimeExports.jsx("div",{style:{borderRadius:-2*-5+2,overflow:"hidden"},children:rt})})]}))}const ft=Math.floor((it+25)/dt),mt=lt.length/2-ft/2,pt=lt.length/2+ft/2-1;return lt.forEach((yt,gt)=>{yt.forEach((xt,vt)=>{lt[gt][vt]&&(gt<7&&vt<7||gt>lt.length-8&&vt<7||gt<7&&vt>lt.length-8||(rt||!(gt>mt&>mt&&vt{function tt(){et({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",tt),tt(),()=>window.removeEventListener("resize",tt)},[]),o}function CustomQRCode({value:o,image:et,imageBackground:tt,imagePosition:nt="center",tooltipMessage:rt}){const it=useWindowSize().width>920&&rt?jsxRuntimeExports.jsx(Tooltip,{xOffset:139,yOffset:5,delay:.1,message:rt,children:et}):et;return jsxRuntimeExports.jsx(QRCodeContainer,{children:jsxRuntimeExports.jsxs(QRCodeContent,{children:[et&&jsxRuntimeExports.jsx(LogoContainer$2,{children:jsxRuntimeExports.jsx(LogoIcon,{$wcLogo:nt!=="center",style:{background:nt==="center"?tt:void 0},children:it})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:o?jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute",inset:[0,0]},transition:{duration:.2},children:jsxRuntimeExports.jsx(QRCode$1,{uri:o,size:288,ecl:"M",clearArea:!!(nt==="center"&&et)})},o):jsxRuntimeExports.jsxs(QRPlaceholder,{initial:{opacity:.1},animate:{opacity:.1},exit:{opacity:0,position:"absolute",inset:[0,0]},transition:{duration:.2},children:[jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("div",{})]})})]})})}CustomQRCode.displayName="CustomQRCode";const IconContainer$1=styled(motion.div)` position: relative; display: flex; align-items: center; @@ -2896,7 +2896,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C max-width: 100%; height: auto; } -`,ScanIconWithLogos=({logo:o})=>{const et=[jsxRuntimeExports.jsx(Logos.MetaMask,{background:!0}),jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),jsxRuntimeExports.jsx(Logos.Crypto,{}),jsxRuntimeExports.jsx(Logos.ImToken,{}),jsxRuntimeExports.jsx(Logos.Argent,{}),jsxRuntimeExports.jsx(Logos.Trust,{})];return jsxRuntimeExports.jsx(IconContainer$1,{children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"47",height:"52",viewBox:"0 0 47 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{mask:"url(#gradient-mask)",children:[jsxRuntimeExports.jsx("path",{d:"M7 14.5C7 11.4624 9.46243 9 12.5 9H31.5C34.5376 9 37 11.4624 37 14.5V47H7V14.5Z",fill:"var(--ck-graphic-scaniconwithlogos-04)"}),o?jsxRuntimeExports.jsx("foreignObject",{x:"13",y:"21",width:"18",height:"18",rx:"5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:5},children:o})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"15",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[0]})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"15",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[1]})}),jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"26",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[2]})})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"26",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[3]})}),jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"37",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[4]})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"37",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[5]})})]}),jsxRuntimeExports.jsx("path",{d:"M36 47V13.7143C36 11.1107 33.8893 9 31.2857 9H12.7143C10.1107 9 8 11.1107 8 13.7143V47",stroke:"url(#paint0_linear_924_12568)",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M15 10H29C29 11.1046 28.1046 12 27 12H17C15.8954 12 15 11.1046 15 10Z",fill:"var(--ck-graphic-scaniconwithlogos-01)"}),jsxRuntimeExports.jsx("rect",{x:"1",y:"47",width:"43",height:"5",fill:"var(--ck-tooltip-background)"}),jsxRuntimeExports.jsx("rect",{x:"22",y:"1",width:"24",height:"24",rx:"12",fill:"var(--ck-graphic-scaniconwithlogos-03)",stroke:"var(--ck-tooltip-background)",strokeWidth:"2"}),jsxRuntimeExports.jsx("rect",{x:"34.5",y:"10",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"31",y:"10",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"31",y:"13.5",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"34.5",y:"13.5",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("path",{d:"M28.5 10.5V9C28.5 8.17157 29.1716 7.5 30 7.5H31.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M36.5 7.5L38 7.5C38.8284 7.5 39.5 8.17157 39.5 9L39.5 10.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M39.5 15.5L39.5 17C39.5 17.8284 38.8284 18.5 38 18.5L36.5 18.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M31.5 18.5L30 18.5C29.1716 18.5 28.5 17.8284 28.5 17L28.5 15.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_924_12568",x1:"22",y1:"8.2549",x2:"22",y2:"47",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-scaniconwithlogos-01)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-scaniconwithlogos-02)"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"linear-gradient-mask",x1:"47",y1:"42",x2:"47",y2:"47",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"black",stopOpacity:"0"})]}),jsxRuntimeExports.jsx("mask",{id:"gradient-mask",children:jsxRuntimeExports.jsx("rect",{x:"0",y:"0",width:"47",height:"52",fill:"url(#linear-gradient-mask)"})})]})]})})},ConnectWithQRCode=({switchConnectMethod:o})=>{var et,tt,nt,rt,ot,it,st,at;const ct=useContext(),lt=ct.connector.id,dt=useWallet(ct.connector.id),{open:ht,isOpen:pt}=useWalletConnectModal(),{connect:{getUri:mt}}=useWeb3(),ft=mt(lt),yt=ft?(tt=(et=dt==null?void 0:dt.getWalletConnectDeeplink)===null||et===void 0?void 0:et.call(dt,ft))!==null&&tt!==void 0?tt:ft:void 0,gt=useLocales({CONNECTORNAME:dt==null?void 0:dt.name});if(!dt)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:["Wallet not found ",ct.connector.id]});const xt=dt==null?void 0:dt.downloadUrls,vt={chrome:xt==null?void 0:xt.chrome,firefox:xt==null?void 0:xt.firefox,brave:xt==null?void 0:xt.brave,edge:xt==null?void 0:xt.edge,safari:xt==null?void 0:xt.safari};detectBrowser();const bt=xt&&Object.keys(xt).length!==0;vt&&(Object.keys(vt)[0],((nt=Object.keys(vt)[0])===null||nt===void 0?void 0:nt.charAt(0).toUpperCase())+((rt=Object.keys(vt)[0])===null||rt===void 0?void 0:rt.slice(1)),vt[Object.keys(vt)[0]]);const Et=isWalletConnectConnector(lt);return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:8,gap:14},children:[jsxRuntimeExports.jsx(CustomQRCode,{value:yt,image:dt==null?void 0:dt.icon,tooltipMessage:isWalletConnectConnector(lt)?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScanIconWithLogos,{}),jsxRuntimeExports.jsx("span",{children:gt.scanScreen_tooltip_walletConnect})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScanIconWithLogos,{logo:dt==null?void 0:dt.icon}),jsxRuntimeExports.jsx("span",{children:gt.scanScreen_tooltip_default})]})}),Et?jsxRuntimeExports.jsx(OrDivider,{}):bt&&jsxRuntimeExports.jsx(OrDivider,{children:gt.dontHaveTheApp})]}),Et&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:14},children:[((ot=ct.options)===null||ot===void 0?void 0:ot.walletConnectCTA)!=="modal"&&jsxRuntimeExports.jsx(CopyToClipboard,{variant:"button",string:yt,children:((it=ct.options)===null||it===void 0?void 0:it.walletConnectCTA)==="link"?gt.copyToClipboard:gt.copyCode}),((st=ct.options)===null||st===void 0?void 0:st.walletConnectCTA)!=="link"&&jsxRuntimeExports.jsx(Button$1,{icon:jsxRuntimeExports.jsx(ExternalLinkIcon,{}),onClick:ht,disabled:pt,waiting:pt,children:((at=ct.options)===null||at===void 0?void 0:at.walletConnectCTA)==="modal"?gt.useWalletConnectModal:gt.useModal})]}),bt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Button$1,{onClick:()=>{ct.setRoute(routes.DOWNLOAD)},download:!0,children:gt.getWalletName})})]})},states={QRCODE:"qrcode",INJECTOR:"injector"},ConnectUsing=()=>{const o=useContext(),et=useWallet(o.connector.id),tt=!(et!=null&&et.isInstalled)&&(et==null?void 0:et.getWalletConnectDeeplink),[nt,rt]=reactExports.useState(tt?states.QRCODE:states.INJECTOR);return reactExports.useEffect(()=>{const ot=async()=>{await(et==null?void 0:et.connector.getProvider())||(rt(states.QRCODE),setTimeout(o.triggerResize,10))};nt===states.INJECTOR&&ot()},[]),et?jsxRuntimeExports.jsxs(AnimatePresence,{children:[nt===states.QRCODE&&jsxRuntimeExports.jsx(motion.div,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$2,children:jsxRuntimeExports.jsx(ConnectWithQRCode,{switchConnectMethod:ot=>{rt(states.INJECTOR)}})},states.QRCODE),nt===states.INJECTOR&&jsxRuntimeExports.jsx(motion.div,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$2,children:jsxRuntimeExports.jsx(ConnectWithInjector,{switchConnectMethod:ot=>{rt(states.QRCODE)}})},states.INJECTOR)]}):jsxRuntimeExports.jsxs(Alert,{children:["Connector not found ",o.connector.id]})},DownloadApp=()=>{var o,et,tt;const nt=useContext(),rt=useWallet(nt.connector.id),ot=useLocales({CONNECTORNAME:rt==null?void 0:rt.name});if(!rt)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"Wallet not found"});const it={ios:(o=rt.downloadUrls)===null||o===void 0?void 0:o.ios,android:(et=rt.downloadUrls)===null||et===void 0?void 0:et.android,redirect:(tt=rt.downloadUrls)===null||tt===void 0?void 0:tt.download},st=it.ios&&it.android?ot.downloadAppScreen_iosAndroid:it.ios?ot.downloadAppScreen_ios:ot.downloadAppScreen_android;return jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:4,gap:14},children:[it.redirect&&jsxRuntimeExports.jsx(CustomQRCode,{value:it.redirect}),!it.redirect&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"No download link available"}),jsxRuntimeExports.jsx(ModalBody,{style:{fontSize:15,lineHeight:"20px",padding:"0 12px"},children:st})]})})},AvatarContainer=styled(motion.div)` +`,ScanIconWithLogos=({logo:o})=>{const et=[jsxRuntimeExports.jsx(Logos.MetaMask,{background:!0}),jsxRuntimeExports.jsx(Logos.Coinbase,{background:!0}),jsxRuntimeExports.jsx(Logos.Crypto,{}),jsxRuntimeExports.jsx(Logos.ImToken,{}),jsxRuntimeExports.jsx(Logos.Argent,{}),jsxRuntimeExports.jsx(Logos.Trust,{})];return jsxRuntimeExports.jsx(IconContainer$1,{children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"47",height:"52",viewBox:"0 0 47 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{mask:"url(#gradient-mask)",children:[jsxRuntimeExports.jsx("path",{d:"M7 14.5C7 11.4624 9.46243 9 12.5 9H31.5C34.5376 9 37 11.4624 37 14.5V47H7V14.5Z",fill:"var(--ck-graphic-scaniconwithlogos-04)"}),o?jsxRuntimeExports.jsx("foreignObject",{x:"13",y:"21",width:"18",height:"18",rx:"5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:5},children:o})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"15",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[0]})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"15",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[1]})}),jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"26",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[2]})})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"26",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[3]})}),jsxRuntimeExports.jsx("foreignObject",{x:"12",y:"37",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[4]})}),jsxRuntimeExports.jsx("foreignObject",{x:"23",y:"37",width:"9",height:"9",rx:"2.5",children:jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",borderRadius:2.5},children:et[5]})})]}),jsxRuntimeExports.jsx("path",{d:"M36 47V13.7143C36 11.1107 33.8893 9 31.2857 9H12.7143C10.1107 9 8 11.1107 8 13.7143V47",stroke:"url(#paint0_linear_924_12568)",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M15 10H29C29 11.1046 28.1046 12 27 12H17C15.8954 12 15 11.1046 15 10Z",fill:"var(--ck-graphic-scaniconwithlogos-01)"}),jsxRuntimeExports.jsx("rect",{x:"1",y:"47",width:"43",height:"5",fill:"var(--ck-tooltip-background)"}),jsxRuntimeExports.jsx("rect",{x:"22",y:"1",width:"24",height:"24",rx:"12",fill:"var(--ck-graphic-scaniconwithlogos-03)",stroke:"var(--ck-tooltip-background)",strokeWidth:"2"}),jsxRuntimeExports.jsx("rect",{x:"34.5",y:"10",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"31",y:"10",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"31",y:"13.5",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("rect",{x:"34.5",y:"13.5",width:"2.5",height:"2.5",rx:"0.75",fill:"#373737"}),jsxRuntimeExports.jsx("path",{d:"M28.5 10.5V9C28.5 8.17157 29.1716 7.5 30 7.5H31.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M36.5 7.5L38 7.5C38.8284 7.5 39.5 8.17157 39.5 9L39.5 10.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M39.5 15.5L39.5 17C39.5 17.8284 38.8284 18.5 38 18.5L36.5 18.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M31.5 18.5L30 18.5C29.1716 18.5 28.5 17.8284 28.5 17L28.5 15.5",stroke:"#373737",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_924_12568",x1:"22",y1:"8.2549",x2:"22",y2:"47",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-scaniconwithlogos-01)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-scaniconwithlogos-02)"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"linear-gradient-mask",x1:"47",y1:"42",x2:"47",y2:"47",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"black",stopOpacity:"0"})]}),jsxRuntimeExports.jsx("mask",{id:"gradient-mask",children:jsxRuntimeExports.jsx("rect",{x:"0",y:"0",width:"47",height:"52",fill:"url(#linear-gradient-mask)"})})]})]})})},ConnectWithQRCode=({switchConnectMethod:o})=>{var et,tt,nt,rt,ot,it,st,at;const ct=useContext(),lt=ct.connector.id,dt=useWallet(ct.connector.id),{open:ht,isOpen:ft}=useWalletConnectModal(),{connect:{getUri:mt}}=useWeb3(),pt=mt(lt),yt=pt?(tt=(et=dt==null?void 0:dt.getWalletConnectDeeplink)===null||et===void 0?void 0:et.call(dt,pt))!==null&&tt!==void 0?tt:pt:void 0,gt=useLocales({CONNECTORNAME:dt==null?void 0:dt.name});if(!dt)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:["Wallet not found ",ct.connector.id]});const xt=dt==null?void 0:dt.downloadUrls,vt={chrome:xt==null?void 0:xt.chrome,firefox:xt==null?void 0:xt.firefox,brave:xt==null?void 0:xt.brave,edge:xt==null?void 0:xt.edge,safari:xt==null?void 0:xt.safari};detectBrowser();const bt=xt&&Object.keys(xt).length!==0;vt&&(Object.keys(vt)[0],((nt=Object.keys(vt)[0])===null||nt===void 0?void 0:nt.charAt(0).toUpperCase())+((rt=Object.keys(vt)[0])===null||rt===void 0?void 0:rt.slice(1)),vt[Object.keys(vt)[0]]);const Et=isWalletConnectConnector(lt);return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:8,gap:14},children:[jsxRuntimeExports.jsx(CustomQRCode,{value:yt,image:dt==null?void 0:dt.icon,tooltipMessage:isWalletConnectConnector(lt)?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScanIconWithLogos,{}),jsxRuntimeExports.jsx("span",{children:gt.scanScreen_tooltip_walletConnect})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScanIconWithLogos,{logo:dt==null?void 0:dt.icon}),jsxRuntimeExports.jsx("span",{children:gt.scanScreen_tooltip_default})]})}),Et?jsxRuntimeExports.jsx(OrDivider,{}):bt&&jsxRuntimeExports.jsx(OrDivider,{children:gt.dontHaveTheApp})]}),Et&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:14},children:[((ot=ct.options)===null||ot===void 0?void 0:ot.walletConnectCTA)!=="modal"&&jsxRuntimeExports.jsx(CopyToClipboard,{variant:"button",string:yt,children:((it=ct.options)===null||it===void 0?void 0:it.walletConnectCTA)==="link"?gt.copyToClipboard:gt.copyCode}),((st=ct.options)===null||st===void 0?void 0:st.walletConnectCTA)!=="link"&&jsxRuntimeExports.jsx(Button$1,{icon:jsxRuntimeExports.jsx(ExternalLinkIcon,{}),onClick:ht,disabled:ft,waiting:ft,children:((at=ct.options)===null||at===void 0?void 0:at.walletConnectCTA)==="modal"?gt.useWalletConnectModal:gt.useModal})]}),bt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Button$1,{onClick:()=>{ct.setRoute(routes.DOWNLOAD)},download:!0,children:gt.getWalletName})})]})},states={QRCODE:"qrcode",INJECTOR:"injector"},ConnectUsing=()=>{const o=useContext(),et=useWallet(o.connector.id),tt=!(et!=null&&et.isInstalled)&&(et==null?void 0:et.getWalletConnectDeeplink),[nt,rt]=reactExports.useState(tt?states.QRCODE:states.INJECTOR);return reactExports.useEffect(()=>{const ot=async()=>{await(et==null?void 0:et.connector.getProvider())||(rt(states.QRCODE),setTimeout(o.triggerResize,10))};nt===states.INJECTOR&&ot()},[]),et?jsxRuntimeExports.jsxs(AnimatePresence,{children:[nt===states.QRCODE&&jsxRuntimeExports.jsx(motion.div,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$2,children:jsxRuntimeExports.jsx(ConnectWithQRCode,{switchConnectMethod:ot=>{rt(states.INJECTOR)}})},states.QRCODE),nt===states.INJECTOR&&jsxRuntimeExports.jsx(motion.div,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$2,children:jsxRuntimeExports.jsx(ConnectWithInjector,{switchConnectMethod:ot=>{rt(states.QRCODE)}})},states.INJECTOR)]}):jsxRuntimeExports.jsxs(Alert,{children:["Connector not found ",o.connector.id]})},DownloadApp=()=>{var o,et,tt;const nt=useContext(),rt=useWallet(nt.connector.id),ot=useLocales({CONNECTORNAME:rt==null?void 0:rt.name});if(!rt)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"Wallet not found"});const it={ios:(o=rt.downloadUrls)===null||o===void 0?void 0:o.ios,android:(et=rt.downloadUrls)===null||et===void 0?void 0:et.android,redirect:(tt=rt.downloadUrls)===null||tt===void 0?void 0:tt.download},st=it.ios&&it.android?ot.downloadAppScreen_iosAndroid:it.ios?ot.downloadAppScreen_ios:ot.downloadAppScreen_android;return jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:4,gap:14},children:[it.redirect&&jsxRuntimeExports.jsx(CustomQRCode,{value:it.redirect}),!it.redirect&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"No download link available"}),jsxRuntimeExports.jsx(ModalBody,{style:{fontSize:15,lineHeight:"20px",padding:"0 12px"},children:st})]})})},AvatarContainer=styled(motion.div)` padding: 18px 0 20px; @media only screen and (max-width: ${defaultTheme.mobileWidth}px) { padding: 16px 0 20px; @@ -2975,7 +2975,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C will-change: opacity; // Needed for Safari transition: opacity 500ms ease; transform: scale(1.01); // fixes background color bleeding -`;function useIsMounted(){const[o,et]=reactExports.useState(!1);return reactExports.useEffect(()=>et(!0),[]),o}const ensFallbackConfig=createConfig({chains:[mainnet],transports:{[mainnet.id]:http()}});function useEnsFallbackConfig(){return useChainIsSupported(1)?void 0:ensFallbackConfig}const Avatar=({address:o,name:et,size:tt=96,radius:nt=96})=>{var rt,ot,it;const st=useIsMounted(),at=useContext(),ct=reactExports.useRef(null),[lt,dt]=reactExports.useState(!0),ht=useEnsFallbackConfig(),{data:pt}=useEnsAddress({chainId:1,name:et,config:ht}),{data:mt}=useEnsName({chainId:1,address:(rt=o??pt)!==null&&rt!==void 0?rt:void 0,config:ht}),{data:ft}=useEnsAvatar({chainId:1,name:normalize$2(mt??""),config:ht}),yt={address:pt??o,name:mt??et,avatar:ft??void 0};return reactExports.useEffect(()=>{ct.current&&ct.current.complete&&ct.current.naturalHeight!==0||dt(!1)},[ft]),st?!((ot=at.options)===null||ot===void 0)&&ot.customAvatar?jsxRuntimeExports.jsx("div",{style:{width:tt,height:tt,borderRadius:nt,overflow:"hidden"},children:(it=at.options)===null||it===void 0?void 0:it.customAvatar({address:o??(yt==null?void 0:yt.address),ensName:et??(yt==null?void 0:yt.name),ensImage:yt==null?void 0:yt.avatar,size:tt,radius:nt})}):!yt.name||!yt.avatar?jsxRuntimeExports.jsx(ResetContainer,{style:{pointerEvents:"none"},children:jsxRuntimeExports.jsx(EnsAvatar,{$size:tt,$seed:yt.address,$radius:nt})}):jsxRuntimeExports.jsx(ResetContainer,{style:{pointerEvents:"none"},children:jsxRuntimeExports.jsx(EnsAvatar,{$size:tt,$seed:yt.address,$radius:nt,children:jsxRuntimeExports.jsx(ImageContainer,{ref:ct,src:yt.avatar,alt:yt.name,onLoad:()=>dt(!0),$loaded:lt})})}):jsxRuntimeExports.jsx("div",{style:{width:tt,height:tt,borderRadius:nt}})},KnownChain=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"black"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),UnknownChain=({testnet:o,...et})=>jsxRuntimeExports.jsx(KnownChain,{testnet:!0,...et}),Ethereum=({testnet:o,...et})=>{let tt="var(--ck-chain-ethereum-01, #25292E)",nt="var(--ck-chain-ethereum-02, #ffffff)";return o&&(tt="linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)",nt="#fff"),jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:tt},children:[jsxRuntimeExports.jsx("path",{d:"M21.9967 6.99621L21.7955 7.67987V27.5163L21.9967 27.7171L31.2044 22.2744L21.9967 6.99621Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M21.9957 6.99621L12.7878 22.2744L21.9957 27.7171V18.0891V6.99621Z",fill:nt}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.9959 36.9996L21.9959 36.9997V36.9995L31.2091 24.0243L21.9959 29.4642L12.788 24.0243L21.9957 36.9993L21.9958 36.9997L21.9959 36.9996Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M21.996 27.7181L31.2037 22.2753L21.996 18.09V27.7181Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M12.7878 22.2753L21.9957 27.7181V18.09L12.7878 22.2753Z",fill:nt})]})},Polygon=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#6F41D8"},children:jsxRuntimeExports.jsx("path",{d:"M29.0015 17.4529C28.4941 17.1572 27.8355 17.1572 27.2773 17.4529L23.3186 19.7271L20.6305 21.2094L16.6719 23.4822C16.1645 23.7792 15.5059 23.7792 14.9476 23.4822L11.8016 21.703C11.2943 21.4074 10.9395 20.8642 10.9395 20.2702V16.7612C10.9395 16.1686 11.2434 15.6255 11.8016 15.3285L14.8954 13.5988C15.4041 13.3018 16.0641 13.3018 16.6224 13.5988L19.7161 15.3285C20.2249 15.6255 20.5796 16.1686 20.5796 16.7612V19.0355L23.2678 17.5024V15.2295C23.2707 14.9343 23.1917 14.6441 23.0395 14.3911C22.8873 14.1381 22.6679 13.9324 22.4056 13.7968L16.6719 10.5353C16.1645 10.2382 15.5059 10.2382 14.9476 10.5353L9.11214 13.7968C8.84992 13.9324 8.63049 14.1381 8.47828 14.3911C8.32607 14.6441 8.24705 14.9343 8.25002 15.2295V21.802C8.25002 22.396 8.55389 22.9391 9.11214 23.2361L14.9476 26.4976C15.455 26.7932 16.115 26.7932 16.6719 26.4976L20.6305 24.2729L23.3186 22.7411L27.2773 20.5177C27.7846 20.2207 28.4433 20.2207 29.0015 20.5177L32.0966 22.2475C32.6054 22.5431 32.9588 23.0863 32.9588 23.6803V27.1893C32.9588 27.7819 32.6563 28.325 32.0966 28.622L29.0029 30.4013C28.4941 30.6983 27.8341 30.6983 27.2773 30.4013L24.1821 28.6715C23.6734 28.3745 23.3186 27.8314 23.3186 27.2387V24.9645L20.6305 26.4976V28.7705C20.6305 29.3631 20.9344 29.9076 21.4926 30.2032L27.3281 33.4647C27.8355 33.7617 28.4941 33.7617 29.0524 33.4647L34.8879 30.2032C35.3953 29.9076 35.75 29.3645 35.75 28.7705V22.198C35.753 21.9028 35.674 21.6126 35.5218 21.3596C35.3695 21.1066 35.1501 20.9009 34.8879 20.7653L29.0029 17.4529H29.0015Z",fill:"white"})}),Optimism=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#FF0420"},children:[jsxRuntimeExports.jsx("path",{d:"M15.5877 27.8473C14.2777 27.8473 13.2045 27.539 12.3679 26.9226C11.5422 26.2952 11.1294 25.4035 11.1294 24.2477C11.1294 24.0055 11.157 23.7082 11.212 23.356C11.3552 22.5634 11.5588 21.6112 11.823 20.4994C12.5715 17.4722 14.5034 15.9586 17.6187 15.9586C18.4664 15.9586 19.2259 16.1017 19.8974 16.3879C20.5689 16.663 21.0973 17.0814 21.4826 17.6428C21.8678 18.1932 22.0605 18.8537 22.0605 19.6242C22.0605 19.8554 22.033 20.1471 21.9779 20.4994C21.8128 21.4791 21.6146 22.4313 21.3835 23.356C20.9982 24.8641 20.3322 25.9924 19.3855 26.741C18.4388 27.4785 17.1729 27.8473 15.5877 27.8473ZM15.8189 25.4695C16.4354 25.4695 16.9582 25.2879 17.3876 24.9247C17.8279 24.5614 18.1416 24.0055 18.3287 23.257C18.5819 22.2222 18.7746 21.3195 18.9067 20.5489C18.9507 20.3178 18.9727 20.0811 18.9727 19.8389C18.9727 18.8372 18.4498 18.3363 17.4041 18.3363C16.7876 18.3363 16.2592 18.5179 15.8189 18.8812C15.3896 19.2445 15.0813 19.8004 14.8943 20.5489C14.6961 21.2865 14.4979 22.1892 14.2998 23.257C14.2557 23.477 14.2337 23.7082 14.2337 23.9504C14.2337 24.9632 14.7622 25.4695 15.8189 25.4695Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M22.8188 27.6815C22.6977 27.6815 22.6041 27.6429 22.5381 27.5659C22.483 27.4778 22.4665 27.3788 22.4885 27.2687L24.7672 16.5358C24.7892 16.4147 24.8498 16.3156 24.9489 16.2385C25.0479 16.1615 25.1525 16.1229 25.2626 16.1229H29.6548C30.8767 16.1229 31.8564 16.3761 32.5939 16.8825C33.3426 17.3889 33.7168 18.1209 33.7168 19.0786C33.7168 19.3538 33.6838 19.64 33.6177 19.9372C33.3426 21.2032 32.7867 22.1389 31.95 22.7443C31.1244 23.3498 29.9905 23.6525 28.5485 23.6525H26.3194L25.5598 27.2687C25.5377 27.3898 25.4772 27.4888 25.3782 27.5659C25.2791 27.6429 25.1745 27.6815 25.0645 27.6815H22.8188ZM28.6641 21.3738C29.1264 21.3738 29.5282 21.2472 29.8695 20.994C30.2217 20.7408 30.4529 20.3776 30.563 19.9042C30.596 19.717 30.6125 19.552 30.6125 19.4089C30.6125 19.0896 30.519 18.8474 30.3318 18.6823C30.1446 18.5062 29.8255 18.4182 29.3741 18.4182H27.3926L26.7652 21.3738H28.6641Z",fill:"white"})]}),Arbitrum=({testnet:o,...et})=>{const tt=o?"#ffffff":"#28A0F0",nt=o?"#ffffff":"#96BEDC";return jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2C364F"},children:[!o&&jsxRuntimeExports.jsx("path",{d:"M25.7948 20.5826L28.2683 16.3854L34.9355 26.7696L34.9386 28.7625L34.9168 15.0491C34.9011 14.7137 34.7231 14.407 34.4391 14.2261L22.4357 7.32182C22.1551 7.1838 21.7989 7.18546 21.5187 7.32618C21.4807 7.34524 21.4453 7.36576 21.4113 7.38835L21.3694 7.41467L9.71816 14.1664L9.67298 14.1871C9.61474 14.2137 9.55609 14.2479 9.50076 14.2872C9.27983 14.4456 9.1331 14.68 9.08564 14.9425C9.07859 14.9823 9.0732 15.023 9.07092 15.064L9.08916 26.239L15.2994 16.6138C16.0811 15.3376 17.7847 14.9262 19.3662 14.9488L21.2221 14.9977L10.2862 32.5356L11.5753 33.2778L22.6422 15.0155L27.5338 14.9977L16.4956 33.7209L21.0955 36.3668L21.6451 36.6827C21.8776 36.7772 22.1516 36.7819 22.386 36.6972L34.5581 29.6433L32.2309 30.9918L25.7948 20.5826ZM26.7384 34.175L22.0925 26.8829L24.9287 22.0702L31.0303 31.6876L26.7384 34.175Z",fill:"#2D374B"}),jsxRuntimeExports.jsx("path",{d:"M22.0924 26.8832L26.7385 34.1751L31.0302 31.6879L24.9286 22.0705L22.0924 26.8832Z",fill:tt}),jsxRuntimeExports.jsx("path",{d:"M34.9387 28.7627L34.9356 26.7698L28.2684 16.3856L25.7949 20.5828L32.2312 30.992L34.5584 29.6435C34.7866 29.4582 34.9248 29.1861 34.9393 28.8926L34.9387 28.7627Z",fill:tt}),jsxRuntimeExports.jsx("path",{d:"M7 30.642L10.2863 32.5356L21.2222 14.9976L19.3663 14.9487C17.785 14.9263 16.0814 15.3375 15.2995 16.6137L9.08927 26.239L7 29.449V30.642V30.642Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M27.534 14.9977L22.6423 15.0155L11.5754 33.2778L15.4437 35.5049L16.4955 33.7209L27.534 14.9977Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M37 14.9723C36.9592 13.9493 36.4052 13.013 35.5377 12.4677L23.377 5.47434C22.5187 5.04223 21.4466 5.04161 20.5868 5.47414C20.4852 5.52533 8.76078 12.3251 8.76078 12.3251C8.5985 12.4029 8.44224 12.4955 8.2953 12.6008C7.52081 13.156 7.0487 14.0186 7 14.9661V29.4492L9.08927 26.2392L9.07103 15.0639C9.07352 15.0231 9.0787 14.9827 9.08575 14.9431C9.133 14.6801 9.27994 14.4457 9.50086 14.2872C9.5562 14.2478 21.4806 7.34517 21.5186 7.32611C21.799 7.18538 22.155 7.18373 22.4356 7.32175L34.439 14.226C34.723 14.4069 34.901 14.7137 34.9167 15.049V28.8921C34.9022 29.1856 34.7862 29.4577 34.558 29.643L32.2308 30.9916L31.03 31.6875L26.7383 34.1747L22.3859 36.6969C22.1515 36.7817 21.8773 36.7769 21.645 36.6824L16.4955 33.7206L15.4435 35.5046L20.0713 38.169C20.2243 38.256 20.3607 38.3331 20.4726 38.3961C20.6458 38.4933 20.764 38.5582 20.8056 38.5785C21.1345 38.7383 21.6077 38.8311 22.0342 38.8311C22.4251 38.8311 22.8064 38.7594 23.1672 38.6181L35.8092 31.2971C36.5347 30.7348 36.9617 29.8869 37 28.9686V14.9723Z",fill:nt})]})},Telos=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#571AFF"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26.1834 8.14754C25.6606 8.23504 25.3644 8.50235 24.9216 9.28591C24.5651 9.91722 24.4762 10.0244 24.2024 10.1592L23.9832 10.2668L19.2967 10.286L14.6097 10.3057L14.3875 10.3902C13.7059 10.6492 13.6192 10.7135 11.6291 12.4407C9.72243 14.0953 9.64893 14.1723 9.59249 14.5836C9.54437 14.9362 9.78981 15.6327 10.5191 17.2143C11.2847 18.8737 11.2839 18.8641 10.7444 19.5256C10.2645 20.1136 10.2269 20.2588 10.2041 21.5915C10.1717 23.502 10.2487 27.6023 10.3222 27.8591C10.3572 27.9816 10.7908 29.204 11.2861 30.5755C11.7813 31.9471 12.4192 33.715 12.704 34.5038C13.4281 36.5107 13.4814 36.5986 14.0392 36.7237C14.3066 36.7837 14.3206 36.781 18.9677 35.7258C24.4395 34.4837 23.7264 34.709 25.0739 33.7968C29.8732 30.5475 29.7337 30.66 29.8969 29.9083C30.0583 29.1642 30.1082 29.1379 31.8267 28.8999C34.6122 28.5145 34.6328 28.5083 34.8831 28.0109C35.0182 27.7423 35.7786 23.3406 35.8136 22.6209C35.8504 21.8828 36.042 22.221 33.3816 18.3395C30.022 13.4382 30.2381 13.7777 30.2399 13.4041C30.2407 13.1735 30.3366 12.9736 31.3236 11.1418C31.8236 10.2134 32.2742 9.35241 32.3254 9.22904C32.5236 8.74691 32.4204 8.3921 32.0301 8.21622L31.8267 8.12391L29.1102 8.11822C27.6048 8.11516 26.2997 8.12829 26.1834 8.14754ZM30.0474 9.4876C30.5623 9.72297 30.5382 9.82447 29.5119 11.7398C28.4317 13.7558 28.3157 13.2711 30.7154 16.7707C31.639 18.1173 32.8076 19.8218 33.3124 20.5581C34.6844 22.5592 34.6048 22.1799 34.1831 24.6903C33.7858 27.0602 33.7792 27.0817 33.3759 27.282C33.1506 27.394 33.2276 27.3813 30.8493 27.7117C28.9147 27.9803 28.8543 28.017 28.6719 29.0338C28.5778 29.557 28.4606 29.8169 28.2243 30.0247C28.0808 30.1512 24.8682 32.368 23.9451 32.9778C23.2587 33.4311 23.6861 33.3152 17.7471 34.6574C17.1997 34.7812 16.4079 34.9632 15.987 35.0617C14.4588 35.4195 14.4299 35.4033 13.8804 33.8948C12.9188 31.2528 11.6811 27.7957 11.6194 27.5787C11.5534 27.3463 11.549 27.1202 11.549 24.059V20.7878L11.6501 20.5966C11.7056 20.4912 11.8671 20.2759 12.0088 20.118C12.8418 19.19 12.8383 19.1183 11.8601 16.9907C10.7663 14.612 10.6797 14.9992 12.697 13.2501C14.2418 11.91 14.3048 11.8593 14.5905 11.7237L14.8394 11.6055L19.6983 11.5854C23.5417 11.5692 24.5891 11.5543 24.7103 11.515C25.1465 11.3728 25.4086 11.1094 25.7975 10.4203C26.3851 9.38041 26.3111 9.40797 28.4597 9.41891C29.6996 9.42547 29.9332 9.43554 30.0474 9.4876Z",fill:"#F7F5FC"})}),Aurora=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#6CD544"},children:jsxRuntimeExports.jsx("path",{d:"M22.0006 7.292C22.6198 7.29004 23.2271 7.46144 23.754 7.7868C24.2808 8.11216 24.706 8.57848 24.9816 9.133L34.3566 27.883C34.611 28.3912 34.7312 28.956 34.7058 29.5238C34.6805 30.0915 34.5103 30.6433 34.2116 31.1268C33.9129 31.6103 33.4956 32.0094 32.9992 32.2861C32.5028 32.5629 31.9439 32.7081 31.3756 32.708H12.6256C12.0573 32.7079 11.4985 32.5626 11.0023 32.2858C10.506 32.009 10.0888 31.6099 9.79022 31.1264C9.49163 30.6429 9.3216 30.0912 9.29628 29.5235C9.27096 28.9558 9.39119 28.3911 9.64556 27.883L19.0196 9.133C19.2951 8.57848 19.7203 8.11216 20.2472 7.7868C20.774 7.46144 21.3814 7.29004 22.0006 7.292ZM22.0006 5C20.9561 4.9999 19.9322 5.29059 19.0437 5.83952C18.1551 6.38846 17.4369 7.17394 16.9696 8.108L7.59456 26.858C7.16544 27.7156 6.96271 28.6687 7.00564 29.6268C7.04856 30.5848 7.33572 31.516 7.83982 32.3318C8.34392 33.1476 9.04823 33.821 9.88584 34.288C10.7235 34.755 11.6666 35.0001 12.6256 35H31.3756C32.3345 34.9999 33.2775 34.7547 34.1149 34.2876C34.9524 33.8206 35.6566 33.1472 36.1606 32.3314C36.6645 31.5156 36.9516 30.5845 36.9945 29.6265C37.0374 28.6686 36.8346 27.7156 36.4056 26.858L27.0316 8.108C26.5642 7.17394 25.846 6.38846 24.9574 5.83952C24.0689 5.29059 23.045 4.9999 22.0006 5Z",fill:"white"})}),Avalanche=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#E84142"},children:[jsxRuntimeExports.jsx("path",{d:"M11.0188 32.1528H15.4825C16.5334 32.1528 17.0589 32.1528 17.5278 32.023C18.042 31.8701 18.511 31.5991 18.9009 31.2261C19.2589 30.885 19.5173 30.4328 20.0269 29.5409L20.0272 29.5404L20.0422 29.5142L25.8314 19.2804C26.3456 18.3821 26.5999 17.93 26.7129 17.4554C26.8372 16.9412 26.8372 16.3988 26.7129 15.8847C26.6007 15.4136 26.3439 14.9648 25.8373 14.0798L25.8258 14.0597L23.56 10.1045C23.0911 9.27958 22.8538 8.86711 22.5543 8.71456C22.2323 8.55071 21.848 8.55071 21.526 8.71456C21.2265 8.86711 20.9892 9.27958 20.5202 10.1045L9.49892 29.5311C9.03561 30.3447 8.80392 30.7517 8.82089 31.0849C8.84349 31.4466 9.02994 31.7743 9.33507 31.9721C9.61756 32.1528 10.0809 32.1528 11.0188 32.1528Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M33.1506 32.1528H26.7547C25.8111 32.1528 25.3365 32.1528 25.0596 31.9721C24.7545 31.7743 24.5681 31.4411 24.5455 31.0794C24.5286 30.7486 24.7621 30.3456 25.2294 29.539L25.2295 29.5388L25.2404 29.5199L28.4328 24.0392C28.9018 23.2313 29.1391 22.8301 29.4329 22.6776C29.7548 22.5137 30.1336 22.5137 30.4555 22.6776C30.7472 22.8261 30.9744 23.2102 31.4241 23.9708L31.4248 23.9719L31.4613 24.0336L34.665 29.5143C34.6806 29.5413 34.696 29.5678 34.7113 29.5939L34.7113 29.594C35.1554 30.3603 35.382 30.7514 35.3657 31.0739C35.3486 31.4353 35.1566 31.7688 34.8515 31.9666C34.5689 32.1528 34.0942 32.1528 33.1506 32.1528Z",fill:"white"})]}),Celo=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#FCFE72"},children:jsxRuntimeExports.jsx("path",{d:"M9 9H34.5183V18.112H30.3564C28.896 14.7687 25.6102 12.4171 21.777 12.4171C16.593 12.4171 12.3948 16.6422 12.3948 21.823C12.3948 27.0039 16.593 31.2654 21.777 31.2654C25.5373 31.2654 28.8231 28.9876 30.2829 25.7172H34.5178V34.682H9V9Z",fill:o?"#ffffff":"black"})}),Gnosis=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#009CB4"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.3439 11.8664C17.9374 6.53462 26.7953 6.74397 32.1271 12.3374C32.4738 12.7038 32.8075 13.0832 33.1084 13.4823L22 24.5972L10.8916 13.4823C11.1991 13.0832 11.5262 12.7038 11.8729 12.3374C12.0234 12.1804 12.1804 12.0234 12.3439 11.8664ZM30.6094 13.3972C28.3196 11.0944 25.271 9.83182 22 9.83182C18.729 9.83182 15.6804 11.0944 13.3907 13.3972L22 22.0066L30.6094 13.3972ZM33.9785 14.7446L31.7215 17.0016C33.5402 19.1801 33.2523 22.425 31.0738 24.2437C29.1636 25.84 26.3897 25.84 24.4794 24.2437L22 26.7231L19.5271 24.2502C17.3486 26.0689 14.1037 25.7811 12.285 23.6026C10.6888 21.6923 10.6888 18.9185 12.285 17.0082L11.1271 15.8502L10.028 14.7446C8.7 16.9297 8 19.4418 8 21.9998C8 29.7325 14.2673 35.9998 22 35.9998C29.7327 35.9998 36 29.7325 36 21.9998C36.0065 19.4418 35.3 16.9297 33.9785 14.7446ZM30.6486 18.0747C31.1392 18.7093 31.4075 19.4943 31.4075 20.299C31.4075 21.1037 31.1392 21.8887 30.6486 22.5233C29.4187 24.113 27.1355 24.4074 25.5458 23.1775L30.6486 18.0747ZM18.4542 23.1839C17.8196 23.6745 17.0346 23.9427 16.2299 23.9427C15.4252 23.9427 14.6467 23.6745 14.0056 23.1904C12.4159 21.9605 12.1215 19.6708 13.3514 18.0811L18.4542 23.1839Z",fill:"white"})}),Evmos=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2D2A25"},children:jsxRuntimeExports.jsx("path",{d:"M18.4916 12.6668C12.9416 14.806 12.4332 20.2846 10.8418 22.8432C9.23155 25.4322 5.54251 26.8607 6.04698 28.1801C6.55143 29.4994 10.2449 28.0824 13.1669 28.9242C16.0543 29.7561 20.0831 33.4862 25.633 31.3469C28.4603 30.2573 30.5076 28.0143 31.449 25.3574C31.5502 25.0723 31.361 24.7673 31.0606 24.7391C30.874 24.7215 30.6948 24.8196 30.6106 24.9877C29.759 26.6908 28.2981 28.0934 26.3864 28.8301C23.2303 30.0465 19.777 29.0915 17.6562 26.6961C17.1746 26.1522 16.7626 25.533 16.4374 24.8487C16.348 24.6603 16.2629 24.4689 16.1875 24.2708C16.1117 24.0728 16.0473 23.8735 15.9881 23.6732C17.6562 22.8925 19.5812 22.0656 21.7635 21.2246C23.903 20.3999 25.8505 19.731 27.5841 19.1958C28.7571 18.8341 29.8322 18.5331 30.8029 18.2871C30.8732 18.2695 30.9423 18.2519 31.0112 18.2347C31.158 18.1982 31.3088 18.2769 31.363 18.4186L31.364 18.4213C31.396 18.5053 31.4236 18.5898 31.4535 18.6743C31.6453 19.2196 31.7892 19.7706 31.8841 20.3229C31.9258 20.5645 32.1888 20.6961 32.4044 20.5799C33.2014 20.1504 33.9302 19.7314 34.5814 19.3283C37.0083 17.8276 38.3538 16.5549 38.0776 15.8336C37.802 15.1119 35.9541 15.0705 33.1503 15.5854C32.2593 15.7491 31.2716 15.9691 30.207 16.2416C30.0229 16.2886 29.8365 16.3375 29.6481 16.3877C28.7522 16.6262 27.8073 16.8995 26.8234 17.2053C24.9936 17.7744 23.0305 18.4561 21.0038 19.2372C19.1078 19.9682 17.3109 20.726 15.6629 21.4812C15.6428 18.2761 17.5725 15.2461 20.7286 14.0297C22.6399 13.293 24.6605 13.3533 26.4285 14.0473C26.6029 14.116 26.8015 14.0684 26.9291 13.9298C27.1331 13.7076 27.0706 13.3537 26.8053 13.2094C24.3353 11.8685 21.319 11.5771 18.4916 12.6668Z",fill:"#FAF1E4"})}),BinanceSmartChain=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#16181A"},children:[jsxRuntimeExports.jsx("path",{d:"M16.0445 19.6063L21.8705 13.7805L27.6996 19.6093L31.0896 16.2193L21.8705 7L12.6545 16.2163L16.0445 19.6063Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M13.6505 21.9995L10.2606 18.6096L6.87046 21.9997L10.2604 25.3896L13.6505 21.9995Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M16.0445 24.3937L21.8705 30.2195L27.6994 24.3909L31.0913 27.779L31.0896 27.7809L21.8705 37L12.6542 27.7839L12.6495 27.7792L16.0445 24.3937Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M33.4808 25.3911L36.8709 22.001L33.481 18.6111L30.0909 22.0012L33.4808 25.3911Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M25.3091 21.9982H25.3105L21.8705 18.5582L19.3283 21.1004H19.3281L19.0362 21.3926L18.4336 21.9951L18.4289 21.9999L18.4336 22.0048L21.8705 25.4418L25.3105 22.0018L25.3122 21.9999L25.3091 21.9982Z",fill:o?"#fff":"#F3BA2F"})]}),Canto=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"white"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35 8V36H9L13.875 35.9998V31.0586H9V12.9412H13.875V8H35ZM17.9373 12.9414H30.1247V17.8826H17.9373V12.9414ZM30.1247 26.9414H17.9373V17.8826L13.0623 17.8828V26.9416L17.9373 26.9414V31.8826H30.1247V26.9414Z",fill:"#06FC99"})}),Fantom=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#0911EF"},children:jsxRuntimeExports.jsx("path",{d:"M20.92 9.25864C21.5933 8.91379 22.6178 8.91379 23.2911 9.25864L30.1616 12.7775C30.5671 12.9852 30.7898 13.2947 30.8297 13.6142H30.8363V31.302C30.8274 31.6504 30.6025 31.9966 30.1616 32.2225L23.2911 35.7413C22.6178 36.0862 21.5933 36.0862 20.92 35.7413L14.0495 32.2225C13.6104 31.9976 13.3997 31.6489 13.3893 31.302C13.3883 31.2678 13.3881 31.2393 13.3891 31.2157L13.3891 13.7278C13.3884 13.7086 13.3883 13.6895 13.3889 13.6705L13.3893 13.6142L13.3924 13.6142C13.4229 13.2912 13.6355 12.9896 14.0495 12.7775L20.92 9.25864ZM29.7547 23.4821L23.2911 26.7926C22.6178 27.1374 21.5933 27.1374 20.92 26.7926L14.4706 23.4895V31.2669L20.92 34.5527C21.2842 34.7415 21.6622 34.9254 22.0318 34.9488L22.1056 34.9512C22.4907 34.9524 22.8646 34.7628 23.2438 34.5833L29.7547 31.2387V23.4821ZM11.3214 31.8437C11.3214 32.5212 11.4026 32.9667 11.5639 33.2806C11.6976 33.5407 11.8981 33.7394 12.2643 33.9813L12.2852 33.9951C12.3656 34.0476 12.4541 34.1026 12.5619 34.1672L12.689 34.2427L13.0792 34.4711L12.5195 35.3685L12.0827 35.1126L12.0093 35.0689C11.883 34.9932 11.7783 34.9284 11.6807 34.8645C10.637 34.1822 10.2478 33.4384 10.2401 31.8907L10.24 31.8437H11.3214ZM21.5647 18.7412C21.5147 18.7579 21.4678 18.7772 21.4251 18.7991L14.5546 22.318C14.5474 22.3216 14.5405 22.3253 14.534 22.3289L14.5281 22.3322L14.5389 22.3382L14.5546 22.3464L21.4251 25.8653C21.4678 25.8872 21.5147 25.9065 21.5647 25.9231V18.7412ZM22.6465 18.7412V25.9231C22.6965 25.9065 22.7433 25.8872 22.7861 25.8653L29.6566 22.3464C29.6638 22.3427 29.6707 22.3391 29.6772 22.3355L29.683 22.3322L29.6722 22.3262L29.6566 22.318L22.7861 18.7991C22.7433 18.7772 22.6965 18.7579 22.6465 18.7412ZM29.7547 14.8689L23.5915 18.0256L29.7547 21.1822V14.8689ZM14.4706 14.8763V21.1749L20.6195 18.0256L14.4706 14.8763ZM22.7861 10.1859C22.4288 10.0029 21.7824 10.0029 21.4251 10.1859L14.5546 13.7048C14.5474 13.7085 14.5405 13.7122 14.534 13.7158L14.5281 13.719L14.5389 13.725L14.5546 13.7333L21.4251 17.2522C21.7824 17.4352 22.4288 17.4352 22.7861 17.2522L29.6566 13.7333C29.6638 13.7296 29.6707 13.7259 29.6772 13.7223L29.683 13.719L29.6722 13.7131L29.6566 13.7048L22.7861 10.1859ZM31.7205 9.64552L32.1573 9.90132L32.2307 9.94503C32.357 10.0206 32.4616 10.0856 32.5593 10.1494C33.603 10.8317 33.9922 11.5756 33.9998 13.1231L34 13.1703H32.9186C32.9186 12.4926 32.8373 12.0472 32.6761 11.7334C32.5424 11.4733 32.3419 11.2745 31.9757 11.0327L31.9547 11.0189C31.8744 10.9664 31.7858 10.9113 31.6781 10.8466L31.551 10.7712L31.1608 10.5428L31.7205 9.64552Z",fill:"white"})}),Filecoin=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#0090FF"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23.75 19.3069L23.15 22.5069L28.85 23.3069L28.45 24.8069L22.85 24.0069C22.45 25.3069 22.25 26.7069 21.75 27.9069C21.25 29.3069 20.75 30.7069 20.15 32.0069C19.35 33.7069 17.95 34.9069 16.05 35.2069C14.95 35.4069 13.75 35.3069 12.85 34.6069C12.55 34.4069 12.25 34.0069 12.25 33.7069C12.25 33.3069 12.45 32.8069 12.75 32.6069C12.95 32.5069 13.45 32.6069 13.75 32.7069C14.05 33.0069 14.35 33.4069 14.55 33.8069C15.15 34.6069 15.95 34.7069 16.75 34.1069C17.65 33.3069 18.15 32.2069 18.45 31.1069C19.05 28.7069 19.65 26.4069 20.15 24.0069V23.6069L14.85 22.8069L15.05 21.3069L20.55 22.1069L21.25 19.0069L15.55 18.1069L15.75 16.5069L21.65 17.3069C21.85 16.7069 21.95 16.2069 22.15 15.7069C22.65 13.9069 23.15 12.1069 24.35 10.5069C25.55 8.90687 26.95 7.90687 29.05 8.00687C29.95 8.00687 30.85 8.30687 31.45 9.00687C31.55 9.10687 31.75 9.30687 31.75 9.50687C31.75 9.90687 31.75 10.4069 31.45 10.7069C31.05 11.0069 30.55 10.9069 30.15 10.5069C29.85 10.2069 29.65 9.90687 29.35 9.60687C28.75 8.80687 27.85 8.70687 27.15 9.40687C26.65 9.90687 26.15 10.6069 25.85 11.3069C25.15 13.4069 24.65 15.6069 23.95 17.8069L29.45 18.6069L29.05 20.1069L23.75 19.3069Z",fill:"white"})}),IoTeX=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#00D4D5"},children:[jsxRuntimeExports.jsx("path",{d:"M23.7136 6.875V14.3784L30.2284 10.6315L23.7136 6.875Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M30.2284 10.6316V18.135L36.7418 14.3785L30.2284 10.6316Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 14.3784V21.8818L30.2284 18.1349L23.7136 14.3784ZM30.2284 18.1349V25.6383L36.7417 21.8818L30.2284 18.1349Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 21.8817V29.385L30.2284 25.6382L23.7136 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M30.2284 25.6382V33.1416L36.7418 29.3851L30.2284 25.6382Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M6.87537 14.1253V21.6287L13.3901 17.8722L6.87537 14.1253Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.2",d:"M15.0938 16.9153V24.4186L21.5975 20.6718L15.0938 16.9153Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.3",d:"M10.2648 21.6604V29.1638L16.7781 25.4073L10.2648 21.6604Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M14.5575 27.3226V34.826L21.0612 31.0695L14.5575 27.3226Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.7",d:"M23.66 30.5525V38.0572L30.1637 34.2993L23.66 30.5525Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M16.1786 13.2097V20.7145L22.6824 16.9676L16.1786 13.2097Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 6.875V14.3784L17.1989 10.6315L23.7136 6.875Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M16.1786 10.0649V17.5669L9.66248 13.8104L16.1786 10.0649Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M22.6934 13.7775V21.2823L16.1786 17.5244L22.6934 13.7775Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.95",d:"M15.0635 16.9153V24.4186L8.54877 20.6718L15.0635 16.9153Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M23.7136 21.8817V29.385L17.2099 25.6382L23.7136 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.55",d:"M10.2648 23.6295V31.1328L3.75 27.375L10.2648 23.6295Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M36.7418 14.3784V21.8818L30.2284 18.1349L36.7418 14.3784Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.95",d:"M30.2284 18.1362V25.6382L23.7136 21.8817L30.2284 18.1362Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M36.7418 21.8817V29.385L30.2284 25.6382L36.7418 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.7",d:"M30.2284 25.6382V33.1416L23.7136 29.3851L30.2284 25.6382Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M22.2712 28.7651V36.2684L15.7579 32.5216L22.2712 28.7651Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M30.2284 10.6316V18.135L23.7136 14.3785L30.2284 10.6316Z",fill:"white"})]}),Metis=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2F3140"},children:jsxRuntimeExports.jsx("path",{d:"M37.5175 22.0531C37.4579 19.2923 36.6563 16.5985 35.1968 14.2542C33.7374 11.91 31.674 10.0017 29.223 8.72965C26.772 7.45759 24.0238 6.86863 21.2668 7.02455C18.5098 7.18047 15.8456 8.07553 13.5537 9.61582C11.2617 11.1561 9.42659 13.2849 8.24079 15.7787C7.05498 18.2725 6.56222 21.0396 6.81419 23.7895C7.06617 26.5394 8.05359 29.1708 9.67288 31.4076C11.2922 33.6444 13.4836 35.4042 16.0173 36.5023C16.7657 35.3775 17.3385 34.1453 17.716 32.848C18.0245 32.0632 18.3595 31.2913 18.7067 30.5446C19.5444 30.7955 20.4345 30.8143 21.282 30.5989C22.1295 30.3835 22.9026 29.942 23.5188 29.3215L23.5704 29.2699C22.8136 28.9884 21.9979 28.9032 21.1993 29.022C20.4006 29.1408 19.6451 29.4598 19.0029 29.9494C19.4276 29.0613 19.891 28.1997 20.3667 27.3632C21.189 27.6541 22.075 27.7156 22.9296 27.541C23.7842 27.3665 24.5751 26.9626 25.2175 26.3726L25.2692 26.3209C24.538 26.0116 23.7416 25.8885 22.9513 25.9626C22.1609 26.0368 21.4013 26.3058 20.7404 26.7456C21.216 25.9608 21.7053 25.1889 22.2203 24.468C23.0713 24.6915 23.9672 24.6777 24.811 24.4282C25.6547 24.1787 26.414 23.703 27.0066 23.0526L27.0453 23.001C26.3425 22.7718 25.5958 22.7106 24.8651 22.8224C24.1344 22.9341 23.4401 23.2157 22.838 23.6444C22.8767 23.5928 22.9283 23.5289 22.9664 23.4773C23.2749 23.0784 23.5969 22.6796 23.9177 22.2936C24.8969 21.9731 25.7703 21.3916 26.4436 20.6117C27.117 19.8318 27.5649 18.883 27.7391 17.8674L27.752 17.79H27.7391C26.7194 18.0552 25.7944 18.6007 25.0689 19.3648C24.3434 20.1288 23.8464 21.0808 23.6343 22.1129C23.3258 22.4859 23.0167 22.8603 22.7211 23.2449C22.9706 22.5925 23.0724 21.893 23.0191 21.1966C22.9657 20.5002 22.7586 19.8243 22.4126 19.2176L22.3739 19.2692C21.8489 19.9862 21.5326 20.8345 21.4599 21.7201C21.3873 22.6058 21.5611 23.4942 21.9621 24.2872C21.4729 24.9823 20.9972 25.6897 20.5467 26.4357C20.6918 25.6858 20.6542 24.9118 20.4369 24.1795C20.2196 23.4471 19.8291 22.7779 19.2985 22.2284L19.2727 22.2929C18.9445 23.1107 18.8477 24.0031 18.9929 24.8723C19.1382 25.7415 19.5199 26.5539 20.0962 27.2205C19.6457 28.0054 19.2211 28.816 18.8093 29.6524C18.9344 28.8712 18.8712 28.0715 18.6251 27.3196C18.3789 26.5677 17.9568 25.8855 17.3939 25.3295L17.3681 25.3941C17.0745 26.2514 17.0201 27.1724 17.2105 28.0583C17.401 28.9442 17.8292 29.7614 18.4492 30.4223C18.1774 31.0012 17.9219 31.5774 17.6773 32.1849C17.61 32.1231 17.5313 32.0751 17.4456 32.0435C17.0066 31.916 16.5867 31.7299 16.1974 31.4904C15.8754 31.2994 15.5337 31.144 15.1781 31.027C13.7886 30.5765 13.9945 29.9079 13.2756 28.5564C13.0416 28.2781 12.7931 28.0125 12.5309 27.7607C12.2876 27.603 12.0884 27.386 11.9519 27.1302C11.7934 26.8107 11.6931 26.4656 11.6557 26.1109C11.6514 25.9148 11.5858 25.7249 11.4681 25.5679C11.3504 25.4109 11.1864 25.2948 10.9993 25.2358C8.95338 24.5284 9.86728 21.8778 9.94406 21.5299C9.91262 21.08 9.81271 20.6375 9.64781 20.2178C9.63057 20.1632 9.61763 20.1073 9.60908 20.0506C9.55449 19.776 9.56444 19.4924 9.63813 19.2223C9.71183 18.9521 9.84726 18.7028 10.0338 18.4939C10.2784 18.2493 11.1277 17.8505 11.3078 17.6188C11.4879 17.387 11.6163 17.1295 11.797 16.9114C12.3687 16.3412 13.0291 15.8675 13.7526 15.509C14.3444 15.1876 14.4477 14.364 14.6787 14.1065C15.0647 13.6689 15.6565 13.6689 16.0941 13.283C16.3129 13.09 16.6377 12.9867 16.8415 12.7815C17.8692 11.8403 19.1644 11.2423 20.5474 11.0706C21.5064 10.9924 22.4717 11.0795 23.4012 11.3281C23.5358 11.3507 23.669 11.3809 23.8001 11.4185C25.9228 11.4959 28.4709 11.9328 29.397 12.8338C29.8555 13.2744 30.1961 13.8229 30.3877 14.4293C30.5382 14.8988 30.7456 15.3481 31.0054 15.7672L31.5714 16.6933C31.932 17.2773 32.0475 17.9801 31.8928 18.6489C31.7885 18.974 31.7795 19.3223 31.8669 19.6525C32.1655 20.1031 32.5152 20.5177 32.9093 20.8878C33.0658 21.0427 33.2382 21.1807 33.4236 21.2995C33.8592 21.5594 34.2802 21.8429 34.6848 22.1489C34.698 22.2729 34.6775 22.3982 34.6254 22.5115C34.5732 22.6247 34.4914 22.7218 34.3885 22.7924C34.0284 23.1137 33.3333 23.6159 33.3333 23.6159C33.3584 23.758 33.4016 23.8964 33.4617 24.0276C33.5643 24.2077 33.796 24.4911 33.7192 24.735C33.6424 24.9789 33.1403 25.1855 33.2816 25.4552C33.423 25.7386 33.7831 25.8154 33.6805 26.0729C33.5779 26.3175 33.0757 26.7524 33.1274 26.9352C33.179 27.1179 33.5908 28.8377 32.6382 29.1353C31.4592 29.3685 30.2627 29.5019 29.0614 29.5342C28.8675 29.5454 28.6797 29.6055 28.5155 29.709C28.3513 29.8125 28.216 29.956 28.1223 30.126C27.9399 30.4661 27.8222 30.837 27.7751 31.22C27.4275 32.5896 26.9671 33.928 26.3985 35.2215C26.3985 35.2215 26.3597 35.2989 26.3081 35.4144C26.1833 35.6687 26.1048 35.9432 26.0764 36.2251C26.1573 36.4321 26.2799 36.6204 26.4365 36.7782C26.519 36.8726 26.6271 36.9411 26.7477 36.9753C26.8683 37.0096 26.9962 37.0081 27.116 36.9711C30.1997 35.8965 32.8655 33.8757 34.7332 31.197C36.601 28.5182 37.5754 25.3182 37.5175 22.0531Z",fill:o?"#ffffff":"#00DACC"})});var Chains={UnknownChain,Ethereum,Polygon,Optimism,Arbitrum,Aurora,Avalanche,Celo,Telos,Gnosis,Evmos,BinanceSmartChain,Foundry:KnownChain,Sepolia:KnownChain,Taraxa:KnownChain,zkSync:KnownChain,Flare:KnownChain,Canto,Fantom,Filecoin,Metis,IoTeX};const chainConfigs=[{id:1,name:"Ethereum",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{}),rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]}}},{id:3,name:"Rinkeby",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0}),rpcUrls:{}},{id:4,name:"Ropsten",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:5,name:"Görli",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:42,name:"Kovan",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:10,name:"Optimism",logo:jsxRuntimeExports.jsx(Chains.Optimism,{})},{id:69,name:"Optimism Kovan",logo:jsxRuntimeExports.jsx(Chains.Optimism,{testnet:!0})},{id:420,name:"Optimism Goerli",logo:jsxRuntimeExports.jsx(Chains.Optimism,{testnet:!0})},{id:137,name:"Polygon",logo:jsxRuntimeExports.jsx(Chains.Polygon,{})},{id:80001,name:"Polygon Mumbai",logo:jsxRuntimeExports.jsx(Chains.Polygon,{testnet:!0})},{id:31337,name:"Hardhat",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:1337,name:"Localhost",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:42161,name:"Arbitrum",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{}),rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]}}},{id:421611,name:"Arbitrum Rinkeby",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{testnet:!0})},{id:421613,name:"Arbitrum Goerli",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{testnet:!0}),rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]}}},{id:40,name:"Telos",logo:jsxRuntimeExports.jsx(Chains.Telos,{})},{id:41,name:"Telos Testnet",logo:jsxRuntimeExports.jsx(Chains.Telos,{testnet:!0})},{id:1313161554,name:"Aurora",logo:jsxRuntimeExports.jsx(Chains.Aurora,{})},{id:1313161555,name:"Aurora Testnet",logo:jsxRuntimeExports.jsx(Chains.Aurora,{testnet:!0})},{id:43114,name:"Avalanche",logo:jsxRuntimeExports.jsx(Chains.Avalanche,{})},{id:43113,name:"Avalanche Fuji",logo:jsxRuntimeExports.jsx(Chains.Avalanche,{testnet:!0})},{id:31337,name:"Foundry",logo:jsxRuntimeExports.jsx(Chains.Foundry,{testnet:!0})},{id:100,name:"Gnosis",logo:jsxRuntimeExports.jsx(Chains.Gnosis,{})},{id:9001,name:"Evmos",logo:jsxRuntimeExports.jsx(Chains.Evmos,{})},{id:9e3,name:"Evmos Testnet",logo:jsxRuntimeExports.jsx(Chains.Evmos,{testnet:!0})},{id:56,name:"BNB Smart Chain",logo:jsxRuntimeExports.jsx(Chains.BinanceSmartChain,{})},{id:97,name:"Binance Smart Chain Testnet",logo:jsxRuntimeExports.jsx(Chains.BinanceSmartChain,{testnet:!0})},{id:11155111,name:"Sepolia",logo:jsxRuntimeExports.jsx(Chains.Sepolia,{})},{id:841,name:"Taraxa",logo:jsxRuntimeExports.jsx(Chains.Taraxa,{})},{id:842,name:"Taraxa Testnet",logo:jsxRuntimeExports.jsx(Chains.Taraxa,{testnet:!0})},{id:324,name:"zkSync",logo:jsxRuntimeExports.jsx(Chains.zkSync,{})},{id:280,name:"zkSync Testnet",logo:jsxRuntimeExports.jsx(Chains.zkSync,{testnet:!0})},{id:42220,name:"Celo",logo:jsxRuntimeExports.jsx(Chains.Celo,{})},{id:44787,name:"Celo Alfajores",logo:jsxRuntimeExports.jsx(Chains.Celo,{testnet:!0})},{id:7700,name:"Canto",logo:jsxRuntimeExports.jsx(Chains.Canto,{})},{id:250,name:"Fantom",logo:jsxRuntimeExports.jsx(Chains.Fantom,{})},{id:4002,name:"Fantom Testnet",logo:jsxRuntimeExports.jsx(Chains.Fantom,{testnet:!0})},{id:14,name:"Flare",logo:jsxRuntimeExports.jsx(Chains.Flare,{})},{id:114,name:"Coston2",logo:jsxRuntimeExports.jsx(Chains.Flare,{})},{id:314,name:"Filecoin",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{})},{id:3141,name:"Filecoin Hyperspace",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{testnet:!0})},{id:314159,name:"Filecoin Calibration",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{testnet:!0})},{id:1088,name:"Metis",logo:jsxRuntimeExports.jsx(Chains.Metis,{})},{id:599,name:"Metis Goerli",logo:jsxRuntimeExports.jsx(Chains.Metis,{testnet:!0})},{id:4689,name:"IoTeX",logo:jsxRuntimeExports.jsx(Chains.IoTeX,{})},{id:4690,name:"IoTeX Testnet",logo:jsxRuntimeExports.jsx(Chains.IoTeX,{testnet:!0})}],SwitchNetworksContainer=styled.div` +`;function useIsMounted(){const[o,et]=reactExports.useState(!1);return reactExports.useEffect(()=>et(!0),[]),o}const ensFallbackConfig=createConfig({chains:[mainnet],transports:{[mainnet.id]:http()}});function useEnsFallbackConfig(){return useChainIsSupported(1)?void 0:ensFallbackConfig}const Avatar=({address:o,name:et,size:tt=96,radius:nt=96})=>{var rt,ot,it;const st=useIsMounted(),at=useContext(),ct=reactExports.useRef(null),[lt,dt]=reactExports.useState(!0),ht=useEnsFallbackConfig(),{data:ft}=useEnsAddress({chainId:1,name:et,config:ht}),{data:mt}=useEnsName({chainId:1,address:(rt=o??ft)!==null&&rt!==void 0?rt:void 0,config:ht}),{data:pt}=useEnsAvatar({chainId:1,name:normalize$2(mt??""),config:ht}),yt={address:ft??o,name:mt??et,avatar:pt??void 0};return reactExports.useEffect(()=>{ct.current&&ct.current.complete&&ct.current.naturalHeight!==0||dt(!1)},[pt]),st?!((ot=at.options)===null||ot===void 0)&&ot.customAvatar?jsxRuntimeExports.jsx("div",{style:{width:tt,height:tt,borderRadius:nt,overflow:"hidden"},children:(it=at.options)===null||it===void 0?void 0:it.customAvatar({address:o??(yt==null?void 0:yt.address),ensName:et??(yt==null?void 0:yt.name),ensImage:yt==null?void 0:yt.avatar,size:tt,radius:nt})}):!yt.name||!yt.avatar?jsxRuntimeExports.jsx(ResetContainer,{style:{pointerEvents:"none"},children:jsxRuntimeExports.jsx(EnsAvatar,{$size:tt,$seed:yt.address,$radius:nt})}):jsxRuntimeExports.jsx(ResetContainer,{style:{pointerEvents:"none"},children:jsxRuntimeExports.jsx(EnsAvatar,{$size:tt,$seed:yt.address,$radius:nt,children:jsxRuntimeExports.jsx(ImageContainer,{ref:ct,src:yt.avatar,alt:yt.name,onLoad:()=>dt(!0),$loaded:lt})})}):jsxRuntimeExports.jsx("div",{style:{width:tt,height:tt,borderRadius:nt}})},KnownChain=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"black"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),UnknownChain=({testnet:o,...et})=>jsxRuntimeExports.jsx(KnownChain,{testnet:!0,...et}),Ethereum=({testnet:o,...et})=>{let tt="var(--ck-chain-ethereum-01, #25292E)",nt="var(--ck-chain-ethereum-02, #ffffff)";return o&&(tt="linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)",nt="#fff"),jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:tt},children:[jsxRuntimeExports.jsx("path",{d:"M21.9967 6.99621L21.7955 7.67987V27.5163L21.9967 27.7171L31.2044 22.2744L21.9967 6.99621Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M21.9957 6.99621L12.7878 22.2744L21.9957 27.7171V18.0891V6.99621Z",fill:nt}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.9959 36.9996L21.9959 36.9997V36.9995L31.2091 24.0243L21.9959 29.4642L12.788 24.0243L21.9957 36.9993L21.9958 36.9997L21.9959 36.9996Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M21.996 27.7181L31.2037 22.2753L21.996 18.09V27.7181Z",fill:nt}),jsxRuntimeExports.jsx("path",{d:"M12.7878 22.2753L21.9957 27.7181V18.09L12.7878 22.2753Z",fill:nt})]})},Polygon=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#6F41D8"},children:jsxRuntimeExports.jsx("path",{d:"M29.0015 17.4529C28.4941 17.1572 27.8355 17.1572 27.2773 17.4529L23.3186 19.7271L20.6305 21.2094L16.6719 23.4822C16.1645 23.7792 15.5059 23.7792 14.9476 23.4822L11.8016 21.703C11.2943 21.4074 10.9395 20.8642 10.9395 20.2702V16.7612C10.9395 16.1686 11.2434 15.6255 11.8016 15.3285L14.8954 13.5988C15.4041 13.3018 16.0641 13.3018 16.6224 13.5988L19.7161 15.3285C20.2249 15.6255 20.5796 16.1686 20.5796 16.7612V19.0355L23.2678 17.5024V15.2295C23.2707 14.9343 23.1917 14.6441 23.0395 14.3911C22.8873 14.1381 22.6679 13.9324 22.4056 13.7968L16.6719 10.5353C16.1645 10.2382 15.5059 10.2382 14.9476 10.5353L9.11214 13.7968C8.84992 13.9324 8.63049 14.1381 8.47828 14.3911C8.32607 14.6441 8.24705 14.9343 8.25002 15.2295V21.802C8.25002 22.396 8.55389 22.9391 9.11214 23.2361L14.9476 26.4976C15.455 26.7932 16.115 26.7932 16.6719 26.4976L20.6305 24.2729L23.3186 22.7411L27.2773 20.5177C27.7846 20.2207 28.4433 20.2207 29.0015 20.5177L32.0966 22.2475C32.6054 22.5431 32.9588 23.0863 32.9588 23.6803V27.1893C32.9588 27.7819 32.6563 28.325 32.0966 28.622L29.0029 30.4013C28.4941 30.6983 27.8341 30.6983 27.2773 30.4013L24.1821 28.6715C23.6734 28.3745 23.3186 27.8314 23.3186 27.2387V24.9645L20.6305 26.4976V28.7705C20.6305 29.3631 20.9344 29.9076 21.4926 30.2032L27.3281 33.4647C27.8355 33.7617 28.4941 33.7617 29.0524 33.4647L34.8879 30.2032C35.3953 29.9076 35.75 29.3645 35.75 28.7705V22.198C35.753 21.9028 35.674 21.6126 35.5218 21.3596C35.3695 21.1066 35.1501 20.9009 34.8879 20.7653L29.0029 17.4529H29.0015Z",fill:"white"})}),Optimism=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#FF0420"},children:[jsxRuntimeExports.jsx("path",{d:"M15.5877 27.8473C14.2777 27.8473 13.2045 27.539 12.3679 26.9226C11.5422 26.2952 11.1294 25.4035 11.1294 24.2477C11.1294 24.0055 11.157 23.7082 11.212 23.356C11.3552 22.5634 11.5588 21.6112 11.823 20.4994C12.5715 17.4722 14.5034 15.9586 17.6187 15.9586C18.4664 15.9586 19.2259 16.1017 19.8974 16.3879C20.5689 16.663 21.0973 17.0814 21.4826 17.6428C21.8678 18.1932 22.0605 18.8537 22.0605 19.6242C22.0605 19.8554 22.033 20.1471 21.9779 20.4994C21.8128 21.4791 21.6146 22.4313 21.3835 23.356C20.9982 24.8641 20.3322 25.9924 19.3855 26.741C18.4388 27.4785 17.1729 27.8473 15.5877 27.8473ZM15.8189 25.4695C16.4354 25.4695 16.9582 25.2879 17.3876 24.9247C17.8279 24.5614 18.1416 24.0055 18.3287 23.257C18.5819 22.2222 18.7746 21.3195 18.9067 20.5489C18.9507 20.3178 18.9727 20.0811 18.9727 19.8389C18.9727 18.8372 18.4498 18.3363 17.4041 18.3363C16.7876 18.3363 16.2592 18.5179 15.8189 18.8812C15.3896 19.2445 15.0813 19.8004 14.8943 20.5489C14.6961 21.2865 14.4979 22.1892 14.2998 23.257C14.2557 23.477 14.2337 23.7082 14.2337 23.9504C14.2337 24.9632 14.7622 25.4695 15.8189 25.4695Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M22.8188 27.6815C22.6977 27.6815 22.6041 27.6429 22.5381 27.5659C22.483 27.4778 22.4665 27.3788 22.4885 27.2687L24.7672 16.5358C24.7892 16.4147 24.8498 16.3156 24.9489 16.2385C25.0479 16.1615 25.1525 16.1229 25.2626 16.1229H29.6548C30.8767 16.1229 31.8564 16.3761 32.5939 16.8825C33.3426 17.3889 33.7168 18.1209 33.7168 19.0786C33.7168 19.3538 33.6838 19.64 33.6177 19.9372C33.3426 21.2032 32.7867 22.1389 31.95 22.7443C31.1244 23.3498 29.9905 23.6525 28.5485 23.6525H26.3194L25.5598 27.2687C25.5377 27.3898 25.4772 27.4888 25.3782 27.5659C25.2791 27.6429 25.1745 27.6815 25.0645 27.6815H22.8188ZM28.6641 21.3738C29.1264 21.3738 29.5282 21.2472 29.8695 20.994C30.2217 20.7408 30.4529 20.3776 30.563 19.9042C30.596 19.717 30.6125 19.552 30.6125 19.4089C30.6125 19.0896 30.519 18.8474 30.3318 18.6823C30.1446 18.5062 29.8255 18.4182 29.3741 18.4182H27.3926L26.7652 21.3738H28.6641Z",fill:"white"})]}),Arbitrum=({testnet:o,...et})=>{const tt=o?"#ffffff":"#28A0F0",nt=o?"#ffffff":"#96BEDC";return jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2C364F"},children:[!o&&jsxRuntimeExports.jsx("path",{d:"M25.7948 20.5826L28.2683 16.3854L34.9355 26.7696L34.9386 28.7625L34.9168 15.0491C34.9011 14.7137 34.7231 14.407 34.4391 14.2261L22.4357 7.32182C22.1551 7.1838 21.7989 7.18546 21.5187 7.32618C21.4807 7.34524 21.4453 7.36576 21.4113 7.38835L21.3694 7.41467L9.71816 14.1664L9.67298 14.1871C9.61474 14.2137 9.55609 14.2479 9.50076 14.2872C9.27983 14.4456 9.1331 14.68 9.08564 14.9425C9.07859 14.9823 9.0732 15.023 9.07092 15.064L9.08916 26.239L15.2994 16.6138C16.0811 15.3376 17.7847 14.9262 19.3662 14.9488L21.2221 14.9977L10.2862 32.5356L11.5753 33.2778L22.6422 15.0155L27.5338 14.9977L16.4956 33.7209L21.0955 36.3668L21.6451 36.6827C21.8776 36.7772 22.1516 36.7819 22.386 36.6972L34.5581 29.6433L32.2309 30.9918L25.7948 20.5826ZM26.7384 34.175L22.0925 26.8829L24.9287 22.0702L31.0303 31.6876L26.7384 34.175Z",fill:"#2D374B"}),jsxRuntimeExports.jsx("path",{d:"M22.0924 26.8832L26.7385 34.1751L31.0302 31.6879L24.9286 22.0705L22.0924 26.8832Z",fill:tt}),jsxRuntimeExports.jsx("path",{d:"M34.9387 28.7627L34.9356 26.7698L28.2684 16.3856L25.7949 20.5828L32.2312 30.992L34.5584 29.6435C34.7866 29.4582 34.9248 29.1861 34.9393 28.8926L34.9387 28.7627Z",fill:tt}),jsxRuntimeExports.jsx("path",{d:"M7 30.642L10.2863 32.5356L21.2222 14.9976L19.3663 14.9487C17.785 14.9263 16.0814 15.3375 15.2995 16.6137L9.08927 26.239L7 29.449V30.642V30.642Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M27.534 14.9977L22.6423 15.0155L11.5754 33.2778L15.4437 35.5049L16.4955 33.7209L27.534 14.9977Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M37 14.9723C36.9592 13.9493 36.4052 13.013 35.5377 12.4677L23.377 5.47434C22.5187 5.04223 21.4466 5.04161 20.5868 5.47414C20.4852 5.52533 8.76078 12.3251 8.76078 12.3251C8.5985 12.4029 8.44224 12.4955 8.2953 12.6008C7.52081 13.156 7.0487 14.0186 7 14.9661V29.4492L9.08927 26.2392L9.07103 15.0639C9.07352 15.0231 9.0787 14.9827 9.08575 14.9431C9.133 14.6801 9.27994 14.4457 9.50086 14.2872C9.5562 14.2478 21.4806 7.34517 21.5186 7.32611C21.799 7.18538 22.155 7.18373 22.4356 7.32175L34.439 14.226C34.723 14.4069 34.901 14.7137 34.9167 15.049V28.8921C34.9022 29.1856 34.7862 29.4577 34.558 29.643L32.2308 30.9916L31.03 31.6875L26.7383 34.1747L22.3859 36.6969C22.1515 36.7817 21.8773 36.7769 21.645 36.6824L16.4955 33.7206L15.4435 35.5046L20.0713 38.169C20.2243 38.256 20.3607 38.3331 20.4726 38.3961C20.6458 38.4933 20.764 38.5582 20.8056 38.5785C21.1345 38.7383 21.6077 38.8311 22.0342 38.8311C22.4251 38.8311 22.8064 38.7594 23.1672 38.6181L35.8092 31.2971C36.5347 30.7348 36.9617 29.8869 37 28.9686V14.9723Z",fill:nt})]})},Telos=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#571AFF"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26.1834 8.14754C25.6606 8.23504 25.3644 8.50235 24.9216 9.28591C24.5651 9.91722 24.4762 10.0244 24.2024 10.1592L23.9832 10.2668L19.2967 10.286L14.6097 10.3057L14.3875 10.3902C13.7059 10.6492 13.6192 10.7135 11.6291 12.4407C9.72243 14.0953 9.64893 14.1723 9.59249 14.5836C9.54437 14.9362 9.78981 15.6327 10.5191 17.2143C11.2847 18.8737 11.2839 18.8641 10.7444 19.5256C10.2645 20.1136 10.2269 20.2588 10.2041 21.5915C10.1717 23.502 10.2487 27.6023 10.3222 27.8591C10.3572 27.9816 10.7908 29.204 11.2861 30.5755C11.7813 31.9471 12.4192 33.715 12.704 34.5038C13.4281 36.5107 13.4814 36.5986 14.0392 36.7237C14.3066 36.7837 14.3206 36.781 18.9677 35.7258C24.4395 34.4837 23.7264 34.709 25.0739 33.7968C29.8732 30.5475 29.7337 30.66 29.8969 29.9083C30.0583 29.1642 30.1082 29.1379 31.8267 28.8999C34.6122 28.5145 34.6328 28.5083 34.8831 28.0109C35.0182 27.7423 35.7786 23.3406 35.8136 22.6209C35.8504 21.8828 36.042 22.221 33.3816 18.3395C30.022 13.4382 30.2381 13.7777 30.2399 13.4041C30.2407 13.1735 30.3366 12.9736 31.3236 11.1418C31.8236 10.2134 32.2742 9.35241 32.3254 9.22904C32.5236 8.74691 32.4204 8.3921 32.0301 8.21622L31.8267 8.12391L29.1102 8.11822C27.6048 8.11516 26.2997 8.12829 26.1834 8.14754ZM30.0474 9.4876C30.5623 9.72297 30.5382 9.82447 29.5119 11.7398C28.4317 13.7558 28.3157 13.2711 30.7154 16.7707C31.639 18.1173 32.8076 19.8218 33.3124 20.5581C34.6844 22.5592 34.6048 22.1799 34.1831 24.6903C33.7858 27.0602 33.7792 27.0817 33.3759 27.282C33.1506 27.394 33.2276 27.3813 30.8493 27.7117C28.9147 27.9803 28.8543 28.017 28.6719 29.0338C28.5778 29.557 28.4606 29.8169 28.2243 30.0247C28.0808 30.1512 24.8682 32.368 23.9451 32.9778C23.2587 33.4311 23.6861 33.3152 17.7471 34.6574C17.1997 34.7812 16.4079 34.9632 15.987 35.0617C14.4588 35.4195 14.4299 35.4033 13.8804 33.8948C12.9188 31.2528 11.6811 27.7957 11.6194 27.5787C11.5534 27.3463 11.549 27.1202 11.549 24.059V20.7878L11.6501 20.5966C11.7056 20.4912 11.8671 20.2759 12.0088 20.118C12.8418 19.19 12.8383 19.1183 11.8601 16.9907C10.7663 14.612 10.6797 14.9992 12.697 13.2501C14.2418 11.91 14.3048 11.8593 14.5905 11.7237L14.8394 11.6055L19.6983 11.5854C23.5417 11.5692 24.5891 11.5543 24.7103 11.515C25.1465 11.3728 25.4086 11.1094 25.7975 10.4203C26.3851 9.38041 26.3111 9.40797 28.4597 9.41891C29.6996 9.42547 29.9332 9.43554 30.0474 9.4876Z",fill:"#F7F5FC"})}),Aurora=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#6CD544"},children:jsxRuntimeExports.jsx("path",{d:"M22.0006 7.292C22.6198 7.29004 23.2271 7.46144 23.754 7.7868C24.2808 8.11216 24.706 8.57848 24.9816 9.133L34.3566 27.883C34.611 28.3912 34.7312 28.956 34.7058 29.5238C34.6805 30.0915 34.5103 30.6433 34.2116 31.1268C33.9129 31.6103 33.4956 32.0094 32.9992 32.2861C32.5028 32.5629 31.9439 32.7081 31.3756 32.708H12.6256C12.0573 32.7079 11.4985 32.5626 11.0023 32.2858C10.506 32.009 10.0888 31.6099 9.79022 31.1264C9.49163 30.6429 9.3216 30.0912 9.29628 29.5235C9.27096 28.9558 9.39119 28.3911 9.64556 27.883L19.0196 9.133C19.2951 8.57848 19.7203 8.11216 20.2472 7.7868C20.774 7.46144 21.3814 7.29004 22.0006 7.292ZM22.0006 5C20.9561 4.9999 19.9322 5.29059 19.0437 5.83952C18.1551 6.38846 17.4369 7.17394 16.9696 8.108L7.59456 26.858C7.16544 27.7156 6.96271 28.6687 7.00564 29.6268C7.04856 30.5848 7.33572 31.516 7.83982 32.3318C8.34392 33.1476 9.04823 33.821 9.88584 34.288C10.7235 34.755 11.6666 35.0001 12.6256 35H31.3756C32.3345 34.9999 33.2775 34.7547 34.1149 34.2876C34.9524 33.8206 35.6566 33.1472 36.1606 32.3314C36.6645 31.5156 36.9516 30.5845 36.9945 29.6265C37.0374 28.6686 36.8346 27.7156 36.4056 26.858L27.0316 8.108C26.5642 7.17394 25.846 6.38846 24.9574 5.83952C24.0689 5.29059 23.045 4.9999 22.0006 5Z",fill:"white"})}),Avalanche=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#E84142"},children:[jsxRuntimeExports.jsx("path",{d:"M11.0188 32.1528H15.4825C16.5334 32.1528 17.0589 32.1528 17.5278 32.023C18.042 31.8701 18.511 31.5991 18.9009 31.2261C19.2589 30.885 19.5173 30.4328 20.0269 29.5409L20.0272 29.5404L20.0422 29.5142L25.8314 19.2804C26.3456 18.3821 26.5999 17.93 26.7129 17.4554C26.8372 16.9412 26.8372 16.3988 26.7129 15.8847C26.6007 15.4136 26.3439 14.9648 25.8373 14.0798L25.8258 14.0597L23.56 10.1045C23.0911 9.27958 22.8538 8.86711 22.5543 8.71456C22.2323 8.55071 21.848 8.55071 21.526 8.71456C21.2265 8.86711 20.9892 9.27958 20.5202 10.1045L9.49892 29.5311C9.03561 30.3447 8.80392 30.7517 8.82089 31.0849C8.84349 31.4466 9.02994 31.7743 9.33507 31.9721C9.61756 32.1528 10.0809 32.1528 11.0188 32.1528Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M33.1506 32.1528H26.7547C25.8111 32.1528 25.3365 32.1528 25.0596 31.9721C24.7545 31.7743 24.5681 31.4411 24.5455 31.0794C24.5286 30.7486 24.7621 30.3456 25.2294 29.539L25.2295 29.5388L25.2404 29.5199L28.4328 24.0392C28.9018 23.2313 29.1391 22.8301 29.4329 22.6776C29.7548 22.5137 30.1336 22.5137 30.4555 22.6776C30.7472 22.8261 30.9744 23.2102 31.4241 23.9708L31.4248 23.9719L31.4613 24.0336L34.665 29.5143C34.6806 29.5413 34.696 29.5678 34.7113 29.5939L34.7113 29.594C35.1554 30.3603 35.382 30.7514 35.3657 31.0739C35.3486 31.4353 35.1566 31.7688 34.8515 31.9666C34.5689 32.1528 34.0942 32.1528 33.1506 32.1528Z",fill:"white"})]}),Celo=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#FCFE72"},children:jsxRuntimeExports.jsx("path",{d:"M9 9H34.5183V18.112H30.3564C28.896 14.7687 25.6102 12.4171 21.777 12.4171C16.593 12.4171 12.3948 16.6422 12.3948 21.823C12.3948 27.0039 16.593 31.2654 21.777 31.2654C25.5373 31.2654 28.8231 28.9876 30.2829 25.7172H34.5178V34.682H9V9Z",fill:o?"#ffffff":"black"})}),Gnosis=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#009CB4"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.3439 11.8664C17.9374 6.53462 26.7953 6.74397 32.1271 12.3374C32.4738 12.7038 32.8075 13.0832 33.1084 13.4823L22 24.5972L10.8916 13.4823C11.1991 13.0832 11.5262 12.7038 11.8729 12.3374C12.0234 12.1804 12.1804 12.0234 12.3439 11.8664ZM30.6094 13.3972C28.3196 11.0944 25.271 9.83182 22 9.83182C18.729 9.83182 15.6804 11.0944 13.3907 13.3972L22 22.0066L30.6094 13.3972ZM33.9785 14.7446L31.7215 17.0016C33.5402 19.1801 33.2523 22.425 31.0738 24.2437C29.1636 25.84 26.3897 25.84 24.4794 24.2437L22 26.7231L19.5271 24.2502C17.3486 26.0689 14.1037 25.7811 12.285 23.6026C10.6888 21.6923 10.6888 18.9185 12.285 17.0082L11.1271 15.8502L10.028 14.7446C8.7 16.9297 8 19.4418 8 21.9998C8 29.7325 14.2673 35.9998 22 35.9998C29.7327 35.9998 36 29.7325 36 21.9998C36.0065 19.4418 35.3 16.9297 33.9785 14.7446ZM30.6486 18.0747C31.1392 18.7093 31.4075 19.4943 31.4075 20.299C31.4075 21.1037 31.1392 21.8887 30.6486 22.5233C29.4187 24.113 27.1355 24.4074 25.5458 23.1775L30.6486 18.0747ZM18.4542 23.1839C17.8196 23.6745 17.0346 23.9427 16.2299 23.9427C15.4252 23.9427 14.6467 23.6745 14.0056 23.1904C12.4159 21.9605 12.1215 19.6708 13.3514 18.0811L18.4542 23.1839Z",fill:"white"})}),Evmos=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2D2A25"},children:jsxRuntimeExports.jsx("path",{d:"M18.4916 12.6668C12.9416 14.806 12.4332 20.2846 10.8418 22.8432C9.23155 25.4322 5.54251 26.8607 6.04698 28.1801C6.55143 29.4994 10.2449 28.0824 13.1669 28.9242C16.0543 29.7561 20.0831 33.4862 25.633 31.3469C28.4603 30.2573 30.5076 28.0143 31.449 25.3574C31.5502 25.0723 31.361 24.7673 31.0606 24.7391C30.874 24.7215 30.6948 24.8196 30.6106 24.9877C29.759 26.6908 28.2981 28.0934 26.3864 28.8301C23.2303 30.0465 19.777 29.0915 17.6562 26.6961C17.1746 26.1522 16.7626 25.533 16.4374 24.8487C16.348 24.6603 16.2629 24.4689 16.1875 24.2708C16.1117 24.0728 16.0473 23.8735 15.9881 23.6732C17.6562 22.8925 19.5812 22.0656 21.7635 21.2246C23.903 20.3999 25.8505 19.731 27.5841 19.1958C28.7571 18.8341 29.8322 18.5331 30.8029 18.2871C30.8732 18.2695 30.9423 18.2519 31.0112 18.2347C31.158 18.1982 31.3088 18.2769 31.363 18.4186L31.364 18.4213C31.396 18.5053 31.4236 18.5898 31.4535 18.6743C31.6453 19.2196 31.7892 19.7706 31.8841 20.3229C31.9258 20.5645 32.1888 20.6961 32.4044 20.5799C33.2014 20.1504 33.9302 19.7314 34.5814 19.3283C37.0083 17.8276 38.3538 16.5549 38.0776 15.8336C37.802 15.1119 35.9541 15.0705 33.1503 15.5854C32.2593 15.7491 31.2716 15.9691 30.207 16.2416C30.0229 16.2886 29.8365 16.3375 29.6481 16.3877C28.7522 16.6262 27.8073 16.8995 26.8234 17.2053C24.9936 17.7744 23.0305 18.4561 21.0038 19.2372C19.1078 19.9682 17.3109 20.726 15.6629 21.4812C15.6428 18.2761 17.5725 15.2461 20.7286 14.0297C22.6399 13.293 24.6605 13.3533 26.4285 14.0473C26.6029 14.116 26.8015 14.0684 26.9291 13.9298C27.1331 13.7076 27.0706 13.3537 26.8053 13.2094C24.3353 11.8685 21.319 11.5771 18.4916 12.6668Z",fill:"#FAF1E4"})}),BinanceSmartChain=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#16181A"},children:[jsxRuntimeExports.jsx("path",{d:"M16.0445 19.6063L21.8705 13.7805L27.6996 19.6093L31.0896 16.2193L21.8705 7L12.6545 16.2163L16.0445 19.6063Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M13.6505 21.9995L10.2606 18.6096L6.87046 21.9997L10.2604 25.3896L13.6505 21.9995Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M16.0445 24.3937L21.8705 30.2195L27.6994 24.3909L31.0913 27.779L31.0896 27.7809L21.8705 37L12.6542 27.7839L12.6495 27.7792L16.0445 24.3937Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M33.4808 25.3911L36.8709 22.001L33.481 18.6111L30.0909 22.0012L33.4808 25.3911Z",fill:o?"#fff":"#F3BA2F"}),jsxRuntimeExports.jsx("path",{d:"M25.3091 21.9982H25.3105L21.8705 18.5582L19.3283 21.1004H19.3281L19.0362 21.3926L18.4336 21.9951L18.4289 21.9999L18.4336 22.0048L21.8705 25.4418L25.3105 22.0018L25.3122 21.9999L25.3091 21.9982Z",fill:o?"#fff":"#F3BA2F"})]}),Canto=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"white"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35 8V36H9L13.875 35.9998V31.0586H9V12.9412H13.875V8H35ZM17.9373 12.9414H30.1247V17.8826H17.9373V12.9414ZM30.1247 26.9414H17.9373V17.8826L13.0623 17.8828V26.9416L17.9373 26.9414V31.8826H30.1247V26.9414Z",fill:"#06FC99"})}),Fantom=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#0911EF"},children:jsxRuntimeExports.jsx("path",{d:"M20.92 9.25864C21.5933 8.91379 22.6178 8.91379 23.2911 9.25864L30.1616 12.7775C30.5671 12.9852 30.7898 13.2947 30.8297 13.6142H30.8363V31.302C30.8274 31.6504 30.6025 31.9966 30.1616 32.2225L23.2911 35.7413C22.6178 36.0862 21.5933 36.0862 20.92 35.7413L14.0495 32.2225C13.6104 31.9976 13.3997 31.6489 13.3893 31.302C13.3883 31.2678 13.3881 31.2393 13.3891 31.2157L13.3891 13.7278C13.3884 13.7086 13.3883 13.6895 13.3889 13.6705L13.3893 13.6142L13.3924 13.6142C13.4229 13.2912 13.6355 12.9896 14.0495 12.7775L20.92 9.25864ZM29.7547 23.4821L23.2911 26.7926C22.6178 27.1374 21.5933 27.1374 20.92 26.7926L14.4706 23.4895V31.2669L20.92 34.5527C21.2842 34.7415 21.6622 34.9254 22.0318 34.9488L22.1056 34.9512C22.4907 34.9524 22.8646 34.7628 23.2438 34.5833L29.7547 31.2387V23.4821ZM11.3214 31.8437C11.3214 32.5212 11.4026 32.9667 11.5639 33.2806C11.6976 33.5407 11.8981 33.7394 12.2643 33.9813L12.2852 33.9951C12.3656 34.0476 12.4541 34.1026 12.5619 34.1672L12.689 34.2427L13.0792 34.4711L12.5195 35.3685L12.0827 35.1126L12.0093 35.0689C11.883 34.9932 11.7783 34.9284 11.6807 34.8645C10.637 34.1822 10.2478 33.4384 10.2401 31.8907L10.24 31.8437H11.3214ZM21.5647 18.7412C21.5147 18.7579 21.4678 18.7772 21.4251 18.7991L14.5546 22.318C14.5474 22.3216 14.5405 22.3253 14.534 22.3289L14.5281 22.3322L14.5389 22.3382L14.5546 22.3464L21.4251 25.8653C21.4678 25.8872 21.5147 25.9065 21.5647 25.9231V18.7412ZM22.6465 18.7412V25.9231C22.6965 25.9065 22.7433 25.8872 22.7861 25.8653L29.6566 22.3464C29.6638 22.3427 29.6707 22.3391 29.6772 22.3355L29.683 22.3322L29.6722 22.3262L29.6566 22.318L22.7861 18.7991C22.7433 18.7772 22.6965 18.7579 22.6465 18.7412ZM29.7547 14.8689L23.5915 18.0256L29.7547 21.1822V14.8689ZM14.4706 14.8763V21.1749L20.6195 18.0256L14.4706 14.8763ZM22.7861 10.1859C22.4288 10.0029 21.7824 10.0029 21.4251 10.1859L14.5546 13.7048C14.5474 13.7085 14.5405 13.7122 14.534 13.7158L14.5281 13.719L14.5389 13.725L14.5546 13.7333L21.4251 17.2522C21.7824 17.4352 22.4288 17.4352 22.7861 17.2522L29.6566 13.7333C29.6638 13.7296 29.6707 13.7259 29.6772 13.7223L29.683 13.719L29.6722 13.7131L29.6566 13.7048L22.7861 10.1859ZM31.7205 9.64552L32.1573 9.90132L32.2307 9.94503C32.357 10.0206 32.4616 10.0856 32.5593 10.1494C33.603 10.8317 33.9922 11.5756 33.9998 13.1231L34 13.1703H32.9186C32.9186 12.4926 32.8373 12.0472 32.6761 11.7334C32.5424 11.4733 32.3419 11.2745 31.9757 11.0327L31.9547 11.0189C31.8744 10.9664 31.7858 10.9113 31.6781 10.8466L31.551 10.7712L31.1608 10.5428L31.7205 9.64552Z",fill:"white"})}),Filecoin=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#0090FF"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23.75 19.3069L23.15 22.5069L28.85 23.3069L28.45 24.8069L22.85 24.0069C22.45 25.3069 22.25 26.7069 21.75 27.9069C21.25 29.3069 20.75 30.7069 20.15 32.0069C19.35 33.7069 17.95 34.9069 16.05 35.2069C14.95 35.4069 13.75 35.3069 12.85 34.6069C12.55 34.4069 12.25 34.0069 12.25 33.7069C12.25 33.3069 12.45 32.8069 12.75 32.6069C12.95 32.5069 13.45 32.6069 13.75 32.7069C14.05 33.0069 14.35 33.4069 14.55 33.8069C15.15 34.6069 15.95 34.7069 16.75 34.1069C17.65 33.3069 18.15 32.2069 18.45 31.1069C19.05 28.7069 19.65 26.4069 20.15 24.0069V23.6069L14.85 22.8069L15.05 21.3069L20.55 22.1069L21.25 19.0069L15.55 18.1069L15.75 16.5069L21.65 17.3069C21.85 16.7069 21.95 16.2069 22.15 15.7069C22.65 13.9069 23.15 12.1069 24.35 10.5069C25.55 8.90687 26.95 7.90687 29.05 8.00687C29.95 8.00687 30.85 8.30687 31.45 9.00687C31.55 9.10687 31.75 9.30687 31.75 9.50687C31.75 9.90687 31.75 10.4069 31.45 10.7069C31.05 11.0069 30.55 10.9069 30.15 10.5069C29.85 10.2069 29.65 9.90687 29.35 9.60687C28.75 8.80687 27.85 8.70687 27.15 9.40687C26.65 9.90687 26.15 10.6069 25.85 11.3069C25.15 13.4069 24.65 15.6069 23.95 17.8069L29.45 18.6069L29.05 20.1069L23.75 19.3069Z",fill:"white"})}),IoTeX=({testnet:o,...et})=>jsxRuntimeExports.jsxs("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#00D4D5"},children:[jsxRuntimeExports.jsx("path",{d:"M23.7136 6.875V14.3784L30.2284 10.6315L23.7136 6.875Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M30.2284 10.6316V18.135L36.7418 14.3785L30.2284 10.6316Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 14.3784V21.8818L30.2284 18.1349L23.7136 14.3784ZM30.2284 18.1349V25.6383L36.7417 21.8818L30.2284 18.1349Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 21.8817V29.385L30.2284 25.6382L23.7136 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M30.2284 25.6382V33.1416L36.7418 29.3851L30.2284 25.6382Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M6.87537 14.1253V21.6287L13.3901 17.8722L6.87537 14.1253Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.2",d:"M15.0938 16.9153V24.4186L21.5975 20.6718L15.0938 16.9153Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.3",d:"M10.2648 21.6604V29.1638L16.7781 25.4073L10.2648 21.6604Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M14.5575 27.3226V34.826L21.0612 31.0695L14.5575 27.3226Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.7",d:"M23.66 30.5525V38.0572L30.1637 34.2993L23.66 30.5525Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M16.1786 13.2097V20.7145L22.6824 16.9676L16.1786 13.2097Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.8",d:"M23.7136 6.875V14.3784L17.1989 10.6315L23.7136 6.875Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M16.1786 10.0649V17.5669L9.66248 13.8104L16.1786 10.0649Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M22.6934 13.7775V21.2823L16.1786 17.5244L22.6934 13.7775Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.95",d:"M15.0635 16.9153V24.4186L8.54877 20.6718L15.0635 16.9153Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.6",d:"M23.7136 21.8817V29.385L17.2099 25.6382L23.7136 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.55",d:"M10.2648 23.6295V31.1328L3.75 27.375L10.2648 23.6295Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M36.7418 14.3784V21.8818L30.2284 18.1349L36.7418 14.3784Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.95",d:"M30.2284 18.1362V25.6382L23.7136 21.8817L30.2284 18.1362Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.9",d:"M36.7418 21.8817V29.385L30.2284 25.6382L36.7418 21.8817Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.7",d:"M30.2284 25.6382V33.1416L23.7136 29.3851L30.2284 25.6382Z",fill:"white"}),jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M22.2712 28.7651V36.2684L15.7579 32.5216L22.2712 28.7651Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M30.2284 10.6316V18.135L23.7136 14.3785L30.2284 10.6316Z",fill:"white"})]}),Metis=({testnet:o,...et})=>jsxRuntimeExports.jsx("svg",{...et,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:o?"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)":"#2F3140"},children:jsxRuntimeExports.jsx("path",{d:"M37.5175 22.0531C37.4579 19.2923 36.6563 16.5985 35.1968 14.2542C33.7374 11.91 31.674 10.0017 29.223 8.72965C26.772 7.45759 24.0238 6.86863 21.2668 7.02455C18.5098 7.18047 15.8456 8.07553 13.5537 9.61582C11.2617 11.1561 9.42659 13.2849 8.24079 15.7787C7.05498 18.2725 6.56222 21.0396 6.81419 23.7895C7.06617 26.5394 8.05359 29.1708 9.67288 31.4076C11.2922 33.6444 13.4836 35.4042 16.0173 36.5023C16.7657 35.3775 17.3385 34.1453 17.716 32.848C18.0245 32.0632 18.3595 31.2913 18.7067 30.5446C19.5444 30.7955 20.4345 30.8143 21.282 30.5989C22.1295 30.3835 22.9026 29.942 23.5188 29.3215L23.5704 29.2699C22.8136 28.9884 21.9979 28.9032 21.1993 29.022C20.4006 29.1408 19.6451 29.4598 19.0029 29.9494C19.4276 29.0613 19.891 28.1997 20.3667 27.3632C21.189 27.6541 22.075 27.7156 22.9296 27.541C23.7842 27.3665 24.5751 26.9626 25.2175 26.3726L25.2692 26.3209C24.538 26.0116 23.7416 25.8885 22.9513 25.9626C22.1609 26.0368 21.4013 26.3058 20.7404 26.7456C21.216 25.9608 21.7053 25.1889 22.2203 24.468C23.0713 24.6915 23.9672 24.6777 24.811 24.4282C25.6547 24.1787 26.414 23.703 27.0066 23.0526L27.0453 23.001C26.3425 22.7718 25.5958 22.7106 24.8651 22.8224C24.1344 22.9341 23.4401 23.2157 22.838 23.6444C22.8767 23.5928 22.9283 23.5289 22.9664 23.4773C23.2749 23.0784 23.5969 22.6796 23.9177 22.2936C24.8969 21.9731 25.7703 21.3916 26.4436 20.6117C27.117 19.8318 27.5649 18.883 27.7391 17.8674L27.752 17.79H27.7391C26.7194 18.0552 25.7944 18.6007 25.0689 19.3648C24.3434 20.1288 23.8464 21.0808 23.6343 22.1129C23.3258 22.4859 23.0167 22.8603 22.7211 23.2449C22.9706 22.5925 23.0724 21.893 23.0191 21.1966C22.9657 20.5002 22.7586 19.8243 22.4126 19.2176L22.3739 19.2692C21.8489 19.9862 21.5326 20.8345 21.4599 21.7201C21.3873 22.6058 21.5611 23.4942 21.9621 24.2872C21.4729 24.9823 20.9972 25.6897 20.5467 26.4357C20.6918 25.6858 20.6542 24.9118 20.4369 24.1795C20.2196 23.4471 19.8291 22.7779 19.2985 22.2284L19.2727 22.2929C18.9445 23.1107 18.8477 24.0031 18.9929 24.8723C19.1382 25.7415 19.5199 26.5539 20.0962 27.2205C19.6457 28.0054 19.2211 28.816 18.8093 29.6524C18.9344 28.8712 18.8712 28.0715 18.6251 27.3196C18.3789 26.5677 17.9568 25.8855 17.3939 25.3295L17.3681 25.3941C17.0745 26.2514 17.0201 27.1724 17.2105 28.0583C17.401 28.9442 17.8292 29.7614 18.4492 30.4223C18.1774 31.0012 17.9219 31.5774 17.6773 32.1849C17.61 32.1231 17.5313 32.0751 17.4456 32.0435C17.0066 31.916 16.5867 31.7299 16.1974 31.4904C15.8754 31.2994 15.5337 31.144 15.1781 31.027C13.7886 30.5765 13.9945 29.9079 13.2756 28.5564C13.0416 28.2781 12.7931 28.0125 12.5309 27.7607C12.2876 27.603 12.0884 27.386 11.9519 27.1302C11.7934 26.8107 11.6931 26.4656 11.6557 26.1109C11.6514 25.9148 11.5858 25.7249 11.4681 25.5679C11.3504 25.4109 11.1864 25.2948 10.9993 25.2358C8.95338 24.5284 9.86728 21.8778 9.94406 21.5299C9.91262 21.08 9.81271 20.6375 9.64781 20.2178C9.63057 20.1632 9.61763 20.1073 9.60908 20.0506C9.55449 19.776 9.56444 19.4924 9.63813 19.2223C9.71183 18.9521 9.84726 18.7028 10.0338 18.4939C10.2784 18.2493 11.1277 17.8505 11.3078 17.6188C11.4879 17.387 11.6163 17.1295 11.797 16.9114C12.3687 16.3412 13.0291 15.8675 13.7526 15.509C14.3444 15.1876 14.4477 14.364 14.6787 14.1065C15.0647 13.6689 15.6565 13.6689 16.0941 13.283C16.3129 13.09 16.6377 12.9867 16.8415 12.7815C17.8692 11.8403 19.1644 11.2423 20.5474 11.0706C21.5064 10.9924 22.4717 11.0795 23.4012 11.3281C23.5358 11.3507 23.669 11.3809 23.8001 11.4185C25.9228 11.4959 28.4709 11.9328 29.397 12.8338C29.8555 13.2744 30.1961 13.8229 30.3877 14.4293C30.5382 14.8988 30.7456 15.3481 31.0054 15.7672L31.5714 16.6933C31.932 17.2773 32.0475 17.9801 31.8928 18.6489C31.7885 18.974 31.7795 19.3223 31.8669 19.6525C32.1655 20.1031 32.5152 20.5177 32.9093 20.8878C33.0658 21.0427 33.2382 21.1807 33.4236 21.2995C33.8592 21.5594 34.2802 21.8429 34.6848 22.1489C34.698 22.2729 34.6775 22.3982 34.6254 22.5115C34.5732 22.6247 34.4914 22.7218 34.3885 22.7924C34.0284 23.1137 33.3333 23.6159 33.3333 23.6159C33.3584 23.758 33.4016 23.8964 33.4617 24.0276C33.5643 24.2077 33.796 24.4911 33.7192 24.735C33.6424 24.9789 33.1403 25.1855 33.2816 25.4552C33.423 25.7386 33.7831 25.8154 33.6805 26.0729C33.5779 26.3175 33.0757 26.7524 33.1274 26.9352C33.179 27.1179 33.5908 28.8377 32.6382 29.1353C31.4592 29.3685 30.2627 29.5019 29.0614 29.5342C28.8675 29.5454 28.6797 29.6055 28.5155 29.709C28.3513 29.8125 28.216 29.956 28.1223 30.126C27.9399 30.4661 27.8222 30.837 27.7751 31.22C27.4275 32.5896 26.9671 33.928 26.3985 35.2215C26.3985 35.2215 26.3597 35.2989 26.3081 35.4144C26.1833 35.6687 26.1048 35.9432 26.0764 36.2251C26.1573 36.4321 26.2799 36.6204 26.4365 36.7782C26.519 36.8726 26.6271 36.9411 26.7477 36.9753C26.8683 37.0096 26.9962 37.0081 27.116 36.9711C30.1997 35.8965 32.8655 33.8757 34.7332 31.197C36.601 28.5182 37.5754 25.3182 37.5175 22.0531Z",fill:o?"#ffffff":"#00DACC"})});var Chains={UnknownChain,Ethereum,Polygon,Optimism,Arbitrum,Aurora,Avalanche,Celo,Telos,Gnosis,Evmos,BinanceSmartChain,Foundry:KnownChain,Sepolia:KnownChain,Taraxa:KnownChain,zkSync:KnownChain,Flare:KnownChain,Canto,Fantom,Filecoin,Metis,IoTeX};const chainConfigs=[{id:1,name:"Ethereum",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{}),rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]}}},{id:3,name:"Rinkeby",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0}),rpcUrls:{}},{id:4,name:"Ropsten",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:5,name:"Görli",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:42,name:"Kovan",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:10,name:"Optimism",logo:jsxRuntimeExports.jsx(Chains.Optimism,{})},{id:69,name:"Optimism Kovan",logo:jsxRuntimeExports.jsx(Chains.Optimism,{testnet:!0})},{id:420,name:"Optimism Goerli",logo:jsxRuntimeExports.jsx(Chains.Optimism,{testnet:!0})},{id:137,name:"Polygon",logo:jsxRuntimeExports.jsx(Chains.Polygon,{})},{id:80001,name:"Polygon Mumbai",logo:jsxRuntimeExports.jsx(Chains.Polygon,{testnet:!0})},{id:31337,name:"Hardhat",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:1337,name:"Localhost",logo:jsxRuntimeExports.jsx(Chains.Ethereum,{testnet:!0})},{id:42161,name:"Arbitrum",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{}),rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]}}},{id:421611,name:"Arbitrum Rinkeby",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{testnet:!0})},{id:421613,name:"Arbitrum Goerli",logo:jsxRuntimeExports.jsx(Chains.Arbitrum,{testnet:!0}),rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]}}},{id:40,name:"Telos",logo:jsxRuntimeExports.jsx(Chains.Telos,{})},{id:41,name:"Telos Testnet",logo:jsxRuntimeExports.jsx(Chains.Telos,{testnet:!0})},{id:1313161554,name:"Aurora",logo:jsxRuntimeExports.jsx(Chains.Aurora,{})},{id:1313161555,name:"Aurora Testnet",logo:jsxRuntimeExports.jsx(Chains.Aurora,{testnet:!0})},{id:43114,name:"Avalanche",logo:jsxRuntimeExports.jsx(Chains.Avalanche,{})},{id:43113,name:"Avalanche Fuji",logo:jsxRuntimeExports.jsx(Chains.Avalanche,{testnet:!0})},{id:31337,name:"Foundry",logo:jsxRuntimeExports.jsx(Chains.Foundry,{testnet:!0})},{id:100,name:"Gnosis",logo:jsxRuntimeExports.jsx(Chains.Gnosis,{})},{id:9001,name:"Evmos",logo:jsxRuntimeExports.jsx(Chains.Evmos,{})},{id:9e3,name:"Evmos Testnet",logo:jsxRuntimeExports.jsx(Chains.Evmos,{testnet:!0})},{id:56,name:"BNB Smart Chain",logo:jsxRuntimeExports.jsx(Chains.BinanceSmartChain,{})},{id:97,name:"Binance Smart Chain Testnet",logo:jsxRuntimeExports.jsx(Chains.BinanceSmartChain,{testnet:!0})},{id:11155111,name:"Sepolia",logo:jsxRuntimeExports.jsx(Chains.Sepolia,{})},{id:841,name:"Taraxa",logo:jsxRuntimeExports.jsx(Chains.Taraxa,{})},{id:842,name:"Taraxa Testnet",logo:jsxRuntimeExports.jsx(Chains.Taraxa,{testnet:!0})},{id:324,name:"zkSync",logo:jsxRuntimeExports.jsx(Chains.zkSync,{})},{id:280,name:"zkSync Testnet",logo:jsxRuntimeExports.jsx(Chains.zkSync,{testnet:!0})},{id:42220,name:"Celo",logo:jsxRuntimeExports.jsx(Chains.Celo,{})},{id:44787,name:"Celo Alfajores",logo:jsxRuntimeExports.jsx(Chains.Celo,{testnet:!0})},{id:7700,name:"Canto",logo:jsxRuntimeExports.jsx(Chains.Canto,{})},{id:250,name:"Fantom",logo:jsxRuntimeExports.jsx(Chains.Fantom,{})},{id:4002,name:"Fantom Testnet",logo:jsxRuntimeExports.jsx(Chains.Fantom,{testnet:!0})},{id:14,name:"Flare",logo:jsxRuntimeExports.jsx(Chains.Flare,{})},{id:114,name:"Coston2",logo:jsxRuntimeExports.jsx(Chains.Flare,{})},{id:314,name:"Filecoin",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{})},{id:3141,name:"Filecoin Hyperspace",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{testnet:!0})},{id:314159,name:"Filecoin Calibration",logo:jsxRuntimeExports.jsx(Chains.Filecoin,{testnet:!0})},{id:1088,name:"Metis",logo:jsxRuntimeExports.jsx(Chains.Metis,{})},{id:599,name:"Metis Goerli",logo:jsxRuntimeExports.jsx(Chains.Metis,{testnet:!0})},{id:4689,name:"IoTeX",logo:jsxRuntimeExports.jsx(Chains.IoTeX,{})},{id:4690,name:"IoTeX Testnet",logo:jsxRuntimeExports.jsx(Chains.IoTeX,{testnet:!0})}],SwitchNetworksContainer=styled.div` display: flex; flex-direction: column; @@ -3181,7 +3181,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C @media only screen and (max-width: ${defaultTheme.mobileWidth}px) { inset: 0 var(--ck-dropdown-active-inset, -8px); } -`,Spinner$1=jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 16.75C2.69036 16.75 3.25 17.3096 3.25 18V19C3.25 26.5939 9.40609 32.75 17 32.75V35.25C8.02537 35.25 0.75 27.9746 0.75 19V18C0.75 17.3096 1.30964 16.75 2 16.75Z",fill:"url(#paint0_linear_1288_18701)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1288_18701",x1:"2",y1:"19.4884",x2:"16.8752",y2:"33.7485",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]}),ChainSelectList=({variant:o})=>{const{connector:et,chain:tt}=useAccount(),{chains:nt,isPending:rt,switchChain:ot,error:it}=useSwitchChain(),[st,at]=reactExports.useState(void 0),ct=useLocales({}),lt=isMobile(),dt=(it==null?void 0:it.code)===4902,ht=dt||!ot,pt=ft=>{ot&&(at(ft),ot({chainId:ft}))},{triggerResize:mt}=useContext();return jsxRuntimeExports.jsxs(SwitchNetworksContainer,{style:{marginBottom:ot!==void 0?-8:0},children:[jsxRuntimeExports.jsx(ChainButtonContainer,{children:jsxRuntimeExports.jsx(ChainButtons,{children:nt.map(ft=>{var yt;const xt={...chainConfigs.find(vt=>vt.id===ft.id),...ft};return jsxRuntimeExports.jsxs(ChainButton,{$variant:o,disabled:ht||xt.id===(tt==null?void 0:tt.id)||rt&&st===xt.id,onClick:()=>pt==null?void 0:pt(xt.id),style:{opacity:ht&&xt.id!==(tt==null?void 0:tt.id)?.4:void 0},children:[jsxRuntimeExports.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:12,color:xt.id===(tt==null?void 0:tt.id)?"var(--ck-dropdown-active-color, inherit)":"inherit"},children:[jsxRuntimeExports.jsxs(ChainLogoContainer,{children:[jsxRuntimeExports.jsx(ChainLogoSpinner,{initial:{opacity:0},animate:{opacity:rt&&st===xt.id?1:0},transition:{ease:[.76,0,.24,1],duration:.15,delay:.1},children:jsxRuntimeExports.jsx(motion.div,{animate:lt&&isCoinbaseWalletConnector(et==null?void 0:et.id)&&rt&&st===xt.id?{opacity:[1,0],transition:{delay:4,duration:3}}:{opacity:1},children:Spinner$1},`${xt==null?void 0:xt.id}-${xt==null?void 0:xt.name}`)}),jsxRuntimeExports.jsx(ChainIcon,{children:(yt=xt.logo)!==null&&yt!==void 0?yt:jsxRuntimeExports.jsx(Chains.UnknownChain,{})})]}),xt.name]}),o!=="secondary"&&jsxRuntimeExports.jsx(ChainButtonStatus,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,exitBeforeEnter:!0,children:[xt.id===(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsx(motion.span,{style:{color:"var(--ck-dropdown-active-color, var(--ck-focus-color))",display:"block",position:"relative"},initial:{opacity:0,x:-4},animate:{opacity:1,x:0},exit:{opacity:0,x:4,transition:{duration:.1,delay:0}},transition:{ease:[.76,0,.24,1],duration:.3,delay:.2},children:ct.connected},"connectedText"),rt&&st===xt.id&&jsxRuntimeExports.jsx(motion.span,{style:{color:"var(--ck-dropdown-pending-color, inherit)",display:"block",position:"relative"},initial:{opacity:0,x:-4},animate:{opacity:1,x:0},exit:{opacity:0,x:4},transition:{ease:[.76,0,.24,1],duration:.3,delay:.1},children:jsxRuntimeExports.jsx(motion.span,{animate:lt&&isCoinbaseWalletConnector(et==null?void 0:et.id)&&{opacity:[1,0],transition:{delay:4,duration:4}},children:ct.approveInWallet})},"approveText")]})}),o==="secondary"?jsxRuntimeExports.jsx(ChainButtonBg,{initial:!1,animate:{opacity:xt.id===(tt==null?void 0:tt.id)?1:0},transition:{duration:.3,ease:"easeOut"}}):xt.id===(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsx(ChainButtonBg,{layoutId:"activeChain",layout:"position",transition:{duration:.3,ease:"easeOut"}})]},`${xt==null?void 0:xt.id}-${xt==null?void 0:xt.name}`)})})}),jsxRuntimeExports.jsx(AnimatePresence,{children:dt&&jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:[.76,0,.24,1],duration:.3},onAnimationStart:mt,onAnimationComplete:mt,children:jsxRuntimeExports.jsx("div",{style:{paddingTop:10,paddingBottom:8},children:jsxRuntimeExports.jsxs(Alert,{children:[ct.warnings_walletSwitchingUnsupported," ",ct.warnings_walletSwitchingUnsupportedResolve]})})})})]})},DropdownWindow=styled(motion.div)` +`,Spinner$1=jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 16.75C2.69036 16.75 3.25 17.3096 3.25 18V19C3.25 26.5939 9.40609 32.75 17 32.75V35.25C8.02537 35.25 0.75 27.9746 0.75 19V18C0.75 17.3096 1.30964 16.75 2 16.75Z",fill:"url(#paint0_linear_1288_18701)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1288_18701",x1:"2",y1:"19.4884",x2:"16.8752",y2:"33.7485",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]}),ChainSelectList=({variant:o})=>{const{connector:et,chain:tt}=useAccount(),{chains:nt,isPending:rt,switchChain:ot,error:it}=useSwitchChain(),[st,at]=reactExports.useState(void 0),ct=useLocales({}),lt=isMobile(),dt=(it==null?void 0:it.code)===4902,ht=dt||!ot,ft=pt=>{ot&&(at(pt),ot({chainId:pt}))},{triggerResize:mt}=useContext();return jsxRuntimeExports.jsxs(SwitchNetworksContainer,{style:{marginBottom:ot!==void 0?-8:0},children:[jsxRuntimeExports.jsx(ChainButtonContainer,{children:jsxRuntimeExports.jsx(ChainButtons,{children:nt.map(pt=>{var yt;const xt={...chainConfigs.find(vt=>vt.id===pt.id),...pt};return jsxRuntimeExports.jsxs(ChainButton,{$variant:o,disabled:ht||xt.id===(tt==null?void 0:tt.id)||rt&&st===xt.id,onClick:()=>ft==null?void 0:ft(xt.id),style:{opacity:ht&&xt.id!==(tt==null?void 0:tt.id)?.4:void 0},children:[jsxRuntimeExports.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:12,color:xt.id===(tt==null?void 0:tt.id)?"var(--ck-dropdown-active-color, inherit)":"inherit"},children:[jsxRuntimeExports.jsxs(ChainLogoContainer,{children:[jsxRuntimeExports.jsx(ChainLogoSpinner,{initial:{opacity:0},animate:{opacity:rt&&st===xt.id?1:0},transition:{ease:[.76,0,.24,1],duration:.15,delay:.1},children:jsxRuntimeExports.jsx(motion.div,{animate:lt&&isCoinbaseWalletConnector(et==null?void 0:et.id)&&rt&&st===xt.id?{opacity:[1,0],transition:{delay:4,duration:3}}:{opacity:1},children:Spinner$1},`${xt==null?void 0:xt.id}-${xt==null?void 0:xt.name}`)}),jsxRuntimeExports.jsx(ChainIcon,{children:(yt=xt.logo)!==null&&yt!==void 0?yt:jsxRuntimeExports.jsx(Chains.UnknownChain,{})})]}),xt.name]}),o!=="secondary"&&jsxRuntimeExports.jsx(ChainButtonStatus,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,exitBeforeEnter:!0,children:[xt.id===(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsx(motion.span,{style:{color:"var(--ck-dropdown-active-color, var(--ck-focus-color))",display:"block",position:"relative"},initial:{opacity:0,x:-4},animate:{opacity:1,x:0},exit:{opacity:0,x:4,transition:{duration:.1,delay:0}},transition:{ease:[.76,0,.24,1],duration:.3,delay:.2},children:ct.connected},"connectedText"),rt&&st===xt.id&&jsxRuntimeExports.jsx(motion.span,{style:{color:"var(--ck-dropdown-pending-color, inherit)",display:"block",position:"relative"},initial:{opacity:0,x:-4},animate:{opacity:1,x:0},exit:{opacity:0,x:4},transition:{ease:[.76,0,.24,1],duration:.3,delay:.1},children:jsxRuntimeExports.jsx(motion.span,{animate:lt&&isCoinbaseWalletConnector(et==null?void 0:et.id)&&{opacity:[1,0],transition:{delay:4,duration:4}},children:ct.approveInWallet})},"approveText")]})}),o==="secondary"?jsxRuntimeExports.jsx(ChainButtonBg,{initial:!1,animate:{opacity:xt.id===(tt==null?void 0:tt.id)?1:0},transition:{duration:.3,ease:"easeOut"}}):xt.id===(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsx(ChainButtonBg,{layoutId:"activeChain",layout:"position",transition:{duration:.3,ease:"easeOut"}})]},`${xt==null?void 0:xt.id}-${xt==null?void 0:xt.name}`)})})}),jsxRuntimeExports.jsx(AnimatePresence,{children:dt&&jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:[.76,0,.24,1],duration:.3},onAnimationStart:mt,onAnimationComplete:mt,children:jsxRuntimeExports.jsx("div",{style:{paddingTop:10,paddingBottom:8},children:jsxRuntimeExports.jsxs(Alert,{children:[ct.warnings_walletSwitchingUnsupported," ",ct.warnings_walletSwitchingUnsupportedResolve]})})})})]})},DropdownWindow=styled(motion.div)` z-index: 2147483647; position: fixed; inset: 0; @@ -3218,7 +3218,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C font-weight: 400; user-select: none; color: var(--ck-dropdown-color, var(--ck-tooltip-color)); -`,ChainSelectDropdown=({children:o,open:et,onClose:tt,offsetX:nt=0,offsetY:rt=8})=>{var ot,it,st;const at=useContext(),ct=useThemeContext(),lt=useLocales(),[dt,ht]=reactExports.useState({x:0,y:0});useLockBodyScroll(et);const pt=reactExports.useRef(null);reactExports.useEffect(()=>{const wt=kt=>{var It,Rt,Pt;if(et&&(kt.key==="Escape"&&tt(),kt.key==="ArrowDown"||kt.key==="ArrowUp")){if(!pt.current)return;kt.preventDefault();const jt=(It=pt.current)===null||It===void 0?void 0:It.querySelectorAll(` +`,ChainSelectDropdown=({children:o,open:et,onClose:tt,offsetX:nt=0,offsetY:rt=8})=>{var ot,it,st;const at=useContext(),ct=useThemeContext(),lt=useLocales(),[dt,ht]=reactExports.useState({x:0,y:0});useLockBodyScroll(et);const ft=reactExports.useRef(null);reactExports.useEffect(()=>{const wt=kt=>{var It,Rt,$t;if(et&&(kt.key==="Escape"&&tt(),kt.key==="ArrowDown"||kt.key==="ArrowUp")){if(!ft.current)return;kt.preventDefault();const Nt=(It=ft.current)===null||It===void 0?void 0:It.querySelectorAll(` a[href]:not(:disabled), button:not(:disabled), textarea:not(:disabled), @@ -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) - `),Ot=jt[0],Bt=jt[jt.length-1];if(kt.key==="ArrowUp")if(document.activeElement===Ot)Bt.focus();else{let zt=(Rt=document==null?void 0:document.activeElement)===null||Rt===void 0?void 0:Rt.previousSibling;for(zt||(zt=Bt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Bt)Ot.focus();else{let zt=(Pt=document==null?void 0:document.activeElement)===null||Pt===void 0?void 0:Pt.nextSibling;for(zt||(zt=Ot);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",wt),()=>{document.removeEventListener("keydown",wt)}},[et]);const mt=reactExports.useRef(null),ft=reactExports.useCallback(wt=>{wt&&(mt.current=wt,xt())},[et]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),xt=()=>{if(!mt.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let wt=gt.left+nt,kt=gt.top+gt.height+rt;mt.current.style.left=`${wt}px`,mt.current.style.top=`${kt}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(xt,[mt.current,gt,et]),reactExports.useEffect(xt,[et,mt.current]);const bt=tt,Et=tt;return reactExports.useEffect(()=>(xt(),window.addEventListener("scroll",bt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",bt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:o}),jsxRuntimeExports.jsx(AnimatePresence,{children:et&&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:pt,children:[jsxRuntimeExports.jsx(DropdownOverlay,{onClick:tt}),jsxRuntimeExports.jsxs(DropdownContainer,{ref:ft,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` + `),Mt=Nt[0],Bt=Nt[Nt.length-1];if(kt.key==="ArrowUp")if(document.activeElement===Mt)Bt.focus();else{let zt=(Rt=document==null?void 0:document.activeElement)===null||Rt===void 0?void 0:Rt.previousSibling;for(zt||(zt=Bt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Bt)Mt.focus();else{let zt=($t=document==null?void 0:document.activeElement)===null||$t===void 0?void 0:$t.nextSibling;for(zt||(zt=Mt);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",wt),()=>{document.removeEventListener("keydown",wt)}},[et]);const mt=reactExports.useRef(null),pt=reactExports.useCallback(wt=>{wt&&(mt.current=wt,xt())},[et]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),xt=()=>{if(!mt.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let wt=gt.left+nt,kt=gt.top+gt.height+rt;mt.current.style.left=`${wt}px`,mt.current.style.top=`${kt}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(xt,[mt.current,gt,et]),reactExports.useEffect(xt,[et,mt.current]);const bt=tt,Et=tt;return reactExports.useEffect(()=>(xt(),window.addEventListener("scroll",bt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",bt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:o}),jsxRuntimeExports.jsx(AnimatePresence,{children:et&&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:ft,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; ${o=>typeof o.size=="string"?Ae` @@ -3393,7 +3393,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C } } `} -`,ChevronDown=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"11",height:"6",viewBox:"0 0 11 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1.5 1L5.5 5L9.5 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),ChainSelector=()=>{const o=useContext(),[et,tt]=reactExports.useState(!1),{chain:nt}=useAccount(),{chains:rt}=useSwitchChain(),ot=useLocales({CHAIN:nt==null?void 0:nt.name}),it=isMobile()||(window==null?void 0:window.innerWidth){o.open||tt(!1)},[o.open]);const st=rt.length<=1;return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Container$3,{children:jsxRuntimeExports.jsx(ChainSelectDropdown,{offsetX:-12,open:!it&&et,onClose:()=>tt(!1),children:jsxRuntimeExports.jsxs(SwitchChainButton,{"aria-label":flattenChildren(ot.switchNetworks).toString(),disabled:st,onClick:()=>{it?o.setRoute(routes.SWITCHNETWORKS):tt(!et)},children:[st?jsxRuntimeExports.jsx(Tooltip,{message:ot.chainNetwork,xOffset:-6,delay:.01,children:jsxRuntimeExports.jsx(Chain,{id:nt==null?void 0:nt.id})}):jsxRuntimeExports.jsx(Chain,{id:nt==null?void 0:nt.id}),!st&&jsxRuntimeExports.jsx(ChevronDown,{style:{top:1,left:-3}})]})})})})},Profile=({closeModal:o})=>{var et,tt,nt;const rt=useContext(),ot=useThemeContext(),it=useLocales(),{reset:st}=useConnect$1(),{disconnect:at}=useDisconnect(),{address:ct,isConnected:lt,connector:dt,chain:ht}=useAccount(),pt=useEnsFallbackConfig(),{data:mt}=useEnsName({chainId:1,address:ct,config:pt}),{data:ft}=useBalance({address:ct}),[yt,gt]=reactExports.useState(!1);reactExports.useEffect(()=>{lt||rt.setOpen(!1)},[lt]),reactExports.useEffect(()=>{if(yt)return o?o():rt.setOpen(!1),()=>{at(),st()}},[yt,at,st]);const xt=["web95","rounded","minimal"].includes((tt=(et=ot.theme)!==null&&et!==void 0?et:rt.theme)!==null&&tt!==void 0?tt:"")?"....":void 0;return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:22,gap:6},children:[jsxRuntimeExports.jsx(AvatarContainer,{children:jsxRuntimeExports.jsxs(AvatarInner,{children:[jsxRuntimeExports.jsx(ChainSelectorContainer,{children:jsxRuntimeExports.jsx(ChainSelector,{})}),jsxRuntimeExports.jsx(Avatar,{address:ct})]})}),jsxRuntimeExports.jsx(ModalH1,{children:jsxRuntimeExports.jsx(CopyToClipboard,{string:ct,children:mt??truncateEthAddress(ct,xt)})}),!((nt=rt==null?void 0:rt.options)===null||nt===void 0)&&nt.hideBalance?null:jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(BalanceContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{exitBeforeEnter:!0,initial:!1,children:[ft&&jsxRuntimeExports.jsxs(Balance$1,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[nFormatter(Number(ft==null?void 0:ft.formatted))," ",ft==null?void 0:ft.symbol]},`chain-${ht==null?void 0:ht.id}`),!ft&&jsxRuntimeExports.jsx(LoadingBalance,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:" "})]})})})]}),!isSafeConnector(dt==null?void 0:dt.id)&&jsxRuntimeExports.jsx(Button$1,{onClick:()=>gt(!0),icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:it.disconnect})]})},SwitchNetworks=()=>{const{reset:o}=useConnect$1(),{disconnect:et}=useDisconnect(),{connector:tt,chain:nt}=useAccount(),rt=useChainIsSupported(nt==null?void 0:nt.id),ot=useLocales({}),it=()=>{et(),o()};return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[!rt&&jsxRuntimeExports.jsxs(ModalBody,{children:[ot.warnings_chainUnsupported," ",ot.warnings_chainUnsupportedResolve]}),jsxRuntimeExports.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntimeExports.jsx(ChainSelectList,{variant:"secondary"})}),!rt&&!isSafeConnector(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsxs("div",{style:{paddingTop:12},children:[jsxRuntimeExports.jsx(OrDivider,{}),jsxRuntimeExports.jsx(Button$1,{icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),variant:"secondary",onClick:it,children:ot.disconnect})]})]})})},spinKeyframes=We` +`,ChevronDown=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"11",height:"6",viewBox:"0 0 11 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1.5 1L5.5 5L9.5 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),ChainSelector=()=>{const o=useContext(),[et,tt]=reactExports.useState(!1),{chain:nt}=useAccount(),{chains:rt}=useSwitchChain(),ot=useLocales({CHAIN:nt==null?void 0:nt.name}),it=isMobile()||(window==null?void 0:window.innerWidth){o.open||tt(!1)},[o.open]);const st=rt.length<=1;return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Container$3,{children:jsxRuntimeExports.jsx(ChainSelectDropdown,{offsetX:-12,open:!it&&et,onClose:()=>tt(!1),children:jsxRuntimeExports.jsxs(SwitchChainButton,{"aria-label":flattenChildren(ot.switchNetworks).toString(),disabled:st,onClick:()=>{it?o.setRoute(routes.SWITCHNETWORKS):tt(!et)},children:[st?jsxRuntimeExports.jsx(Tooltip,{message:ot.chainNetwork,xOffset:-6,delay:.01,children:jsxRuntimeExports.jsx(Chain,{id:nt==null?void 0:nt.id})}):jsxRuntimeExports.jsx(Chain,{id:nt==null?void 0:nt.id}),!st&&jsxRuntimeExports.jsx(ChevronDown,{style:{top:1,left:-3}})]})})})})},Profile=({closeModal:o})=>{var et,tt,nt;const rt=useContext(),ot=useThemeContext(),it=useLocales(),{reset:st}=useConnect$1(),{disconnect:at}=useDisconnect(),{address:ct,isConnected:lt,connector:dt,chain:ht}=useAccount(),ft=useEnsFallbackConfig(),{data:mt}=useEnsName({chainId:1,address:ct,config:ft}),{data:pt}=useBalance({address:ct}),[yt,gt]=reactExports.useState(!1);reactExports.useEffect(()=>{lt||rt.setOpen(!1)},[lt]),reactExports.useEffect(()=>{if(yt)return o?o():rt.setOpen(!1),()=>{at(),st()}},[yt,at,st]);const xt=["web95","rounded","minimal"].includes((tt=(et=ot.theme)!==null&&et!==void 0?et:rt.theme)!==null&&tt!==void 0?tt:"")?"....":void 0;return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:22,gap:6},children:[jsxRuntimeExports.jsx(AvatarContainer,{children:jsxRuntimeExports.jsxs(AvatarInner,{children:[jsxRuntimeExports.jsx(ChainSelectorContainer,{children:jsxRuntimeExports.jsx(ChainSelector,{})}),jsxRuntimeExports.jsx(Avatar,{address:ct})]})}),jsxRuntimeExports.jsx(ModalH1,{children:jsxRuntimeExports.jsx(CopyToClipboard,{string:ct,children:mt??truncateEthAddress(ct,xt)})}),!((nt=rt==null?void 0:rt.options)===null||nt===void 0)&&nt.hideBalance?null:jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(BalanceContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{exitBeforeEnter:!0,initial:!1,children:[pt&&jsxRuntimeExports.jsxs(Balance$1,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[nFormatter(Number(pt==null?void 0:pt.formatted))," ",pt==null?void 0:pt.symbol]},`chain-${ht==null?void 0:ht.id}`),!pt&&jsxRuntimeExports.jsx(LoadingBalance,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:" "})]})})})]}),!isSafeConnector(dt==null?void 0:dt.id)&&jsxRuntimeExports.jsx(Button$1,{onClick:()=>gt(!0),icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:it.disconnect})]})},SwitchNetworks=()=>{const{reset:o}=useConnect$1(),{disconnect:et}=useDisconnect(),{connector:tt,chain:nt}=useAccount(),rt=useChainIsSupported(nt==null?void 0:nt.id),ot=useLocales({}),it=()=>{et(),o()};return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[!rt&&jsxRuntimeExports.jsxs(ModalBody,{children:[ot.warnings_chainUnsupported," ",ot.warnings_chainUnsupportedResolve]}),jsxRuntimeExports.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntimeExports.jsx(ChainSelectList,{variant:"secondary"})}),!rt&&!isSafeConnector(tt==null?void 0:tt.id)&&jsxRuntimeExports.jsxs("div",{style:{paddingTop:12},children:[jsxRuntimeExports.jsx(OrDivider,{}),jsxRuntimeExports.jsx(Button$1,{icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),variant:"secondary",onClick:it,children:ot.disconnect})]})]})})},spinKeyframes=We` from{ transform: rotate(0deg); } to{ transform: rotate(360deg); } `,lineKeyframes=We` @@ -3591,7 +3591,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C } } `}; -`,SIWEButton=({showSignOutButton:o,onSignIn:et,onSignOut:tt})=>{const nt=useIsMounted(),rt=useLocales(),{setOpen:ot}=useModal(),{isSignedIn:it,isReady:st,isLoading:at,isRejected:ct,isSuccess:lt,isError:dt,signIn:ht,signOut:pt,error:mt}=useSIWE({onSignIn:gt=>et==null?void 0:et(gt),onSignOut:()=>tt==null?void 0:tt()}),{address:ft}=useAccount();function yt(){return lt?rt.signedIn:ct?rt.tryAgain:at?rt.awaitingConfirmation:dt?mt??"Unknown Error":rt.signIn}return nt?o&&it?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:pt,icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:rt.signOut},"button"):ft?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},arrow:it?!1:!at&&!ct,onClick:!at&&!lt?ht:void 0,disabled:at,waiting:at,icon:ct&&jsxRuntimeExports.jsx(motion.div,{initial:{rotate:-270},animate:{rotate:0},transition:{duration:1,ease:[.175,.885,.32,.98]},children:jsxRuntimeExports.jsx(RetryIcon,{style:{opacity:.4}})}),children:yt()},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:()=>ot(!0),arrow:!0,children:rt.walletNotConnected},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},disabled:!0},"loading")},LazyImage=({src:o,alt:et,width:tt,height:nt})=>{const rt=reactExports.useRef(null),[ot,it]=reactExports.useState(!0);return reactExports.useEffect(()=>{rt.current&&rt.current.complete&&rt.current.naturalHeight!==0||it(!1)},[o]),jsxRuntimeExports.jsx("div",{style:{width:tt,height:nt,background:"rgba(0,0,0,0.02)",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.02)"},children:jsxRuntimeExports.jsx("img",{ref:rt,src:o,alt:et,width:tt,height:nt,onLoad:()=>it(!0),style:{transition:"opacity 0.2s ease",opacity:ot?1:0}})})},transition={duration:.2,ease:[.26,.08,.25,1]},copyTransition={duration:.16,ease:[.26,.08,.25,1]},SignInWithEthereum=()=>{var o,et;const tt=useContext(),{isSignedIn:nt,reset:rt}=useSIWE(),ot=isMobile(),[it,st]=reactExports.useState(nt?"signedIn":"signedOut"),at=useLocales({}),ct=it==="signedIn"?{heading:at.signInWithEthereumScreen_signedIn_heading,h1:at.signInWithEthereumScreen_signedIn_h1,p:at.signInWithEthereumScreen_signedIn_p,button:at.signInWithEthereumScreen_signedIn_button}:{heading:at.signInWithEthereumScreen_signedOut_heading,h1:at.signInWithEthereumScreen_signedOut_h1,p:at.signInWithEthereumScreen_signedOut_p,button:at.signInWithEthereumScreen_signedOut_button};reactExports.useEffect(()=>{nt&&st("signedIn")},[]),reactExports.useEffect(()=>{nt||st("signedOut")},[nt]);const{address:lt}=useAccount(),ht=(()=>{const mt={svg:null,default:null},ft=document.getElementsByTagName("link");return Array.from(ft).forEach(yt=>{(yt.getAttribute("rel")==="icon"||yt.getAttribute("rel")==="shortcut icon")&&yt.getAttribute("href")&&(yt.getAttribute("type")==="image/svg+xml"?mt.svg=yt.getAttribute("href"):mt.default=yt.getAttribute("href"))}),mt})(),pt=(et=(o=getAppIcon())!==null&&o!==void 0?o:ht.svg)!==null&&et!==void 0?et:ht.default;return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[jsxRuntimeExports.jsx(ContentContainer,{children:jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42},children:jsxRuntimeExports.jsx(FitText,{children:ct.h1})})},flattenChildren(ct.h1).toString())})}),jsxRuntimeExports.jsxs(StatusGraphic,{$connected:nt,children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0},children:jsxRuntimeExports.jsx(StatusGraphicBgSvg,{width:"262",height:"134",viewBox:"0 0 262 134",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx(motion.rect,{x:"0",y:"0",rx:"12",width:"262",height:"134",strokeDasharray:"3 3",animate:{strokeDashoffset:[0,-6]},transition:{duration:.4,ease:"linear",repeat:1/0}})})}),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:50,scale:.8},animate:{opacity:1,x:0,scale:1},transition,children:jsxRuntimeExports.jsx(LogoContainer,{children:jsxRuntimeExports.jsx(Avatar,{address:lt,size:64})})},"avatarImage"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{scale:.6},animate:{scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(StatusIcon,{children:jsxRuntimeExports.jsx(TickIcon,{})})},"tickIcon"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:-40,scale:.8},animate:{opacity:1,x:0,scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(LogoContainer,{children:pt?jsxRuntimeExports.jsx(LazyImage,{src:pt,alt:"app"}):jsxRuntimeExports.jsx(Chains.UnknownChain,{})})},"appLogo")]},"status"),jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{style:{paddingBottom:ot?24:12},initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42,marginTop:-1,marginBottom:-3},children:jsxRuntimeExports.jsx(FitText,{children:ct.p})})},flattenChildren(ct.p).toString())}),jsxRuntimeExports.jsx(SIWEButton,{showSignOutButton:it==="signedIn",onSignIn:()=>{setTimeout(()=>{tt.setOpen(!1)},1e3)}})]})})},customThemeDefault$1={},ConnectModal$1=({mode:o="auto",theme:et="auto",customTheme:tt=customThemeDefault$1,lang:nt="en-US"})=>{var rt;const ot=useContext(),{isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=!(!((rt=ot.options)===null||rt===void 0)&&rt.enforceSupportedChains&&it&&!at),lt=ct&&ot.route!==routes.CONNECTORS&&ot.route!==routes.PROFILE,dt=ct&&ot.route!==routes.PROFILE,ht=()=>{ot.route===routes.SIGNINWITHETHEREUM||ot.route===routes.SWITCHNETWORKS?ot.setRoute(routes.PROFILE):ot.route===routes.DOWNLOAD?ot.setRoute(routes.CONNECT):ot.setRoute(routes.CONNECTORS)},pt={onboarding:jsxRuntimeExports.jsx(Introduction,{}),about:jsxRuntimeExports.jsx(About,{}),download:jsxRuntimeExports.jsx(DownloadApp,{}),connectors:jsxRuntimeExports.jsx(Wallets,{}),mobileConnectors:jsxRuntimeExports.jsx(MobileConnectors,{}),connect:jsxRuntimeExports.jsx(ConnectUsing,{}),profile:jsxRuntimeExports.jsx(Profile,{}),switchNetworks:jsxRuntimeExports.jsx(SwitchNetworks,{}),signInWithEthereum:jsxRuntimeExports.jsx(SignInWithEthereum,{})};function mt(){ot.setOpen(!1)}return reactExports.useEffect(()=>{var ft;it?(ot.route!==routes.PROFILE||ot.route!==routes.SIGNINWITHETHEREUM)&&(ot.signInWithEthereum&&!(!((ft=ot.options)===null||ft===void 0)&&ft.disableSiweRedirect)?ot.setRoute(routes.SIGNINWITHETHEREUM):mt()):mt()},[it]),reactExports.useEffect(()=>ot.setMode(o),[o]),reactExports.useEffect(()=>ot.setTheme(et),[et]),reactExports.useEffect(()=>ot.setCustomTheme(tt),[tt]),reactExports.useEffect(()=>ot.setLang(nt),[nt]),reactExports.useEffect(()=>{const ft=getAppName();if(!ft||!ot.open)return;const yt=document.createElement("meta");return yt.setAttribute("property","og:title"),yt.setAttribute("content",ft),document.head.prepend(yt),()=>{document.head.removeChild(yt)}},[ot.open]),jsxRuntimeExports.jsx(ConnectKitThemeProvider,{theme:et,customTheme:tt,mode:o,children:jsxRuntimeExports.jsx(Modal,{open:ot.open,pages:pt,pageId:ot.route,onClose:ct?mt:void 0,onInfo:dt?()=>ot.setRoute(routes.ABOUT):void 0,onBack:lt?ht:void 0})})};function useGoogleFont(o){reactExports.useEffect(()=>{if(!o)return;o=o.replace(/ /g,"+");const et=document.createElement("link");et.href="https://fonts.googleapis.com",et.rel="preconnect";const tt=document.createElement("link");tt.href="https://fonts.gstatic.com",tt.rel="preconnect",tt.crossOrigin="true";const nt=document.createElement("link");return nt.href=`https://fonts.googleapis.com/css2?family=${o}:wght@400;500;600&display=swap`,nt.rel="stylesheet",document.head.appendChild(et),document.head.appendChild(tt),document.head.appendChild(nt),()=>{document.head.removeChild(et),document.head.removeChild(tt),document.head.removeChild(nt)}},[o])}function useThemeFont(o){var et;const nt=(et={web95:"Lato",retro:"Nunito",midnight:"Inter",minimal:"Inter",rounded:"Nunito"}[o])!==null&&et!==void 0?et:null;useGoogleFont(nt??"")}const useConnectCallback=({onConnect:o,onDisconnect:et})=>{useAccountEffect({onConnect:({address:tt,connector:nt,isReconnected:rt})=>{rt||o==null||o({address:tt,connectorId:nt==null?void 0:nt.id})},onDisconnect:()=>et==null?void 0:et()})},routes={ONBOARDING:"onboarding",ABOUT:"about",CONNECTORS:"connectors",MOBILECONNECTORS:"mobileConnectors",CONNECT:"connect",DOWNLOAD:"download",PROFILE:"profile",SWITCHNETWORKS:"switchNetworks",SIGNINWITHETHEREUM:"signInWithEthereum"},Context=reactExports.createContext(null),ConnectKitProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt,options:rt,onConnect:ot,onDisconnect:it,debugMode:st=!1})=>{var at,ct,lt,dt;if(!React.useContext(WagmiContext))throw Error("ConnectKitProvider must be within a WagmiProvider");if(React.useContext(Context))throw new Error("Multiple, nested usages of ConnectKitProvider detected. Please use only one.");useConnectCallback({onConnect:ot,onDisconnect:it});const ht=useChains(),pt=useConnector("injected"),mt={language:"en-US",hideBalance:!1,hideTooltips:!1,hideQuestionMarkCTA:!1,hideNoWalletCTA:!1,walletConnectCTA:"link",hideRecentBadge:!1,avoidLayoutShift:!0,embedGoogleFonts:!1,truncateLongENSAddress:!0,walletConnectName:void 0,reducedMotion:!1,disclaimer:null,bufferPolyfill:!0,customAvatar:void 0,initialChainId:(at=ht==null?void 0:ht[0])===null||at===void 0?void 0:at.id,enforceSupportedChains:!1,ethereumOnboardingUrl:void 0,walletOnboardingUrl:void 0,disableSiweRedirect:!1},ft=Object.assign({},mt,rt);typeof window<"u"&&ft.bufferPolyfill&&(window.Buffer=(ct=window.Buffer)!==null&&ct!==void 0?ct:buffer$2.Buffer);const[yt,gt]=reactExports.useState(et),[xt,vt]=reactExports.useState(tt),[bt,Et]=reactExports.useState(nt??{}),[wt,kt]=reactExports.useState("en-US"),[It,Rt]=reactExports.useState(!1),[Pt,jt]=reactExports.useState({id:""}),[Ot,Bt]=reactExports.useState(routes.CONNECTORS),[zt,Ft]=reactExports.useState(""),[Yt,Ht]=reactExports.useState(0);ft.embedGoogleFonts&&useThemeFont(et),reactExports.useEffect(()=>gt(et),[et]),reactExports.useEffect(()=>kt(ft.language||"en-US"),[ft.language]),reactExports.useEffect(()=>Ft(null),[Ot,It]);const{chain:Ut,isConnected:qt}=useAccount(),Lt=useChainIsSupported(Ut==null?void 0:Ut.id);reactExports.useEffect(()=>{qt&&ft.enforceSupportedChains&&!Lt&&(Rt(!0),Bt(routes.SWITCHNETWORKS))},[qt,Lt,Ut,Ot,It]),reactExports.useEffect(()=>{isFamily()&&(pt==null||pt.connect())},[pt]);const Zt=st?console.log:()=>{},Qt={theme:yt,setTheme:gt,mode:xt,setMode:vt,customTheme:nt,setCustomTheme:Et,lang:wt,setLang:kt,open:It,setOpen:Rt,route:Ot,setRoute:Bt,connector:Pt,setConnector:jt,signInWithEthereum:(dt=(lt=React.useContext(SIWEContext))===null||lt===void 0?void 0:lt.enabled)!==null&&dt!==void 0?dt:!1,onConnect:ot,options:ft,errorMessage:zt,debugMode:st,log:Zt,displayError:(Nt,Gt)=>{Ft(Nt),console.log("---------CONNECTKIT DEBUG---------"),console.log(Nt),Gt&&console.table(Gt),console.log("---------/CONNECTKIT DEBUG---------")},resize:Yt,triggerResize:()=>Ht(Nt=>Nt+1)};return reactExports.createElement(Context.Provider,{value:Qt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Web3ContextProvider,{enabled:It,children:jsxRuntimeExports.jsxs(Le,{theme:defaultTheme$1,children:[o,jsxRuntimeExports.jsx(ConnectModal$1,{lang:wt,theme:yt,mode:tt,customTheme:bt})]})})}))},useContext=()=>{const o=React.useContext(Context);if(!o)throw Error("ConnectKit Hook must be inside a Provider.");return o},safeRoutes={disconnected:[routes.CONNECTORS,routes.ABOUT,routes.ONBOARDING,routes.MOBILECONNECTORS,routes.ONBOARDING],connected:[routes.PROFILE,routes.SWITCHNETWORKS,routes.SIGNINWITHETHEREUM]},allRoutes=[...safeRoutes.connected,...safeRoutes.disconnected],useModal=({onConnect:o,onDisconnect:et}={})=>{const tt=useContext();useConnectCallback({onConnect:o,onDisconnect:et});const{isConnected:nt}=useAccount(),{signIn:rt}=useSIWE(),ot=()=>{tt.setOpen(!1)},it=()=>{tt.setOpen(!0)},st=at=>{let ct=at;allRoutes.includes(at)?nt?safeRoutes.connected.includes(at)||(ct=routes.PROFILE,tt.log(`Route ${at} is not a valid route when connected, navigating to ${ct} instead.`)):safeRoutes.disconnected.includes(at)||(ct=routes.CONNECTORS,tt.log(`Route ${at} is not a valid route when disconnected, navigating to ${ct} instead.`)):(ct=nt?routes.PROFILE:routes.CONNECTORS,tt.log(`Route ${at} is not a valid route, navigating to ${ct} instead.`)),tt.setRoute(ct),it()};return{open:tt.open,setOpen:at=>{at?st(nt?routes.PROFILE:routes.CONNECTORS):ot()},openAbout:()=>st(routes.ABOUT),openOnboarding:()=>st(routes.ONBOARDING),openProfile:()=>st(routes.PROFILE),openSwitchNetworks:()=>st(routes.SWITCHNETWORKS),openSIWE:at=>{st(routes.SIGNINWITHETHEREUM),at&&rt()}}},TextContainer=styled(motion.div)` +`,SIWEButton=({showSignOutButton:o,onSignIn:et,onSignOut:tt})=>{const nt=useIsMounted(),rt=useLocales(),{setOpen:ot}=useModal(),{isSignedIn:it,isReady:st,isLoading:at,isRejected:ct,isSuccess:lt,isError:dt,signIn:ht,signOut:ft,error:mt}=useSIWE({onSignIn:gt=>et==null?void 0:et(gt),onSignOut:()=>tt==null?void 0:tt()}),{address:pt}=useAccount();function yt(){return lt?rt.signedIn:ct?rt.tryAgain:at?rt.awaitingConfirmation:dt?mt??"Unknown Error":rt.signIn}return nt?o&&it?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:ft,icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:rt.signOut},"button"):pt?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},arrow:it?!1:!at&&!ct,onClick:!at&&!lt?ht:void 0,disabled:at,waiting:at,icon:ct&&jsxRuntimeExports.jsx(motion.div,{initial:{rotate:-270},animate:{rotate:0},transition:{duration:1,ease:[.175,.885,.32,.98]},children:jsxRuntimeExports.jsx(RetryIcon,{style:{opacity:.4}})}),children:yt()},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:()=>ot(!0),arrow:!0,children:rt.walletNotConnected},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},disabled:!0},"loading")},LazyImage=({src:o,alt:et,width:tt,height:nt})=>{const rt=reactExports.useRef(null),[ot,it]=reactExports.useState(!0);return reactExports.useEffect(()=>{rt.current&&rt.current.complete&&rt.current.naturalHeight!==0||it(!1)},[o]),jsxRuntimeExports.jsx("div",{style:{width:tt,height:nt,background:"rgba(0,0,0,0.02)",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.02)"},children:jsxRuntimeExports.jsx("img",{ref:rt,src:o,alt:et,width:tt,height:nt,onLoad:()=>it(!0),style:{transition:"opacity 0.2s ease",opacity:ot?1:0}})})},transition={duration:.2,ease:[.26,.08,.25,1]},copyTransition={duration:.16,ease:[.26,.08,.25,1]},SignInWithEthereum=()=>{var o,et;const tt=useContext(),{isSignedIn:nt,reset:rt}=useSIWE(),ot=isMobile(),[it,st]=reactExports.useState(nt?"signedIn":"signedOut"),at=useLocales({}),ct=it==="signedIn"?{heading:at.signInWithEthereumScreen_signedIn_heading,h1:at.signInWithEthereumScreen_signedIn_h1,p:at.signInWithEthereumScreen_signedIn_p,button:at.signInWithEthereumScreen_signedIn_button}:{heading:at.signInWithEthereumScreen_signedOut_heading,h1:at.signInWithEthereumScreen_signedOut_h1,p:at.signInWithEthereumScreen_signedOut_p,button:at.signInWithEthereumScreen_signedOut_button};reactExports.useEffect(()=>{nt&&st("signedIn")},[]),reactExports.useEffect(()=>{nt||st("signedOut")},[nt]);const{address:lt}=useAccount(),ht=(()=>{const mt={svg:null,default:null},pt=document.getElementsByTagName("link");return Array.from(pt).forEach(yt=>{(yt.getAttribute("rel")==="icon"||yt.getAttribute("rel")==="shortcut icon")&&yt.getAttribute("href")&&(yt.getAttribute("type")==="image/svg+xml"?mt.svg=yt.getAttribute("href"):mt.default=yt.getAttribute("href"))}),mt})(),ft=(et=(o=getAppIcon())!==null&&o!==void 0?o:ht.svg)!==null&&et!==void 0?et:ht.default;return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[jsxRuntimeExports.jsx(ContentContainer,{children:jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42},children:jsxRuntimeExports.jsx(FitText,{children:ct.h1})})},flattenChildren(ct.h1).toString())})}),jsxRuntimeExports.jsxs(StatusGraphic,{$connected:nt,children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0},children:jsxRuntimeExports.jsx(StatusGraphicBgSvg,{width:"262",height:"134",viewBox:"0 0 262 134",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx(motion.rect,{x:"0",y:"0",rx:"12",width:"262",height:"134",strokeDasharray:"3 3",animate:{strokeDashoffset:[0,-6]},transition:{duration:.4,ease:"linear",repeat:1/0}})})}),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:50,scale:.8},animate:{opacity:1,x:0,scale:1},transition,children:jsxRuntimeExports.jsx(LogoContainer,{children:jsxRuntimeExports.jsx(Avatar,{address:lt,size:64})})},"avatarImage"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{scale:.6},animate:{scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(StatusIcon,{children:jsxRuntimeExports.jsx(TickIcon,{})})},"tickIcon"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:-40,scale:.8},animate:{opacity:1,x:0,scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(LogoContainer,{children:ft?jsxRuntimeExports.jsx(LazyImage,{src:ft,alt:"app"}):jsxRuntimeExports.jsx(Chains.UnknownChain,{})})},"appLogo")]},"status"),jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{style:{paddingBottom:ot?24:12},initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42,marginTop:-1,marginBottom:-3},children:jsxRuntimeExports.jsx(FitText,{children:ct.p})})},flattenChildren(ct.p).toString())}),jsxRuntimeExports.jsx(SIWEButton,{showSignOutButton:it==="signedIn",onSignIn:()=>{setTimeout(()=>{tt.setOpen(!1)},1e3)}})]})})},customThemeDefault$1={},ConnectModal$1=({mode:o="auto",theme:et="auto",customTheme:tt=customThemeDefault$1,lang:nt="en-US"})=>{var rt;const ot=useContext(),{isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=!(!((rt=ot.options)===null||rt===void 0)&&rt.enforceSupportedChains&&it&&!at),lt=ct&&ot.route!==routes.CONNECTORS&&ot.route!==routes.PROFILE,dt=ct&&ot.route!==routes.PROFILE,ht=()=>{ot.route===routes.SIGNINWITHETHEREUM||ot.route===routes.SWITCHNETWORKS?ot.setRoute(routes.PROFILE):ot.route===routes.DOWNLOAD?ot.setRoute(routes.CONNECT):ot.setRoute(routes.CONNECTORS)},ft={onboarding:jsxRuntimeExports.jsx(Introduction,{}),about:jsxRuntimeExports.jsx(About,{}),download:jsxRuntimeExports.jsx(DownloadApp,{}),connectors:jsxRuntimeExports.jsx(Wallets,{}),mobileConnectors:jsxRuntimeExports.jsx(MobileConnectors,{}),connect:jsxRuntimeExports.jsx(ConnectUsing,{}),profile:jsxRuntimeExports.jsx(Profile,{}),switchNetworks:jsxRuntimeExports.jsx(SwitchNetworks,{}),signInWithEthereum:jsxRuntimeExports.jsx(SignInWithEthereum,{})};function mt(){ot.setOpen(!1)}return reactExports.useEffect(()=>{var pt;it?(ot.route!==routes.PROFILE||ot.route!==routes.SIGNINWITHETHEREUM)&&(ot.signInWithEthereum&&!(!((pt=ot.options)===null||pt===void 0)&&pt.disableSiweRedirect)?ot.setRoute(routes.SIGNINWITHETHEREUM):mt()):mt()},[it]),reactExports.useEffect(()=>ot.setMode(o),[o]),reactExports.useEffect(()=>ot.setTheme(et),[et]),reactExports.useEffect(()=>ot.setCustomTheme(tt),[tt]),reactExports.useEffect(()=>ot.setLang(nt),[nt]),reactExports.useEffect(()=>{const pt=getAppName();if(!pt||!ot.open)return;const yt=document.createElement("meta");return yt.setAttribute("property","og:title"),yt.setAttribute("content",pt),document.head.prepend(yt),()=>{document.head.removeChild(yt)}},[ot.open]),jsxRuntimeExports.jsx(ConnectKitThemeProvider,{theme:et,customTheme:tt,mode:o,children:jsxRuntimeExports.jsx(Modal,{open:ot.open,pages:ft,pageId:ot.route,onClose:ct?mt:void 0,onInfo:dt?()=>ot.setRoute(routes.ABOUT):void 0,onBack:lt?ht:void 0})})};function useGoogleFont(o){reactExports.useEffect(()=>{if(!o)return;o=o.replace(/ /g,"+");const et=document.createElement("link");et.href="https://fonts.googleapis.com",et.rel="preconnect";const tt=document.createElement("link");tt.href="https://fonts.gstatic.com",tt.rel="preconnect",tt.crossOrigin="true";const nt=document.createElement("link");return nt.href=`https://fonts.googleapis.com/css2?family=${o}:wght@400;500;600&display=swap`,nt.rel="stylesheet",document.head.appendChild(et),document.head.appendChild(tt),document.head.appendChild(nt),()=>{document.head.removeChild(et),document.head.removeChild(tt),document.head.removeChild(nt)}},[o])}function useThemeFont(o){var et;const nt=(et={web95:"Lato",retro:"Nunito",midnight:"Inter",minimal:"Inter",rounded:"Nunito"}[o])!==null&&et!==void 0?et:null;useGoogleFont(nt??"")}const useConnectCallback=({onConnect:o,onDisconnect:et})=>{useAccountEffect({onConnect:({address:tt,connector:nt,isReconnected:rt})=>{rt||o==null||o({address:tt,connectorId:nt==null?void 0:nt.id})},onDisconnect:()=>et==null?void 0:et()})},routes={ONBOARDING:"onboarding",ABOUT:"about",CONNECTORS:"connectors",MOBILECONNECTORS:"mobileConnectors",CONNECT:"connect",DOWNLOAD:"download",PROFILE:"profile",SWITCHNETWORKS:"switchNetworks",SIGNINWITHETHEREUM:"signInWithEthereum"},Context=reactExports.createContext(null),ConnectKitProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt,options:rt,onConnect:ot,onDisconnect:it,debugMode:st=!1})=>{var at,ct,lt,dt;if(!React.useContext(WagmiContext))throw Error("ConnectKitProvider must be within a WagmiProvider");if(React.useContext(Context))throw new Error("Multiple, nested usages of ConnectKitProvider detected. Please use only one.");useConnectCallback({onConnect:ot,onDisconnect:it});const ht=useChains(),ft=useConnector("injected"),mt={language:"en-US",hideBalance:!1,hideTooltips:!1,hideQuestionMarkCTA:!1,hideNoWalletCTA:!1,walletConnectCTA:"link",hideRecentBadge:!1,avoidLayoutShift:!0,embedGoogleFonts:!1,truncateLongENSAddress:!0,walletConnectName:void 0,reducedMotion:!1,disclaimer:null,bufferPolyfill:!0,customAvatar:void 0,initialChainId:(at=ht==null?void 0:ht[0])===null||at===void 0?void 0:at.id,enforceSupportedChains:!1,ethereumOnboardingUrl:void 0,walletOnboardingUrl:void 0,disableSiweRedirect:!1},pt=Object.assign({},mt,rt);typeof window<"u"&&pt.bufferPolyfill&&(window.Buffer=(ct=window.Buffer)!==null&&ct!==void 0?ct:buffer$2.Buffer);const[yt,gt]=reactExports.useState(et),[xt,vt]=reactExports.useState(tt),[bt,Et]=reactExports.useState(nt??{}),[wt,kt]=reactExports.useState("en-US"),[It,Rt]=reactExports.useState(!1),[$t,Nt]=reactExports.useState({id:""}),[Mt,Bt]=reactExports.useState(routes.CONNECTORS),[zt,Ft]=reactExports.useState(""),[Yt,Ht]=reactExports.useState(0);pt.embedGoogleFonts&&useThemeFont(et),reactExports.useEffect(()=>gt(et),[et]),reactExports.useEffect(()=>kt(pt.language||"en-US"),[pt.language]),reactExports.useEffect(()=>Ft(null),[Mt,It]);const{chain:Ut,isConnected:qt}=useAccount(),Pt=useChainIsSupported(Ut==null?void 0:Ut.id);reactExports.useEffect(()=>{qt&&pt.enforceSupportedChains&&!Pt&&(Rt(!0),Bt(routes.SWITCHNETWORKS))},[qt,Pt,Ut,Mt,It]),reactExports.useEffect(()=>{isFamily()&&(ft==null||ft.connect())},[ft]);const Zt=st?console.log:()=>{},Qt={theme:yt,setTheme:gt,mode:xt,setMode:vt,customTheme:nt,setCustomTheme:Et,lang:wt,setLang:kt,open:It,setOpen:Rt,route:Mt,setRoute:Bt,connector:$t,setConnector:Nt,signInWithEthereum:(dt=(lt=React.useContext(SIWEContext))===null||lt===void 0?void 0:lt.enabled)!==null&&dt!==void 0?dt:!1,onConnect:ot,options:pt,errorMessage:zt,debugMode:st,log:Zt,displayError:(Lt,Gt)=>{Ft(Lt),console.log("---------CONNECTKIT DEBUG---------"),console.log(Lt),Gt&&console.table(Gt),console.log("---------/CONNECTKIT DEBUG---------")},resize:Yt,triggerResize:()=>Ht(Lt=>Lt+1)};return reactExports.createElement(Context.Provider,{value:Qt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Web3ContextProvider,{enabled:It,children:jsxRuntimeExports.jsxs(Le,{theme:defaultTheme$1,children:[o,jsxRuntimeExports.jsx(ConnectModal$1,{lang:wt,theme:yt,mode:tt,customTheme:bt})]})})}))},useContext=()=>{const o=React.useContext(Context);if(!o)throw Error("ConnectKit Hook must be inside a Provider.");return o},safeRoutes={disconnected:[routes.CONNECTORS,routes.ABOUT,routes.ONBOARDING,routes.MOBILECONNECTORS,routes.ONBOARDING],connected:[routes.PROFILE,routes.SWITCHNETWORKS,routes.SIGNINWITHETHEREUM]},allRoutes=[...safeRoutes.connected,...safeRoutes.disconnected],useModal=({onConnect:o,onDisconnect:et}={})=>{const tt=useContext();useConnectCallback({onConnect:o,onDisconnect:et});const{isConnected:nt}=useAccount(),{signIn:rt}=useSIWE(),ot=()=>{tt.setOpen(!1)},it=()=>{tt.setOpen(!0)},st=at=>{let ct=at;allRoutes.includes(at)?nt?safeRoutes.connected.includes(at)||(ct=routes.PROFILE,tt.log(`Route ${at} is not a valid route when connected, navigating to ${ct} instead.`)):safeRoutes.disconnected.includes(at)||(ct=routes.CONNECTORS,tt.log(`Route ${at} is not a valid route when disconnected, navigating to ${ct} instead.`)):(ct=nt?routes.PROFILE:routes.CONNECTORS,tt.log(`Route ${at} is not a valid route, navigating to ${ct} instead.`)),tt.setRoute(ct),it()};return{open:tt.open,setOpen:at=>{at?st(nt?routes.PROFILE:routes.CONNECTORS):ot()},openAbout:()=>st(routes.ABOUT),openOnboarding:()=>st(routes.ONBOARDING),openProfile:()=>st(routes.PROFILE),openSwitchNetworks:()=>st(routes.SWITCHNETWORKS),openSIWE:at=>{st(routes.SIGNINWITHETHEREUM),at&&rt()}}},TextContainer=styled(motion.div)` top: 0; bottom: 0; left: 0; @@ -3797,7 +3797,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C background: currentColor; animation: ${PlaceholderKeyframes} 1000ms ease infinite both; } -`,Balance=({hideIcon:o,hideSymbol:et})=>{const tt=useIsMounted(),[nt,rt]=reactExports.useState(!0),{address:ot,chain:it}=useAccount();useChains();const st=useChainIsSupported(it==null?void 0:it.id),at=useQueryClient(),{data:ct}=useBlockNumber({watch:!0}),{data:lt,queryKey:dt}=useBalance({address:ot,chainId:it==null?void 0:it.id});reactExports.useEffect(()=>{(ct??0%5===0)&&at.invalidateQueries({queryKey:dt})},[ct,dt]);const ht=chainConfigs.find(mt=>mt.id===(it==null?void 0:it.id)),pt=`${!tt||(lt==null?void 0:lt.formatted)===void 0?"balance-loading":`balance-${ht==null?void 0:ht.id}-${lt==null?void 0:lt.formatted}`}`;return reactExports.useEffect(()=>{rt(!1)},[]),jsxRuntimeExports.jsx("div",{style:{position:"relative"},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:jsxRuntimeExports.jsx(motion.div,{initial:(lt==null?void 0:lt.formatted)!==void 0&&nt?{opacity:1}:{opacity:0,position:"absolute",top:0,left:0,bottom:0},animate:{opacity:1,position:"relative"},exit:{opacity:0,position:"absolute",top:0,left:0,bottom:0},transition:{duration:.4,ease:[.25,1,.5,1],delay:.4},children:!ot||!tt||(lt==null?void 0:lt.formatted)===void 0?jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:jsxRuntimeExports.jsxs(PulseContainer,{children:[jsxRuntimeExports.jsx("span",{style:{animationDelay:"0ms"}}),jsxRuntimeExports.jsx("span",{style:{animationDelay:"50ms"}}),jsxRuntimeExports.jsx("span",{style:{animationDelay:"100ms"}})]})})]}):st?jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:nFormatter(Number(lt==null?void 0:lt.formatted))}),!et&&` ${lt==null?void 0:lt.symbol}`]}):jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:"???"})]})},pt)})})},contentVariants={initial:{zIndex:2,opacity:0,x:"-100%"},animate:{opacity:1,x:.1,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{zIndex:1,opacity:0,x:"-100%",pointerEvents:"none",position:"absolute",transition:{duration:.4,ease:[.25,1,.5,1]}}},addressVariants={initial:{zIndex:2,opacity:0,x:"100%"},animate:{x:.2,opacity:1,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{zIndex:1,x:"100%",opacity:0,pointerEvents:"none",position:"absolute",transition:{duration:.4,ease:[.25,1,.5,1]}}},textVariants={initial:{opacity:0},animate:{opacity:1,transition:{duration:.3,ease:[.25,1,.5,1]}},exit:{position:"absolute",opacity:0,transition:{duration:.3,ease:[.25,1,.5,1]}}},ConnectButtonRenderer=({children:o})=>{const et=useIsMounted(),tt=useContext(),{open:nt,setOpen:rt}=useModal(),{address:ot,isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=useEnsFallbackConfig(),{data:lt}=useEnsName({chainId:1,address:ot,config:ct});function dt(){rt(!1)}function ht(){rt(!0),tt.setRoute(it?routes.PROFILE:routes.CONNECTORS)}return!o||!et?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o({show:ht,hide:dt,chain:st,unsupported:!at,isConnected:!!ot,isConnecting:nt,address:ot,truncatedAddress:ot?truncateEthAddress(ot):void 0,ensName:lt==null?void 0:lt.toString()})})};ConnectButtonRenderer.displayName="ConnectKitButton.Custom";function ConnectKitButtonInner({label:o,showAvatar:et,separator:tt}){var nt;const rt=useLocales({}),ot=useContext(),{isSignedIn:it}=useSIWE(),{address:st,chain:at}=useAccount(),ct=useChainIsSupported(at==null?void 0:at.id),lt=useEnsFallbackConfig(),{data:dt}=useEnsName({chainId:1,address:st,config:lt}),ht=rt.connectWallet;return jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:st?jsxRuntimeExports.jsxs(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:addressVariants,style:{height:40},children:[et&&jsxRuntimeExports.jsxs(IconContainer,{children:[jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[it&&jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute",bottom:0,right:0},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:jsxRuntimeExports.jsx(AuthIcon,{})}),!ct&&jsxRuntimeExports.jsx(UnsupportedNetworkContainer,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M1.68831 13.5H12.0764C13.1026 13.5 13.7647 12.7197 13.7647 11.763C13.7647 11.4781 13.6985 11.1863 13.5462 10.9149L8.34225 1.37526C8.02445 0.791754 7.45505 0.5 6.88566 0.5C6.31627 0.5 5.73364 0.791754 5.42246 1.37526L0.225108 10.9217C0.0728291 11.1863 0 11.4781 0 11.763C0 12.7197 0.662083 13.5 1.68831 13.5ZM6.88566 8.8048C6.49503 8.8048 6.27655 8.5809 6.26331 8.1738L6.16399 5.0595C6.15075 4.64562 6.44869 4.34708 6.87904 4.34708C7.30278 4.34708 7.61396 4.6524 7.60071 5.06628L7.5014 8.16701C7.48154 8.5809 7.26305 8.8048 6.88566 8.8048ZM6.88566 11.3492C6.44207 11.3492 6.07792 11.0303 6.07792 10.5757C6.07792 10.1211 6.44207 9.80219 6.88566 9.80219C7.32926 9.80219 7.69341 10.1143 7.69341 10.5757C7.69341 11.0371 7.32264 11.3492 6.88566 11.3492Z",fill:"currentColor"})})})]}),jsxRuntimeExports.jsx(Avatar,{size:24,address:st})]}),jsxRuntimeExports.jsx("div",{style:{position:"relative",paddingRight:et?1:0},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:dt?jsxRuntimeExports.jsx(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:textVariants,style:{position:dt?"relative":"absolute"},children:!((nt=ot.options)===null||nt===void 0)&&nt.truncateLongENSAddress?truncateENSAddress(dt,20):dt},"ckEnsName"):jsxRuntimeExports.jsxs(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:textVariants,style:{position:dt?"absolute":"relative"},children:[truncateEthAddress(st,tt)," "]},"ckTruncatedAddress")})})]},"connectedText"):jsxRuntimeExports.jsx(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants,style:{height:40},children:o||ht},"connectWalletText")})}function ConnectKitButton({label:o,showBalance:et=!1,showAvatar:tt=!0,theme:nt,mode:rt,customTheme:ot,onClick:it}){var st;const at=useIsMounted(),ct=useContext(),{isConnected:lt,address:dt,chain:ht}=useAccount(),pt=useChainIsSupported(ht==null?void 0:ht.id);function mt(){ct.setOpen(!0),ct.setRoute(lt?routes.PROFILE:routes.CONNECTORS)}const ft=["web95","rounded","minimal"].includes((st=nt??ct.theme)!==null&&st!==void 0?st:"")?"....":void 0;if(!at)return null;const yt=et&&pt,gt=dt&&yt;return jsxRuntimeExports.jsx(ResetContainer,{$useTheme:nt??ct.theme,$useMode:rt??ct.mode,$customTheme:ot??ct.customTheme,children:jsxRuntimeExports.jsxs(ThemeContainer,{onClick:()=>{it?it(mt):mt()},children:[yt&&jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:gt&&jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0,x:"100%",width:0,marginRight:0},animate:{opacity:1,x:0,width:"auto",marginRight:-24,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{opacity:0,x:"100%",width:0,marginRight:0,transition:{duration:.4,ease:[.25,1,.5,1]}},children:jsxRuntimeExports.jsx(ThemedButton,{variant:"secondary",theme:nt??ct.theme,mode:rt??ct.mode,customTheme:ot??ct.customTheme,style:{overflow:"hidden"},children:jsxRuntimeExports.jsx(motion.div,{style:{paddingRight:24},children:jsxRuntimeExports.jsx(Balance,{hideSymbol:!0})})})},"balance")}),jsxRuntimeExports.jsx(ThemedButton,{theme:nt??ct.theme,mode:rt??ct.mode,customTheme:ot??ct.customTheme,style:yt&&et&&dt&&(nt==="retro"||ct.theme==="retro")?{boxShadow:"var(--ck-connectbutton-balance-connectbutton-box-shadow)",borderRadius:"var(--ck-connectbutton-balance-connectbutton-border-radius)",overflow:"hidden"}:{overflow:"hidden"},children:jsxRuntimeExports.jsx(ConnectKitButtonInner,{separator:ft,showAvatar:tt,label:o})})]})})}ConnectKitButton.Custom=ConnectButtonRenderer;const dist=8,shake=We` +`,Balance=({hideIcon:o,hideSymbol:et})=>{const tt=useIsMounted(),[nt,rt]=reactExports.useState(!0),{address:ot,chain:it}=useAccount();useChains();const st=useChainIsSupported(it==null?void 0:it.id),at=useQueryClient(),{data:ct}=useBlockNumber({watch:!0}),{data:lt,queryKey:dt}=useBalance({address:ot,chainId:it==null?void 0:it.id});reactExports.useEffect(()=>{(ct??0%5===0)&&at.invalidateQueries({queryKey:dt})},[ct,dt]);const ht=chainConfigs.find(mt=>mt.id===(it==null?void 0:it.id)),ft=`${!tt||(lt==null?void 0:lt.formatted)===void 0?"balance-loading":`balance-${ht==null?void 0:ht.id}-${lt==null?void 0:lt.formatted}`}`;return reactExports.useEffect(()=>{rt(!1)},[]),jsxRuntimeExports.jsx("div",{style:{position:"relative"},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:jsxRuntimeExports.jsx(motion.div,{initial:(lt==null?void 0:lt.formatted)!==void 0&&nt?{opacity:1}:{opacity:0,position:"absolute",top:0,left:0,bottom:0},animate:{opacity:1,position:"relative"},exit:{opacity:0,position:"absolute",top:0,left:0,bottom:0},transition:{duration:.4,ease:[.25,1,.5,1],delay:.4},children:!ot||!tt||(lt==null?void 0:lt.formatted)===void 0?jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:jsxRuntimeExports.jsxs(PulseContainer,{children:[jsxRuntimeExports.jsx("span",{style:{animationDelay:"0ms"}}),jsxRuntimeExports.jsx("span",{style:{animationDelay:"50ms"}}),jsxRuntimeExports.jsx("span",{style:{animationDelay:"100ms"}})]})})]}):st?jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:nFormatter(Number(lt==null?void 0:lt.formatted))}),!et&&` ${lt==null?void 0:lt.symbol}`]}):jsxRuntimeExports.jsxs(Container$1,{children:[!o&&jsxRuntimeExports.jsx(Chain,{id:it==null?void 0:it.id}),jsxRuntimeExports.jsx("span",{style:{minWidth:32},children:"???"})]})},ft)})})},contentVariants={initial:{zIndex:2,opacity:0,x:"-100%"},animate:{opacity:1,x:.1,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{zIndex:1,opacity:0,x:"-100%",pointerEvents:"none",position:"absolute",transition:{duration:.4,ease:[.25,1,.5,1]}}},addressVariants={initial:{zIndex:2,opacity:0,x:"100%"},animate:{x:.2,opacity:1,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{zIndex:1,x:"100%",opacity:0,pointerEvents:"none",position:"absolute",transition:{duration:.4,ease:[.25,1,.5,1]}}},textVariants={initial:{opacity:0},animate:{opacity:1,transition:{duration:.3,ease:[.25,1,.5,1]}},exit:{position:"absolute",opacity:0,transition:{duration:.3,ease:[.25,1,.5,1]}}},ConnectButtonRenderer=({children:o})=>{const et=useIsMounted(),tt=useContext(),{open:nt,setOpen:rt}=useModal(),{address:ot,isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=useEnsFallbackConfig(),{data:lt}=useEnsName({chainId:1,address:ot,config:ct});function dt(){rt(!1)}function ht(){rt(!0),tt.setRoute(it?routes.PROFILE:routes.CONNECTORS)}return!o||!et?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o({show:ht,hide:dt,chain:st,unsupported:!at,isConnected:!!ot,isConnecting:nt,address:ot,truncatedAddress:ot?truncateEthAddress(ot):void 0,ensName:lt==null?void 0:lt.toString()})})};ConnectButtonRenderer.displayName="ConnectKitButton.Custom";function ConnectKitButtonInner({label:o,showAvatar:et,separator:tt}){var nt;const rt=useLocales({}),ot=useContext(),{isSignedIn:it}=useSIWE(),{address:st,chain:at}=useAccount(),ct=useChainIsSupported(at==null?void 0:at.id),lt=useEnsFallbackConfig(),{data:dt}=useEnsName({chainId:1,address:st,config:lt}),ht=rt.connectWallet;return jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:st?jsxRuntimeExports.jsxs(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:addressVariants,style:{height:40},children:[et&&jsxRuntimeExports.jsxs(IconContainer,{children:[jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[it&&jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute",bottom:0,right:0},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:jsxRuntimeExports.jsx(AuthIcon,{})}),!ct&&jsxRuntimeExports.jsx(UnsupportedNetworkContainer,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:jsxRuntimeExports.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M1.68831 13.5H12.0764C13.1026 13.5 13.7647 12.7197 13.7647 11.763C13.7647 11.4781 13.6985 11.1863 13.5462 10.9149L8.34225 1.37526C8.02445 0.791754 7.45505 0.5 6.88566 0.5C6.31627 0.5 5.73364 0.791754 5.42246 1.37526L0.225108 10.9217C0.0728291 11.1863 0 11.4781 0 11.763C0 12.7197 0.662083 13.5 1.68831 13.5ZM6.88566 8.8048C6.49503 8.8048 6.27655 8.5809 6.26331 8.1738L6.16399 5.0595C6.15075 4.64562 6.44869 4.34708 6.87904 4.34708C7.30278 4.34708 7.61396 4.6524 7.60071 5.06628L7.5014 8.16701C7.48154 8.5809 7.26305 8.8048 6.88566 8.8048ZM6.88566 11.3492C6.44207 11.3492 6.07792 11.0303 6.07792 10.5757C6.07792 10.1211 6.44207 9.80219 6.88566 9.80219C7.32926 9.80219 7.69341 10.1143 7.69341 10.5757C7.69341 11.0371 7.32264 11.3492 6.88566 11.3492Z",fill:"currentColor"})})})]}),jsxRuntimeExports.jsx(Avatar,{size:24,address:st})]}),jsxRuntimeExports.jsx("div",{style:{position:"relative",paddingRight:et?1:0},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:dt?jsxRuntimeExports.jsx(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:textVariants,style:{position:dt?"relative":"absolute"},children:!((nt=ot.options)===null||nt===void 0)&&nt.truncateLongENSAddress?truncateENSAddress(dt,20):dt},"ckEnsName"):jsxRuntimeExports.jsxs(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:textVariants,style:{position:dt?"absolute":"relative"},children:[truncateEthAddress(st,tt)," "]},"ckTruncatedAddress")})})]},"connectedText"):jsxRuntimeExports.jsx(TextContainer,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants,style:{height:40},children:o||ht},"connectWalletText")})}function ConnectKitButton({label:o,showBalance:et=!1,showAvatar:tt=!0,theme:nt,mode:rt,customTheme:ot,onClick:it}){var st;const at=useIsMounted(),ct=useContext(),{isConnected:lt,address:dt,chain:ht}=useAccount(),ft=useChainIsSupported(ht==null?void 0:ht.id);function mt(){ct.setOpen(!0),ct.setRoute(lt?routes.PROFILE:routes.CONNECTORS)}const pt=["web95","rounded","minimal"].includes((st=nt??ct.theme)!==null&&st!==void 0?st:"")?"....":void 0;if(!at)return null;const yt=et&&ft,gt=dt&&yt;return jsxRuntimeExports.jsx(ResetContainer,{$useTheme:nt??ct.theme,$useMode:rt??ct.mode,$customTheme:ot??ct.customTheme,children:jsxRuntimeExports.jsxs(ThemeContainer,{onClick:()=>{it?it(mt):mt()},children:[yt&&jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:gt&&jsxRuntimeExports.jsx(motion.div,{initial:{opacity:0,x:"100%",width:0,marginRight:0},animate:{opacity:1,x:0,width:"auto",marginRight:-24,transition:{duration:.4,ease:[.25,1,.5,1]}},exit:{opacity:0,x:"100%",width:0,marginRight:0,transition:{duration:.4,ease:[.25,1,.5,1]}},children:jsxRuntimeExports.jsx(ThemedButton,{variant:"secondary",theme:nt??ct.theme,mode:rt??ct.mode,customTheme:ot??ct.customTheme,style:{overflow:"hidden"},children:jsxRuntimeExports.jsx(motion.div,{style:{paddingRight:24},children:jsxRuntimeExports.jsx(Balance,{hideSymbol:!0})})})},"balance")}),jsxRuntimeExports.jsx(ThemedButton,{theme:nt??ct.theme,mode:rt??ct.mode,customTheme:ot??ct.customTheme,style:yt&&et&&dt&&(nt==="retro"||ct.theme==="retro")?{boxShadow:"var(--ck-connectbutton-balance-connectbutton-box-shadow)",borderRadius:"var(--ck-connectbutton-balance-connectbutton-border-radius)",overflow:"hidden"}:{overflow:"hidden"},children:jsxRuntimeExports.jsx(ConnectKitButtonInner,{separator:pt,showAvatar:tt,label:o})})]})})}ConnectKitButton.Custom=ConnectButtonRenderer;const dist=8,shake=We` 0%{ transform:none; } 25%{ transform:translateX(${dist}px); } 50%{ transform:translateX(-${dist}px); } @@ -3852,7 +3852,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$2(){return _extends$2=Object.assign?Object.assign.bind():function(o){for(var et=1;et"u")throw new Error(et)}function warning(o,et){if(!o){typeof console<"u"&&console.warn(et);try{throw new Error(et)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(o,et){return{usr:o.state,key:o.key,idx:et}}function createLocation(o,et,tt,nt){return tt===void 0&&(tt=null),_extends$2({pathname:typeof o=="string"?o:o.pathname,search:"",hash:""},typeof et=="string"?parsePath(et):et,{state:tt,key:et&&et.key||nt||createKey()})}function createPath(o){let{pathname:et="/",search:tt="",hash:nt=""}=o;return tt&&tt!=="?"&&(et+=tt.charAt(0)==="?"?tt:"?"+tt),nt&&nt!=="#"&&(et+=nt.charAt(0)==="#"?nt:"#"+nt),et}function parsePath(o){let et={};if(o){let tt=o.indexOf("#");tt>=0&&(et.hash=o.substr(tt),o=o.substr(0,tt));let nt=o.indexOf("?");nt>=0&&(et.search=o.substr(nt),o=o.substr(0,nt)),o&&(et.pathname=o)}return et}function getUrlBasedHistory(o,et,tt,nt){nt===void 0&&(nt={});let{window:rt=document.defaultView,v5Compat:ot=!1}=nt,it=rt.history,st=Action.Pop,at=null,ct=lt();ct==null&&(ct=0,it.replaceState(_extends$2({},it.state,{idx:ct}),""));function lt(){return(it.state||{idx:null}).idx}function dt(){st=Action.Pop;let yt=lt(),gt=yt==null?null:yt-ct;ct=yt,at&&at({action:st,location:ft.location,delta:gt})}function ht(yt,gt){st=Action.Push;let xt=createLocation(ft.location,yt,gt);ct=lt()+1;let vt=getHistoryState(xt,ct),bt=ft.createHref(xt);try{it.pushState(vt,"",bt)}catch(Et){if(Et instanceof DOMException&&Et.name==="DataCloneError")throw Et;rt.location.assign(bt)}ot&&at&&at({action:st,location:ft.location,delta:1})}function pt(yt,gt){st=Action.Replace;let xt=createLocation(ft.location,yt,gt);ct=lt();let vt=getHistoryState(xt,ct),bt=ft.createHref(xt);it.replaceState(vt,"",bt),ot&&at&&at({action:st,location:ft.location,delta:0})}function mt(yt){let gt=rt.location.origin!=="null"?rt.location.origin:rt.location.href,xt=typeof yt=="string"?yt:createPath(yt);return xt=xt.replace(/ $/,"%20"),invariant(gt,"No window.location.(origin|href) available to create URL for href: "+xt),new URL(xt,gt)}let ft={get action(){return st},get location(){return o(rt,it)},listen(yt){if(at)throw new Error("A history only accepts one active listener");return rt.addEventListener(PopStateEventType,dt),at=yt,()=>{rt.removeEventListener(PopStateEventType,dt),at=null}},createHref(yt){return et(rt,yt)},createURL:mt,encodeLocation(yt){let gt=mt(yt);return{pathname:gt.pathname,search:gt.search,hash:gt.hash}},push:ht,replace:pt,go(yt){return it.go(yt)}};return ft}var ResultType;(function(o){o.data="data",o.deferred="deferred",o.redirect="redirect",o.error="error"})(ResultType||(ResultType={}));function matchRoutes(o,et,tt){return tt===void 0&&(tt="/"),matchRoutesImpl(o,et,tt,!1)}function matchRoutesImpl(o,et,tt,nt){let rt=typeof et=="string"?parsePath(et):et,ot=stripBasename(rt.pathname||"/",tt);if(ot==null)return null;let it=flattenRoutes(o);rankRouteBranches(it);let st=null;for(let at=0;st==null&&at{let at={relativePath:st===void 0?ot.path||"":st,caseSensitive:ot.caseSensitive===!0,childrenIndex:it,route:ot};at.relativePath.startsWith("/")&&(invariant(at.relativePath.startsWith(nt),'Absolute route path "'+at.relativePath+'" nested under path '+('"'+nt+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),at.relativePath=at.relativePath.slice(nt.length));let ct=joinPaths([nt,at.relativePath]),lt=tt.concat(at);ot.children&&ot.children.length>0&&(invariant(ot.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+ct+'".')),flattenRoutes(ot.children,et,lt,ct)),!(ot.path==null&&!ot.index)&&et.push({path:ct,score:computeScore(ct,ot.index),routesMeta:lt})};return o.forEach((ot,it)=>{var st;if(ot.path===""||!((st=ot.path)!=null&&st.includes("?")))rt(ot,it);else for(let at of explodeOptionalSegments(ot.path))rt(ot,it,at)}),et}function explodeOptionalSegments(o){let et=o.split("/");if(et.length===0)return[];let[tt,...nt]=et,rt=tt.endsWith("?"),ot=tt.replace(/\?$/,"");if(nt.length===0)return rt?[ot,""]:[ot];let it=explodeOptionalSegments(nt.join("/")),st=[];return st.push(...it.map(at=>at===""?ot:[ot,at].join("/"))),rt&&st.push(...it),st.map(at=>o.startsWith("/")&&at===""?"/":at)}function rankRouteBranches(o){o.sort((et,tt)=>et.score!==tt.score?tt.score-et.score:compareIndexes(et.routesMeta.map(nt=>nt.childrenIndex),tt.routesMeta.map(nt=>nt.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=o=>o==="*";function computeScore(o,et){let tt=o.split("/"),nt=tt.length;return tt.some(isSplat)&&(nt+=splatPenalty),et&&(nt+=indexRouteValue),tt.filter(rt=>!isSplat(rt)).reduce((rt,ot)=>rt+(paramRe.test(ot)?dynamicSegmentValue:ot===""?emptySegmentValue:staticSegmentValue),nt)}function compareIndexes(o,et){return o.length===et.length&&o.slice(0,-1).every((nt,rt)=>nt===et[rt])?o[o.length-1]-et[et.length-1]:0}function matchRouteBranch(o,et,tt){let{routesMeta:nt}=o,rt={},ot="/",it=[];for(let st=0;st{let{paramName:ht,isOptional:pt}=lt;if(ht==="*"){let ft=st[dt]||"";it=ot.slice(0,ot.length-ft.length).replace(/(.)\/+$/,"$1")}const mt=st[dt];return pt&&!mt?ct[ht]=void 0:ct[ht]=(mt||"").replace(/%2F/g,"/"),ct},{}),pathname:ot,pathnameBase:it,pattern:o}}function compilePath(o,et,tt){et===void 0&&(et=!1),tt===void 0&&(tt=!0),warning(o==="*"||!o.endsWith("*")||o.endsWith("/*"),'Route path "'+o+'" will be treated as if it were '+('"'+o.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+o.replace(/\*$/,"/*")+'".'));let nt=[],rt="^"+o.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(it,st,at)=>(nt.push({paramName:st,isOptional:at!=null}),at?"/?([^\\/]+)?":"/([^\\/]+)"));return o.endsWith("*")?(nt.push({paramName:"*"}),rt+=o==="*"||o==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):tt?rt+="\\/*$":o!==""&&o!=="/"&&(rt+="(?:(?=\\/|$))"),[new RegExp(rt,et?void 0:"i"),nt]}function decodePath(o){try{return o.split("/").map(et=>decodeURIComponent(et).replace(/\//g,"%2F")).join("/")}catch(et){return warning(!1,'The URL path "'+o+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+et+").")),o}}function stripBasename(o,et){if(et==="/")return o;if(!o.toLowerCase().startsWith(et.toLowerCase()))return null;let tt=et.endsWith("/")?et.length-1:et.length,nt=o.charAt(tt);return nt&&nt!=="/"?null:o.slice(tt)||"/"}function resolvePath(o,et){et===void 0&&(et="/");let{pathname:tt,search:nt="",hash:rt=""}=typeof o=="string"?parsePath(o):o;return{pathname:tt?tt.startsWith("/")?tt:resolvePathname(tt,et):et,search:normalizeSearch(nt),hash:normalizeHash(rt)}}function resolvePathname(o,et){let tt=et.replace(/\/+$/,"").split("/");return o.split("/").forEach(rt=>{rt===".."?tt.length>1&&tt.pop():rt!=="."&&tt.push(rt)}),tt.length>1?tt.join("/"):"/"}function getInvalidPathError(o,et,tt,nt){return"Cannot include a '"+o+"' character in a manually specified "+("`to."+et+"` field ["+JSON.stringify(nt)+"]. Please separate it out to the ")+("`to."+tt+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(o){return o.filter((et,tt)=>tt===0||et.route.path&&et.route.path.length>0)}function getResolveToMatches(o,et){let tt=getPathContributingMatches(o);return et?tt.map((nt,rt)=>rt===tt.length-1?nt.pathname:nt.pathnameBase):tt.map(nt=>nt.pathnameBase)}function resolveTo(o,et,tt,nt){nt===void 0&&(nt=!1);let rt;typeof o=="string"?rt=parsePath(o):(rt=_extends$2({},o),invariant(!rt.pathname||!rt.pathname.includes("?"),getInvalidPathError("?","pathname","search",rt)),invariant(!rt.pathname||!rt.pathname.includes("#"),getInvalidPathError("#","pathname","hash",rt)),invariant(!rt.search||!rt.search.includes("#"),getInvalidPathError("#","search","hash",rt)));let ot=o===""||rt.pathname==="",it=ot?"/":rt.pathname,st;if(it==null)st=tt;else{let dt=et.length-1;if(!nt&&it.startsWith("..")){let ht=it.split("/");for(;ht[0]==="..";)ht.shift(),dt-=1;rt.pathname=ht.join("/")}st=dt>=0?et[dt]:"/"}let at=resolvePath(rt,st),ct=it&&it!=="/"&&it.endsWith("/"),lt=(ot||it===".")&&tt.endsWith("/");return!at.pathname.endsWith("/")&&(ct||lt)&&(at.pathname+="/"),at}const joinPaths=o=>o.join("/").replace(/\/\/+/g,"/"),normalizePathname=o=>o.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=o=>!o||o==="?"?"":o.startsWith("?")?o:"?"+o,normalizeHash=o=>!o||o==="#"?"":o.startsWith("#")?o:"#"+o;function isRouteErrorResponse(o){return o!=null&&typeof o.status=="number"&&typeof o.statusText=="string"&&typeof o.internal=="boolean"&&"data"in o}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** + */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(o){for(var et=1;et"u")throw new Error(et)}function warning(o,et){if(!o){typeof console<"u"&&console.warn(et);try{throw new Error(et)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(o,et){return{usr:o.state,key:o.key,idx:et}}function createLocation(o,et,tt,nt){return tt===void 0&&(tt=null),_extends$2({pathname:typeof o=="string"?o:o.pathname,search:"",hash:""},typeof et=="string"?parsePath(et):et,{state:tt,key:et&&et.key||nt||createKey()})}function createPath(o){let{pathname:et="/",search:tt="",hash:nt=""}=o;return tt&&tt!=="?"&&(et+=tt.charAt(0)==="?"?tt:"?"+tt),nt&&nt!=="#"&&(et+=nt.charAt(0)==="#"?nt:"#"+nt),et}function parsePath(o){let et={};if(o){let tt=o.indexOf("#");tt>=0&&(et.hash=o.substr(tt),o=o.substr(0,tt));let nt=o.indexOf("?");nt>=0&&(et.search=o.substr(nt),o=o.substr(0,nt)),o&&(et.pathname=o)}return et}function getUrlBasedHistory(o,et,tt,nt){nt===void 0&&(nt={});let{window:rt=document.defaultView,v5Compat:ot=!1}=nt,it=rt.history,st=Action.Pop,at=null,ct=lt();ct==null&&(ct=0,it.replaceState(_extends$2({},it.state,{idx:ct}),""));function lt(){return(it.state||{idx:null}).idx}function dt(){st=Action.Pop;let yt=lt(),gt=yt==null?null:yt-ct;ct=yt,at&&at({action:st,location:pt.location,delta:gt})}function ht(yt,gt){st=Action.Push;let xt=createLocation(pt.location,yt,gt);ct=lt()+1;let vt=getHistoryState(xt,ct),bt=pt.createHref(xt);try{it.pushState(vt,"",bt)}catch(Et){if(Et instanceof DOMException&&Et.name==="DataCloneError")throw Et;rt.location.assign(bt)}ot&&at&&at({action:st,location:pt.location,delta:1})}function ft(yt,gt){st=Action.Replace;let xt=createLocation(pt.location,yt,gt);ct=lt();let vt=getHistoryState(xt,ct),bt=pt.createHref(xt);it.replaceState(vt,"",bt),ot&&at&&at({action:st,location:pt.location,delta:0})}function mt(yt){let gt=rt.location.origin!=="null"?rt.location.origin:rt.location.href,xt=typeof yt=="string"?yt:createPath(yt);return xt=xt.replace(/ $/,"%20"),invariant(gt,"No window.location.(origin|href) available to create URL for href: "+xt),new URL(xt,gt)}let pt={get action(){return st},get location(){return o(rt,it)},listen(yt){if(at)throw new Error("A history only accepts one active listener");return rt.addEventListener(PopStateEventType,dt),at=yt,()=>{rt.removeEventListener(PopStateEventType,dt),at=null}},createHref(yt){return et(rt,yt)},createURL:mt,encodeLocation(yt){let gt=mt(yt);return{pathname:gt.pathname,search:gt.search,hash:gt.hash}},push:ht,replace:ft,go(yt){return it.go(yt)}};return pt}var ResultType;(function(o){o.data="data",o.deferred="deferred",o.redirect="redirect",o.error="error"})(ResultType||(ResultType={}));function matchRoutes(o,et,tt){return tt===void 0&&(tt="/"),matchRoutesImpl(o,et,tt,!1)}function matchRoutesImpl(o,et,tt,nt){let rt=typeof et=="string"?parsePath(et):et,ot=stripBasename(rt.pathname||"/",tt);if(ot==null)return null;let it=flattenRoutes(o);rankRouteBranches(it);let st=null;for(let at=0;st==null&&at{let at={relativePath:st===void 0?ot.path||"":st,caseSensitive:ot.caseSensitive===!0,childrenIndex:it,route:ot};at.relativePath.startsWith("/")&&(invariant(at.relativePath.startsWith(nt),'Absolute route path "'+at.relativePath+'" nested under path '+('"'+nt+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),at.relativePath=at.relativePath.slice(nt.length));let ct=joinPaths([nt,at.relativePath]),lt=tt.concat(at);ot.children&&ot.children.length>0&&(invariant(ot.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+ct+'".')),flattenRoutes(ot.children,et,lt,ct)),!(ot.path==null&&!ot.index)&&et.push({path:ct,score:computeScore(ct,ot.index),routesMeta:lt})};return o.forEach((ot,it)=>{var st;if(ot.path===""||!((st=ot.path)!=null&&st.includes("?")))rt(ot,it);else for(let at of explodeOptionalSegments(ot.path))rt(ot,it,at)}),et}function explodeOptionalSegments(o){let et=o.split("/");if(et.length===0)return[];let[tt,...nt]=et,rt=tt.endsWith("?"),ot=tt.replace(/\?$/,"");if(nt.length===0)return rt?[ot,""]:[ot];let it=explodeOptionalSegments(nt.join("/")),st=[];return st.push(...it.map(at=>at===""?ot:[ot,at].join("/"))),rt&&st.push(...it),st.map(at=>o.startsWith("/")&&at===""?"/":at)}function rankRouteBranches(o){o.sort((et,tt)=>et.score!==tt.score?tt.score-et.score:compareIndexes(et.routesMeta.map(nt=>nt.childrenIndex),tt.routesMeta.map(nt=>nt.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=o=>o==="*";function computeScore(o,et){let tt=o.split("/"),nt=tt.length;return tt.some(isSplat)&&(nt+=splatPenalty),et&&(nt+=indexRouteValue),tt.filter(rt=>!isSplat(rt)).reduce((rt,ot)=>rt+(paramRe.test(ot)?dynamicSegmentValue:ot===""?emptySegmentValue:staticSegmentValue),nt)}function compareIndexes(o,et){return o.length===et.length&&o.slice(0,-1).every((nt,rt)=>nt===et[rt])?o[o.length-1]-et[et.length-1]:0}function matchRouteBranch(o,et,tt){let{routesMeta:nt}=o,rt={},ot="/",it=[];for(let st=0;st{let{paramName:ht,isOptional:ft}=lt;if(ht==="*"){let pt=st[dt]||"";it=ot.slice(0,ot.length-pt.length).replace(/(.)\/+$/,"$1")}const mt=st[dt];return ft&&!mt?ct[ht]=void 0:ct[ht]=(mt||"").replace(/%2F/g,"/"),ct},{}),pathname:ot,pathnameBase:it,pattern:o}}function compilePath(o,et,tt){et===void 0&&(et=!1),tt===void 0&&(tt=!0),warning(o==="*"||!o.endsWith("*")||o.endsWith("/*"),'Route path "'+o+'" will be treated as if it were '+('"'+o.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+o.replace(/\*$/,"/*")+'".'));let nt=[],rt="^"+o.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(it,st,at)=>(nt.push({paramName:st,isOptional:at!=null}),at?"/?([^\\/]+)?":"/([^\\/]+)"));return o.endsWith("*")?(nt.push({paramName:"*"}),rt+=o==="*"||o==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):tt?rt+="\\/*$":o!==""&&o!=="/"&&(rt+="(?:(?=\\/|$))"),[new RegExp(rt,et?void 0:"i"),nt]}function decodePath(o){try{return o.split("/").map(et=>decodeURIComponent(et).replace(/\//g,"%2F")).join("/")}catch(et){return warning(!1,'The URL path "'+o+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+et+").")),o}}function stripBasename(o,et){if(et==="/")return o;if(!o.toLowerCase().startsWith(et.toLowerCase()))return null;let tt=et.endsWith("/")?et.length-1:et.length,nt=o.charAt(tt);return nt&&nt!=="/"?null:o.slice(tt)||"/"}function resolvePath(o,et){et===void 0&&(et="/");let{pathname:tt,search:nt="",hash:rt=""}=typeof o=="string"?parsePath(o):o;return{pathname:tt?tt.startsWith("/")?tt:resolvePathname(tt,et):et,search:normalizeSearch(nt),hash:normalizeHash(rt)}}function resolvePathname(o,et){let tt=et.replace(/\/+$/,"").split("/");return o.split("/").forEach(rt=>{rt===".."?tt.length>1&&tt.pop():rt!=="."&&tt.push(rt)}),tt.length>1?tt.join("/"):"/"}function getInvalidPathError(o,et,tt,nt){return"Cannot include a '"+o+"' character in a manually specified "+("`to."+et+"` field ["+JSON.stringify(nt)+"]. Please separate it out to the ")+("`to."+tt+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(o){return o.filter((et,tt)=>tt===0||et.route.path&&et.route.path.length>0)}function getResolveToMatches(o,et){let tt=getPathContributingMatches(o);return et?tt.map((nt,rt)=>rt===tt.length-1?nt.pathname:nt.pathnameBase):tt.map(nt=>nt.pathnameBase)}function resolveTo(o,et,tt,nt){nt===void 0&&(nt=!1);let rt;typeof o=="string"?rt=parsePath(o):(rt=_extends$2({},o),invariant(!rt.pathname||!rt.pathname.includes("?"),getInvalidPathError("?","pathname","search",rt)),invariant(!rt.pathname||!rt.pathname.includes("#"),getInvalidPathError("#","pathname","hash",rt)),invariant(!rt.search||!rt.search.includes("#"),getInvalidPathError("#","search","hash",rt)));let ot=o===""||rt.pathname==="",it=ot?"/":rt.pathname,st;if(it==null)st=tt;else{let dt=et.length-1;if(!nt&&it.startsWith("..")){let ht=it.split("/");for(;ht[0]==="..";)ht.shift(),dt-=1;rt.pathname=ht.join("/")}st=dt>=0?et[dt]:"/"}let at=resolvePath(rt,st),ct=it&&it!=="/"&&it.endsWith("/"),lt=(ot||it===".")&&tt.endsWith("/");return!at.pathname.endsWith("/")&&(ct||lt)&&(at.pathname+="/"),at}const joinPaths=o=>o.join("/").replace(/\/\/+/g,"/"),normalizePathname=o=>o.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=o=>!o||o==="?"?"":o.startsWith("?")?o:"?"+o,normalizeHash=o=>!o||o==="#"?"":o.startsWith("#")?o:"#"+o;function isRouteErrorResponse(o){return o!=null&&typeof o.status=="number"&&typeof o.statusText=="string"&&typeof o.internal=="boolean"&&"data"in o}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** * React Router v6.28.0 * * Copyright (c) Remix Software Inc. @@ -3861,7 +3861,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$1(){return _extends$1=Object.assign?Object.assign.bind():function(o){for(var et=1;et{st.current=!0}),reactExports.useCallback(function(ct,lt){if(lt===void 0&&(lt={}),!st.current)return;if(typeof ct=="number"){nt.go(ct);return}let dt=resolveTo(ct,JSON.parse(it),ot,lt.relative==="path");o==null&&et!=="/"&&(dt.pathname=dt.pathname==="/"?et:joinPaths([et,dt.pathname])),(lt.replace?nt.replace:nt.push)(dt,lt.state,lt)},[et,nt,it,ot,o])}function useParams(){let{matches:o}=reactExports.useContext(RouteContext),et=o[o.length-1];return et?et.params:{}}function useResolvedPath(o,et){let{relative:tt}=et===void 0?{}:et,{future:nt}=reactExports.useContext(NavigationContext),{matches:rt}=reactExports.useContext(RouteContext),{pathname:ot}=useLocation(),it=JSON.stringify(getResolveToMatches(rt,nt.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(o,JSON.parse(it),ot,tt==="path"),[o,it,ot,tt])}function useRoutes(o,et){return useRoutesImpl(o,et)}function useRoutesImpl(o,et,tt,nt){useInRouterContext()||invariant(!1);let{navigator:rt}=reactExports.useContext(NavigationContext),{matches:ot}=reactExports.useContext(RouteContext),it=ot[ot.length-1],st=it?it.params:{};it&&it.pathname;let at=it?it.pathnameBase:"/";it&&it.route;let ct=useLocation(),lt;if(et){var dt;let yt=typeof et=="string"?parsePath(et):et;at==="/"||(dt=yt.pathname)!=null&&dt.startsWith(at)||invariant(!1),lt=yt}else lt=ct;let ht=lt.pathname||"/",pt=ht;if(at!=="/"){let yt=at.replace(/^\//,"").split("/");pt="/"+ht.replace(/^\//,"").split("/").slice(yt.length).join("/")}let mt=matchRoutes(o,{pathname:pt}),ft=_renderMatches(mt&&mt.map(yt=>Object.assign({},yt,{params:Object.assign({},st,yt.params),pathname:joinPaths([at,rt.encodeLocation?rt.encodeLocation(yt.pathname).pathname:yt.pathname]),pathnameBase:yt.pathnameBase==="/"?at:joinPaths([at,rt.encodeLocation?rt.encodeLocation(yt.pathnameBase).pathname:yt.pathnameBase])})),ot,tt,nt);return et&&ft?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1({pathname:"/",search:"",hash:"",state:null,key:"default"},lt),navigationType:Action.Pop}},ft):ft}function DefaultErrorComponent(){let o=useRouteError(),et=isRouteErrorResponse(o)?o.status+" "+o.statusText:o instanceof Error?o.message:JSON.stringify(o),tt=o instanceof Error?o.stack:null,rt={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},et),tt?reactExports.createElement("pre",{style:rt},tt):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(et){super(et),this.state={location:et.location,revalidation:et.revalidation,error:et.error}}static getDerivedStateFromError(et){return{error:et}}static getDerivedStateFromProps(et,tt){return tt.location!==et.location||tt.revalidation!=="idle"&&et.revalidation==="idle"?{error:et.error,location:et.location,revalidation:et.revalidation}:{error:et.error!==void 0?et.error:tt.error,location:tt.location,revalidation:et.revalidation||tt.revalidation}}componentDidCatch(et,tt){console.error("React Router caught the following error during render",et,tt)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(o){let{routeContext:et,match:tt,children:nt}=o,rt=reactExports.useContext(DataRouterContext);return rt&&rt.static&&rt.staticContext&&(tt.route.errorElement||tt.route.ErrorBoundary)&&(rt.staticContext._deepestRenderedBoundaryId=tt.route.id),reactExports.createElement(RouteContext.Provider,{value:et},nt)}function _renderMatches(o,et,tt,nt){var rt;if(et===void 0&&(et=[]),tt===void 0&&(tt=null),nt===void 0&&(nt=null),o==null){var ot;if(!tt)return null;if(tt.errors)o=tt.matches;else if((ot=nt)!=null&&ot.v7_partialHydration&&et.length===0&&!tt.initialized&&tt.matches.length>0)o=tt.matches;else return null}let it=o,st=(rt=tt)==null?void 0:rt.errors;if(st!=null){let lt=it.findIndex(dt=>dt.route.id&&(st==null?void 0:st[dt.route.id])!==void 0);lt>=0||invariant(!1),it=it.slice(0,Math.min(it.length,lt+1))}let at=!1,ct=-1;if(tt&&nt&&nt.v7_partialHydration)for(let lt=0;lt=0?it=it.slice(0,ct+1):it=[it[0]];break}}}return it.reduceRight((lt,dt,ht)=>{let pt,mt=!1,ft=null,yt=null;tt&&(pt=st&&dt.route.id?st[dt.route.id]:void 0,ft=dt.route.errorElement||defaultErrorElement,at&&(ct<0&&ht===0?(mt=!0,yt=null):ct===ht&&(mt=!0,yt=dt.route.hydrateFallbackElement||null)));let gt=et.concat(it.slice(0,ht+1)),xt=()=>{let vt;return pt?vt=ft:mt?vt=yt:dt.route.Component?vt=reactExports.createElement(dt.route.Component,null):dt.route.element?vt=dt.route.element:vt=lt,reactExports.createElement(RenderedRoute,{match:dt,routeContext:{outlet:lt,matches:gt,isDataRoute:tt!=null},children:vt})};return tt&&(dt.route.ErrorBoundary||dt.route.errorElement||ht===0)?reactExports.createElement(RenderErrorBoundary,{location:tt.location,revalidation:tt.revalidation,component:ft,error:pt,children:xt(),routeContext:{outlet:null,matches:gt,isDataRoute:!0}}):xt()},null)}var DataRouterHook$1=function(o){return o.UseBlocker="useBlocker",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o}(DataRouterHook$1||{}),DataRouterStateHook$1=function(o){return o.UseBlocker="useBlocker",o.UseLoaderData="useLoaderData",o.UseActionData="useActionData",o.UseRouteError="useRouteError",o.UseNavigation="useNavigation",o.UseRouteLoaderData="useRouteLoaderData",o.UseMatches="useMatches",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o.UseRouteId="useRouteId",o}(DataRouterStateHook$1||{});function useDataRouterContext(o){let et=reactExports.useContext(DataRouterContext);return et||invariant(!1),et}function useDataRouterState(o){let et=reactExports.useContext(DataRouterStateContext);return et||invariant(!1),et}function useRouteContext(o){let et=reactExports.useContext(RouteContext);return et||invariant(!1),et}function useCurrentRouteId(o){let et=useRouteContext(),tt=et.matches[et.matches.length-1];return tt.route.id||invariant(!1),tt.route.id}function useRouteError(){var o;let et=reactExports.useContext(RouteErrorContext),tt=useDataRouterState(DataRouterStateHook$1.UseRouteError),nt=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return et!==void 0?et:(o=tt.errors)==null?void 0:o[nt]}function useNavigateStable(){let{router:o}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),et=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),tt=reactExports.useRef(!1);return useIsomorphicLayoutEffect$1(()=>{tt.current=!0}),reactExports.useCallback(function(rt,ot){ot===void 0&&(ot={}),tt.current&&(typeof rt=="number"?o.navigate(rt):o.navigate(rt,_extends$1({fromRouteId:et},ot)))},[o,et])}const alreadyWarned={};function warnOnce(o,et){alreadyWarned[et]||(alreadyWarned[et]=!0,console.warn(et))}const logDeprecation=(o,et,tt)=>warnOnce(o,"⚠️ React Router Future Flag Warning: "+et+". "+("You can use the `"+o+"` future flag to opt-in early. ")+("For more information, see "+tt+"."));function logV6DeprecationWarnings(o,et){o!=null&&o.v7_startTransition||logDeprecation("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(o!=null&&o.v7_relativeSplatPath)&&!et&&logDeprecation("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath")}function Navigate(o){let{to:et,replace:tt,state:nt,relative:rt}=o;useInRouterContext()||invariant(!1);let{future:ot,static:it}=reactExports.useContext(NavigationContext),{matches:st}=reactExports.useContext(RouteContext),{pathname:at}=useLocation(),ct=useNavigate(),lt=resolveTo(et,getResolveToMatches(st,ot.v7_relativeSplatPath),at,rt==="path"),dt=JSON.stringify(lt);return reactExports.useEffect(()=>ct(JSON.parse(dt),{replace:tt,state:nt,relative:rt}),[ct,dt,rt,tt,nt]),null}function Route(o){invariant(!1)}function Router(o){let{basename:et="/",children:tt=null,location:nt,navigationType:rt=Action.Pop,navigator:ot,static:it=!1,future:st}=o;useInRouterContext()&&invariant(!1);let at=et.replace(/^\/*/,"/"),ct=reactExports.useMemo(()=>({basename:at,navigator:ot,static:it,future:_extends$1({v7_relativeSplatPath:!1},st)}),[at,st,ot,it]);typeof nt=="string"&&(nt=parsePath(nt));let{pathname:lt="/",search:dt="",hash:ht="",state:pt=null,key:mt="default"}=nt,ft=reactExports.useMemo(()=>{let yt=stripBasename(lt,at);return yt==null?null:{location:{pathname:yt,search:dt,hash:ht,state:pt,key:mt},navigationType:rt}},[at,lt,dt,ht,pt,mt,rt]);return ft==null?null:reactExports.createElement(NavigationContext.Provider,{value:ct},reactExports.createElement(LocationContext.Provider,{children:tt,value:ft}))}function Routes(o){let{children:et,location:tt}=o;return useRoutes(createRoutesFromChildren(et),tt)}new Promise(()=>{});function createRoutesFromChildren(o,et){et===void 0&&(et=[]);let tt=[];return reactExports.Children.forEach(o,(nt,rt)=>{if(!reactExports.isValidElement(nt))return;let ot=[...et,rt];if(nt.type===reactExports.Fragment){tt.push.apply(tt,createRoutesFromChildren(nt.props.children,ot));return}nt.type!==Route&&invariant(!1),!nt.props.index||!nt.props.children||invariant(!1);let it={id:nt.props.id||ot.join("-"),caseSensitive:nt.props.caseSensitive,element:nt.props.element,Component:nt.props.Component,index:nt.props.index,path:nt.props.path,loader:nt.props.loader,action:nt.props.action,errorElement:nt.props.errorElement,ErrorBoundary:nt.props.ErrorBoundary,hasErrorBoundary:nt.props.ErrorBoundary!=null||nt.props.errorElement!=null,shouldRevalidate:nt.props.shouldRevalidate,handle:nt.props.handle,lazy:nt.props.lazy};nt.props.children&&(it.children=createRoutesFromChildren(nt.props.children,ot)),tt.push(it)}),tt}/** + */function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(o){for(var et=1;et{st.current=!0}),reactExports.useCallback(function(ct,lt){if(lt===void 0&&(lt={}),!st.current)return;if(typeof ct=="number"){nt.go(ct);return}let dt=resolveTo(ct,JSON.parse(it),ot,lt.relative==="path");o==null&&et!=="/"&&(dt.pathname=dt.pathname==="/"?et:joinPaths([et,dt.pathname])),(lt.replace?nt.replace:nt.push)(dt,lt.state,lt)},[et,nt,it,ot,o])}function useParams(){let{matches:o}=reactExports.useContext(RouteContext),et=o[o.length-1];return et?et.params:{}}function useResolvedPath(o,et){let{relative:tt}=et===void 0?{}:et,{future:nt}=reactExports.useContext(NavigationContext),{matches:rt}=reactExports.useContext(RouteContext),{pathname:ot}=useLocation(),it=JSON.stringify(getResolveToMatches(rt,nt.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(o,JSON.parse(it),ot,tt==="path"),[o,it,ot,tt])}function useRoutes(o,et){return useRoutesImpl(o,et)}function useRoutesImpl(o,et,tt,nt){useInRouterContext()||invariant(!1);let{navigator:rt}=reactExports.useContext(NavigationContext),{matches:ot}=reactExports.useContext(RouteContext),it=ot[ot.length-1],st=it?it.params:{};it&&it.pathname;let at=it?it.pathnameBase:"/";it&&it.route;let ct=useLocation(),lt;if(et){var dt;let yt=typeof et=="string"?parsePath(et):et;at==="/"||(dt=yt.pathname)!=null&&dt.startsWith(at)||invariant(!1),lt=yt}else lt=ct;let ht=lt.pathname||"/",ft=ht;if(at!=="/"){let yt=at.replace(/^\//,"").split("/");ft="/"+ht.replace(/^\//,"").split("/").slice(yt.length).join("/")}let mt=matchRoutes(o,{pathname:ft}),pt=_renderMatches(mt&&mt.map(yt=>Object.assign({},yt,{params:Object.assign({},st,yt.params),pathname:joinPaths([at,rt.encodeLocation?rt.encodeLocation(yt.pathname).pathname:yt.pathname]),pathnameBase:yt.pathnameBase==="/"?at:joinPaths([at,rt.encodeLocation?rt.encodeLocation(yt.pathnameBase).pathname:yt.pathnameBase])})),ot,tt,nt);return et&&pt?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1({pathname:"/",search:"",hash:"",state:null,key:"default"},lt),navigationType:Action.Pop}},pt):pt}function DefaultErrorComponent(){let o=useRouteError(),et=isRouteErrorResponse(o)?o.status+" "+o.statusText:o instanceof Error?o.message:JSON.stringify(o),tt=o instanceof Error?o.stack:null,rt={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},et),tt?reactExports.createElement("pre",{style:rt},tt):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(et){super(et),this.state={location:et.location,revalidation:et.revalidation,error:et.error}}static getDerivedStateFromError(et){return{error:et}}static getDerivedStateFromProps(et,tt){return tt.location!==et.location||tt.revalidation!=="idle"&&et.revalidation==="idle"?{error:et.error,location:et.location,revalidation:et.revalidation}:{error:et.error!==void 0?et.error:tt.error,location:tt.location,revalidation:et.revalidation||tt.revalidation}}componentDidCatch(et,tt){console.error("React Router caught the following error during render",et,tt)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(o){let{routeContext:et,match:tt,children:nt}=o,rt=reactExports.useContext(DataRouterContext);return rt&&rt.static&&rt.staticContext&&(tt.route.errorElement||tt.route.ErrorBoundary)&&(rt.staticContext._deepestRenderedBoundaryId=tt.route.id),reactExports.createElement(RouteContext.Provider,{value:et},nt)}function _renderMatches(o,et,tt,nt){var rt;if(et===void 0&&(et=[]),tt===void 0&&(tt=null),nt===void 0&&(nt=null),o==null){var ot;if(!tt)return null;if(tt.errors)o=tt.matches;else if((ot=nt)!=null&&ot.v7_partialHydration&&et.length===0&&!tt.initialized&&tt.matches.length>0)o=tt.matches;else return null}let it=o,st=(rt=tt)==null?void 0:rt.errors;if(st!=null){let lt=it.findIndex(dt=>dt.route.id&&(st==null?void 0:st[dt.route.id])!==void 0);lt>=0||invariant(!1),it=it.slice(0,Math.min(it.length,lt+1))}let at=!1,ct=-1;if(tt&&nt&&nt.v7_partialHydration)for(let lt=0;lt=0?it=it.slice(0,ct+1):it=[it[0]];break}}}return it.reduceRight((lt,dt,ht)=>{let ft,mt=!1,pt=null,yt=null;tt&&(ft=st&&dt.route.id?st[dt.route.id]:void 0,pt=dt.route.errorElement||defaultErrorElement,at&&(ct<0&&ht===0?(mt=!0,yt=null):ct===ht&&(mt=!0,yt=dt.route.hydrateFallbackElement||null)));let gt=et.concat(it.slice(0,ht+1)),xt=()=>{let vt;return ft?vt=pt:mt?vt=yt:dt.route.Component?vt=reactExports.createElement(dt.route.Component,null):dt.route.element?vt=dt.route.element:vt=lt,reactExports.createElement(RenderedRoute,{match:dt,routeContext:{outlet:lt,matches:gt,isDataRoute:tt!=null},children:vt})};return tt&&(dt.route.ErrorBoundary||dt.route.errorElement||ht===0)?reactExports.createElement(RenderErrorBoundary,{location:tt.location,revalidation:tt.revalidation,component:pt,error:ft,children:xt(),routeContext:{outlet:null,matches:gt,isDataRoute:!0}}):xt()},null)}var DataRouterHook$1=function(o){return o.UseBlocker="useBlocker",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o}(DataRouterHook$1||{}),DataRouterStateHook$1=function(o){return o.UseBlocker="useBlocker",o.UseLoaderData="useLoaderData",o.UseActionData="useActionData",o.UseRouteError="useRouteError",o.UseNavigation="useNavigation",o.UseRouteLoaderData="useRouteLoaderData",o.UseMatches="useMatches",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o.UseRouteId="useRouteId",o}(DataRouterStateHook$1||{});function useDataRouterContext(o){let et=reactExports.useContext(DataRouterContext);return et||invariant(!1),et}function useDataRouterState(o){let et=reactExports.useContext(DataRouterStateContext);return et||invariant(!1),et}function useRouteContext(o){let et=reactExports.useContext(RouteContext);return et||invariant(!1),et}function useCurrentRouteId(o){let et=useRouteContext(),tt=et.matches[et.matches.length-1];return tt.route.id||invariant(!1),tt.route.id}function useRouteError(){var o;let et=reactExports.useContext(RouteErrorContext),tt=useDataRouterState(DataRouterStateHook$1.UseRouteError),nt=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return et!==void 0?et:(o=tt.errors)==null?void 0:o[nt]}function useNavigateStable(){let{router:o}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),et=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),tt=reactExports.useRef(!1);return useIsomorphicLayoutEffect$1(()=>{tt.current=!0}),reactExports.useCallback(function(rt,ot){ot===void 0&&(ot={}),tt.current&&(typeof rt=="number"?o.navigate(rt):o.navigate(rt,_extends$1({fromRouteId:et},ot)))},[o,et])}const alreadyWarned={};function warnOnce(o,et){alreadyWarned[et]||(alreadyWarned[et]=!0,console.warn(et))}const logDeprecation=(o,et,tt)=>warnOnce(o,"⚠️ React Router Future Flag Warning: "+et+". "+("You can use the `"+o+"` future flag to opt-in early. ")+("For more information, see "+tt+"."));function logV6DeprecationWarnings(o,et){o!=null&&o.v7_startTransition||logDeprecation("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(o!=null&&o.v7_relativeSplatPath)&&!et&&logDeprecation("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath")}function Navigate(o){let{to:et,replace:tt,state:nt,relative:rt}=o;useInRouterContext()||invariant(!1);let{future:ot,static:it}=reactExports.useContext(NavigationContext),{matches:st}=reactExports.useContext(RouteContext),{pathname:at}=useLocation(),ct=useNavigate(),lt=resolveTo(et,getResolveToMatches(st,ot.v7_relativeSplatPath),at,rt==="path"),dt=JSON.stringify(lt);return reactExports.useEffect(()=>ct(JSON.parse(dt),{replace:tt,state:nt,relative:rt}),[ct,dt,rt,tt,nt]),null}function Route(o){invariant(!1)}function Router(o){let{basename:et="/",children:tt=null,location:nt,navigationType:rt=Action.Pop,navigator:ot,static:it=!1,future:st}=o;useInRouterContext()&&invariant(!1);let at=et.replace(/^\/*/,"/"),ct=reactExports.useMemo(()=>({basename:at,navigator:ot,static:it,future:_extends$1({v7_relativeSplatPath:!1},st)}),[at,st,ot,it]);typeof nt=="string"&&(nt=parsePath(nt));let{pathname:lt="/",search:dt="",hash:ht="",state:ft=null,key:mt="default"}=nt,pt=reactExports.useMemo(()=>{let yt=stripBasename(lt,at);return yt==null?null:{location:{pathname:yt,search:dt,hash:ht,state:ft,key:mt},navigationType:rt}},[at,lt,dt,ht,ft,mt,rt]);return pt==null?null:reactExports.createElement(NavigationContext.Provider,{value:ct},reactExports.createElement(LocationContext.Provider,{children:tt,value:pt}))}function Routes(o){let{children:et,location:tt}=o;return useRoutes(createRoutesFromChildren(et),tt)}new Promise(()=>{});function createRoutesFromChildren(o,et){et===void 0&&(et=[]);let tt=[];return reactExports.Children.forEach(o,(nt,rt)=>{if(!reactExports.isValidElement(nt))return;let ot=[...et,rt];if(nt.type===reactExports.Fragment){tt.push.apply(tt,createRoutesFromChildren(nt.props.children,ot));return}nt.type!==Route&&invariant(!1),!nt.props.index||!nt.props.children||invariant(!1);let it={id:nt.props.id||ot.join("-"),caseSensitive:nt.props.caseSensitive,element:nt.props.element,Component:nt.props.Component,index:nt.props.index,path:nt.props.path,loader:nt.props.loader,action:nt.props.action,errorElement:nt.props.errorElement,ErrorBoundary:nt.props.ErrorBoundary,hasErrorBoundary:nt.props.ErrorBoundary!=null||nt.props.errorElement!=null,shouldRevalidate:nt.props.shouldRevalidate,handle:nt.props.handle,lazy:nt.props.lazy};nt.props.children&&(it.children=createRoutesFromChildren(nt.props.children,ot)),tt.push(it)}),tt}/** * React Router DOM v6.28.0 * * Copyright (c) Remix Software Inc. @@ -3870,10 +3870,10 @@ 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(o){for(var et=1;et=0)&&(tt[rt]=o[rt]);return tt}function isModifiedEvent(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function shouldProcessLinkClick(o,et){return o.button===0&&(!et||et==="_self")&&!isModifiedEvent(o)}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(o){let{basename:et,children:tt,future:nt,window:rt}=o,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:rt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=nt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.useEffect(()=>logV6DeprecationWarnings(nt),[nt]),reactExports.createElement(Router,{basename:et,children:tt,location:st.location,navigationType:st.action,navigator:it,future:nt})}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(et,tt){let{onClick:nt,relative:rt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=et,ht=_objectWithoutPropertiesLoose(et,_excluded),{basename:pt}=reactExports.useContext(NavigationContext),mt,ft=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(mt=ct,isBrowser$1))try{let vt=new URL(window.location.href),bt=ct.startsWith("//")?new URL(vt.protocol+ct):new URL(ct),Et=stripBasename(bt.pathname,pt);bt.origin===vt.origin&&Et!=null?ct=Et+bt.search+bt.hash:ft=!0}catch{}let yt=useHref(ct,{relative:rt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:rt,viewTransition:dt});function xt(vt){nt&&nt(vt),vt.defaultPrevented||gt(vt)}return reactExports.createElement("a",_extends({},ht,{href:mt||yt,onClick:ft||ot?nt:xt,ref:tt,target:at}))});var DataRouterHook;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(o,et){let{target:tt,replace:nt,state:rt,preventScrollReset:ot,relative:it,viewTransition:st}=et===void 0?{}:et,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(o,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=nt!==void 0?nt:createPath(ct)===createPath(lt);at(o,{replace:ht,state:rt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,nt,rt,tt,o,ot,it,st])}function setRef(o,et){typeof o=="function"?o(et):o!=null&&(o.current=et)}function composeRefs(...o){return et=>o.forEach(tt=>setRef(tt,et))}function useComposedRefs(...o){return reactExports.useCallback(composeRefs(...o),o)}var Slot=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o,rt=reactExports.Children.toArray(tt),ot=rt.find(isSlottable);if(ot){const it=ot.props.children,st=rt.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,{...nt,ref:et,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o;if(reactExports.isValidElement(tt)){const rt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(nt,tt.props),ref:et?composeRefs(et,rt):rt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:o})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});function isSlottable(o){return reactExports.isValidElement(o)&&o.type===Slottable}function mergeProps(o,et){const tt={...et};for(const nt in et){const rt=o[nt],ot=et[nt];/^on[A-Z]/.test(nt)?rt&&ot?tt[nt]=(...st)=>{ot(...st),rt(...st)}:rt&&(tt[nt]=rt):nt==="style"?tt[nt]={...rt,...ot}:nt==="className"&&(tt[nt]=[rt,ot].filter(Boolean).join(" "))}return{...o,...tt}}function getElementRef$1(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}function r$1(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o))for(et=0;ettypeof o=="boolean"?"".concat(o):o===0?"0":o,cx=clsx$1,cva=(o,et)=>tt=>{var nt;if((et==null?void 0:et.variants)==null)return cx(o,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:rt,defaultVariants:ot}=et,it=Object.keys(rt).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 rt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=et==null||(nt=et.compoundVariants)===null||nt===void 0?void 0:nt.reduce((ct,lt)=>{let{class:dt,className:ht,...pt}=lt;return Object.entries(pt).every(mt=>{let[ft,yt]=mt;return Array.isArray(yt)?yt.includes({...ot,...st}[ft]):{...ot,...st}[ft]===yt})?[...ct,dt,ht]:ct},[]);return cx(o,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o)){var rt=o.length;for(et=0;et{const et=createClassMap(o),{conflictingClassGroups:tt,conflictingClassGroupModifiers:nt}=o;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,et)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&nt[it]?[...at,...nt[it]]:at}}},getGroupRecursive=(o,et)=>{var it;if(o.length===0)return et.classGroupId;const tt=o[0],nt=et.nextPart.get(tt),rt=nt?getGroupRecursive(o.slice(1),nt):void 0;if(rt)return rt;if(et.validators.length===0)return;const ot=o.join(CLASS_PART_SEPARATOR);return(it=et.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=o=>{if(arbitraryPropertyRegex.test(o)){const et=arbitraryPropertyRegex.exec(o)[1],tt=et==null?void 0:et.substring(0,et.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=o=>{const{theme:et,prefix:tt}=o,nt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(o.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,nt,ot,et)}),nt},processClassesRecursively=(o,et,tt,nt)=>{o.forEach(rt=>{if(typeof rt=="string"){const ot=rt===""?et:getPart(et,rt);ot.classGroupId=tt;return}if(typeof rt=="function"){if(isThemeGetter(rt)){processClassesRecursively(rt(nt),et,tt,nt);return}et.validators.push({validator:rt,classGroupId:tt});return}Object.entries(rt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(et,ot),tt,nt)})})},getPart=(o,et)=>{let tt=o;return et.split(CLASS_PART_SEPARATOR).forEach(nt=>{tt.nextPart.has(nt)||tt.nextPart.set(nt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(nt)}),tt},isThemeGetter=o=>o.isThemeGetter,getPrefixedClassGroupEntries=(o,et)=>et?o.map(([tt,nt])=>{const rt=nt.map(ot=>typeof ot=="string"?et+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[et+it,st])):ot);return[tt,rt]}):o,createLruCache=o=>{if(o<1)return{get:()=>{},set:()=>{}};let et=0,tt=new Map,nt=new Map;const rt=(ot,it)=>{tt.set(ot,it),et++,et>o&&(et=0,nt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=nt.get(ot))!==void 0)return rt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):rt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=o=>{const{separator:et,experimentalParseClassName:tt}=o,nt=et.length===1,rt=et[0],ot=et.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:pt,baseClassName:mt,maybePostfixModifierPosition:ft}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=o=>{if(o.length<=1)return o;const et=[];let tt=[];return o.forEach(nt=>{nt[0]==="["?(et.push(...tt.sort(),nt),tt=[]):tt.push(nt)}),et.push(...tt.sort()),et},createConfigUtils=o=>({cache:createLruCache(o.cacheSize),parseClassName:createParseClassName(o),...createClassGroupUtils(o)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(o,et)=>{const{parseClassName:tt,getClassGroupId:nt,getConflictingClassGroupIds:rt}=et,ot=[],it=o.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:pt}=tt(ct);let mt=!!pt,ft=nt(mt?ht.substring(0,pt):ht);if(!ft){if(!mt){st=ct+(st.length>0?" "+st:st);continue}if(ft=nt(ht),!ft){st=ct+(st.length>0?" "+st:st);continue}mt=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,xt=gt+ft;if(ot.includes(xt))continue;ot.push(xt);const vt=rt(ft,mt);for(let bt=0;bt0?" "+st:st)}return st};function twJoin(){let o=0,et,tt,nt="";for(;o{if(typeof o=="string")return o;let et,tt="";for(let nt=0;ntdt(lt),o());return tt=createConfigUtils(ct),nt=tt.cache.get,rt=tt.cache.set,ot=st,st(at)}function st(at){const ct=nt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return rt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=o=>{const et=tt=>tt[o]||[];return et.isThemeGetter=!0,et},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=o=>isNumber(o)||stringLengths.has(o)||fractionRegex.test(o),isArbitraryLength=o=>getIsArbitraryValue(o,"length",isLengthOnly),isNumber=o=>!!o&&!Number.isNaN(Number(o)),isArbitraryNumber=o=>getIsArbitraryValue(o,"number",isNumber),isInteger$1=o=>!!o&&Number.isInteger(Number(o)),isPercent=o=>o.endsWith("%")&&isNumber(o.slice(0,-1)),isArbitraryValue=o=>arbitraryValueRegex.test(o),isTshirtSize=o=>tshirtUnitRegex.test(o),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=o=>getIsArbitraryValue(o,sizeLabels,isNever),isArbitraryPosition=o=>getIsArbitraryValue(o,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=o=>getIsArbitraryValue(o,imageLabels,isImage),isArbitraryShadow=o=>getIsArbitraryValue(o,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(o,et,tt)=>{const nt=arbitraryValueRegex.exec(o);return nt?nt[1]?typeof et=="string"?nt[1]===et:et.has(nt[1]):tt(nt[2]):!1},isLengthOnly=o=>lengthUnitRegex.test(o)&&!colorFunctionRegex.test(o),isNever=()=>!1,isShadow=o=>shadowRegex.test(o),isImage=o=>imageRegex.test(o),getDefaultConfig=()=>{const o=fromTheme("colors"),et=fromTheme("spacing"),tt=fromTheme("blur"),nt=fromTheme("brightness"),rt=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"),pt=fromTheme("gradientColorStops"),mt=fromTheme("gradientColorStopPositions"),ft=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),xt=fromTheme("padding"),vt=fromTheme("saturate"),bt=fromTheme("scale"),Et=fromTheme("sepia"),wt=fromTheme("skew"),kt=fromTheme("space"),It=fromTheme("translate"),Rt=()=>["auto","contain","none"],Pt=()=>["auto","hidden","clip","visible","scroll"],jt=()=>["auto",isArbitraryValue,et],Ot=()=>[isArbitraryValue,et],Bt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ft=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Yt=()=>["solid","dashed","dotted","double","none"],Ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ut=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Lt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Zt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Zt(),borderColor:[o],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Ot(),borderWidth:Bt(),contrast:Zt(),grayscale:qt(),hueRotate:Zt(),invert:qt(),gap:Ot(),gradientColorStops:[o],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:jt(),margin:jt(),opacity:Zt(),padding:Ot(),saturate:Zt(),scale:Zt(),sepia:qt(),skew:Zt(),space:Ot(),translate:Ot()},classGroups:{aspect:[{aspect:["auto","square","video",isArbitraryValue]}],container:["container"],columns:[{columns:[isTshirtSize]}],"break-after":[{"break-after":Lt()}],"break-before":[{"break-before":Lt()}],"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:[...Ft(),isArbitraryValue]}],overflow:[{overflow:Pt()}],"overflow-x":[{"overflow-x":Pt()}],"overflow-y":[{"overflow-y":Pt()}],overscroll:[{overscroll:Rt()}],"overscroll-x":[{"overscroll-x":Rt()}],"overscroll-y":[{"overscroll-y":Rt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ft]}],"inset-x":[{"inset-x":[ft]}],"inset-y":[{"inset-y":[ft]}],start:[{start:[ft]}],end:[{end:[ft]}],top:[{top:[ft]}],right:[{right:[ft]}],bottom:[{bottom:[ft]}],left:[{left:[ft]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",isInteger$1,isArbitraryValue]}],basis:[{basis:jt()}],"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",...Ut()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ut(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ut(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[xt]}],px:[{px:[xt]}],py:[{py:[xt]}],ps:[{ps:[xt]}],pe:[{pe:[xt]}],pt:[{pt:[xt]}],pr:[{pr:[xt]}],pb:[{pb:[xt]}],pl:[{pl:[xt]}],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":[kt]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[kt]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,et]}],"min-w":[{"min-w":[isArbitraryValue,et,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,et,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,et,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,et,"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:[o]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Yt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Ot()}],"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:[...Ft(),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:[o]}],"gradient-from-pos":[{from:[mt]}],"gradient-via-pos":[{via:[mt]}],"gradient-to-pos":[{to:[mt]}],"gradient-from":[{from:[pt]}],"gradient-via":[{via:[pt]}],"gradient-to":[{to:[pt]}],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:[...Yt(),"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:Yt()}],"border-color":[{border:[rt]}],"border-color-x":[{"border-x":[rt]}],"border-color-y":[{"border-y":[rt]}],"border-color-s":[{"border-s":[rt]}],"border-color-e":[{"border-e":[rt]}],"border-color-t":[{"border-t":[rt]}],"border-color-r":[{"border-r":[rt]}],"border-color-b":[{"border-b":[rt]}],"border-color-l":[{"border-l":[rt]}],"divide-color":[{divide:[rt]}],"outline-style":[{outline:["",...Yt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Bt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Ht(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ht()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[nt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[vt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[nt]}],"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":[vt]}],"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:Zt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[bt]}],"scale-x":[{"scale-x":[bt]}],"scale-y":[{"scale-y":[bt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[It]}],"translate-y":[{"translate-y":[It]}],"skew-x":[{"skew-x":[wt]}],"skew-y":[{"skew-y":[wt]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",o]}],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:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Ot()}],"scroll-mx":[{"scroll-mx":Ot()}],"scroll-my":[{"scroll-my":Ot()}],"scroll-ms":[{"scroll-ms":Ot()}],"scroll-me":[{"scroll-me":Ot()}],"scroll-mt":[{"scroll-mt":Ot()}],"scroll-mr":[{"scroll-mr":Ot()}],"scroll-mb":[{"scroll-mb":Ot()}],"scroll-ml":[{"scroll-ml":Ot()}],"scroll-p":[{"scroll-p":Ot()}],"scroll-px":[{"scroll-px":Ot()}],"scroll-py":[{"scroll-py":Ot()}],"scroll-ps":[{"scroll-ps":Ot()}],"scroll-pe":[{"scroll-pe":Ot()}],"scroll-pt":[{"scroll-pt":Ot()}],"scroll-pr":[{"scroll-pr":Ot()}],"scroll-pb":[{"scroll-pb":Ot()}],"scroll-pl":[{"scroll-pl":Ot()}],"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:[o,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[o,"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(...o){return twMerge(clsx(o))}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:o,variant:et,size:tt,asChild:nt=!1,...rt},ot)=>{const it=nt?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:et,size:tt,className:o})),ref:ot,...rt})});Button.displayName="Button";function alloc$2(o=0){return new Uint8Array(o)}function allocUnsafe(o=0){return new Uint8Array(o)}const N1$1=Math.pow(2,7),N2$1=Math.pow(2,14),N3$1=Math.pow(2,21),N4$1=Math.pow(2,28),N5$1=Math.pow(2,35),N6$1=Math.pow(2,42),N7$1=Math.pow(2,49),MSB$2=128,REST$2=127;function encodingLength$3(o){if(oNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(o,et,tt=0){switch(encodingLength$3(o)){case 8:et[tt++]=o&255|MSB$2,o/=128;case 7:et[tt++]=o&255|MSB$2,o/=128;case 6:et[tt++]=o&255|MSB$2,o/=128;case 5:et[tt++]=o&255|MSB$2,o/=128;case 4:et[tt++]=o&255|MSB$2,o>>>=7;case 3:et[tt++]=o&255|MSB$2,o>>>=7;case 2:et[tt++]=o&255|MSB$2,o>>>=7;case 1:{et[tt++]=o&255,o>>>=7;break}default:throw new Error("unreachable")}return et}function encodeUint8ArrayList(o,et,tt=0){switch(encodingLength$3(o)){case 8:et.set(tt++,o&255|MSB$2),o/=128;case 7:et.set(tt++,o&255|MSB$2),o/=128;case 6:et.set(tt++,o&255|MSB$2),o/=128;case 5:et.set(tt++,o&255|MSB$2),o/=128;case 4:et.set(tt++,o&255|MSB$2),o>>>=7;case 3:et.set(tt++,o&255|MSB$2),o>>>=7;case 2:et.set(tt++,o&255|MSB$2),o>>>=7;case 1:{et.set(tt++,o&255),o>>>=7;break}default:throw new Error("unreachable")}return et}function decodeUint8Array(o,et){let tt=o[et],nt=0;if(nt+=tt&REST$2,tt>>31>0){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(tt+nt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(et=!1){if(et)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(BigInt(tt)+(BigInt(nt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(et=!1){return this.toBigInt(et).toString()}zzEncode(){const et=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^et)>>>0,this.lo=(this.lo<<1^et)>>>0,this}zzDecode(){const et=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^et)>>>0,this.hi=(this.hi>>>1^et)>>>0,this}length(){const et=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,nt=this.hi>>>24;return nt===0?tt===0?et<16384?et<128?1:2:et<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:nt<128?9:10}static fromBigInt(et){if(et===0n)return zero;if(etMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(et));const tt=et<0n;tt&&(et=-et);let nt=et>>32n,rt=et-(nt<<32n);return tt&&(nt=~nt|0n,rt=~rt|0n,++rt>TWO_32&&(rt=0n,++nt>TWO_32&&(nt=0n))),new Er(Number(rt),Number(nt))}static fromNumber(et){if(et===0)return zero;const tt=et<0;tt&&(et=-et);let nt=et>>>0,rt=(et-nt)/4294967296>>>0;return tt&&(rt=~rt>>>0,nt=~nt>>>0,++nt>4294967295&&(nt=0,++rt>4294967295&&(rt=0))),new Er(nt,rt)}static from(et){return typeof et=="number"?Er.fromNumber(et):typeof et=="bigint"?Er.fromBigInt(et):typeof et=="string"?Er.fromBigInt(BigInt(et)):et.low!=null||et.high!=null?new Er(et.low>>>0,et.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$1(o){let et=0,tt=0;for(let nt=0;nt191&&st<224?ot[it++]=(st&31)<<6|o[et++]&63:st>239&&st<365?(st=((st&7)<<18|(o[et++]&63)<<12|(o[et++]&63)<<6|o[et++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(o[et++]&63)<<6|o[et++]&63,it>8191&&((rt??(rt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return rt!=null?(it>0&&rt.push(String.fromCharCode.apply(String,ot.slice(0,it))),rt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(o,et,tt){const nt=tt;let rt,ot;for(let it=0;it>6|192,et[tt++]=rt&63|128):(rt&64512)===55296&&((ot=o.charCodeAt(it+1))&64512)===56320?(rt=65536+((rt&1023)<<10)+(ot&1023),++it,et[tt++]=rt>>18|240,et[tt++]=rt>>12&63|128,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128):(et[tt++]=rt>>12|224,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128);return tt-nt}function indexOutOfRange$1(o,et){return RangeError(`index out of range: ${o.pos} + ${et??1} > ${o.len}`)}function readFixed32End(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}class Uint8ArrayReader{constructor(et){Ct(this,"buf");Ct(this,"pos");Ct(this,"len");Ct(this,"_slice",Uint8Array.prototype.subarray);this.buf=et,this.pos=0,this.len=et.length}uint32(){let et=4294967295;if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return et}int32(){return this.uint32()|0}sint32(){const et=this.uint32();return et>>>1^-(et&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 et=readFloatLE(this.buf,this.pos);return this.pos+=4,et}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const et=readDoubleLE(this.buf,this.pos);return this.pos+=8,et}bytes(){const et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange$1(this,et);return this.pos+=et,tt===nt?new Uint8Array(0):this.buf.subarray(tt,nt)}string(){const et=this.bytes();return read$2(et,0,et.length)}skip(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange$1(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(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}readLongVarint(){const et=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)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;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(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(;tt<5;++tt)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const et=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(et,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const et=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$3(et),et}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(o){return new Uint8ArrayReader(o instanceof Uint8Array?o:o.subarray())}function decodeMessage(o,et,tt){const nt=createReader(o);return et.decode(nt,void 0,tt)}function equals$2(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),nt=0;nt>>0,bt=new Uint8Array(vt);gt!==xt;){for(var Et=mt[gt],wt=0,kt=vt-1;(Et!==0||wt>>0,bt[kt]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=wt,gt++}for(var It=vt-yt;It!==vt&&bt[It]===0;)It++;for(var Rt=at.repeat(ft);It>>0,vt=new Uint8Array(xt);mt[ft];){var bt=tt[mt.charCodeAt(ft)];if(bt===255)return;for(var Et=0,wt=xt-1;(bt!==0||Et>>0,vt[wt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");gt=Et,ft++}if(mt[ft]!==" "){for(var kt=xt-gt;kt!==xt&&vt[kt]===0;)kt++;for(var It=new Uint8Array(yt+(xt-kt)),Rt=yt;kt!==xt;)It[Rt++]=vt[kt++];return It}}}function pt(mt){var ft=ht(mt);if(ft)return ft;throw new Error(`Non-${et} character`)}return{encode:dt,decodeUnsafe:ht,decode:pt}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;let Encoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");this.name=et,this.prefix=tt,this.baseEncode=nt}encode(et){if(et instanceof Uint8Array)return`${this.prefix}${this.baseEncode(et)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseDecode");Ct(this,"prefixCodePoint");this.name=et,this.prefix=tt;const rt=tt.codePointAt(0);if(rt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=rt,this.baseDecode=nt}decode(et){if(typeof et=="string"){if(et.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(et)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(et.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(et){return or$2(this,et)}};class ComposedDecoder{constructor(et){Ct(this,"decoders");this.decoders=et}or(et){return or$2(this,et)}decode(et){const tt=et[0],nt=this.decoders[tt];if(nt!=null)return nt.decode(et);throw RangeError(`Unable to decode multibase string ${JSON.stringify(et)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or$2(o,et){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...et.decoders??{[et.prefix]:et}})}class Codec{constructor(et,tt,nt,rt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");Ct(this,"baseDecode");Ct(this,"encoder");Ct(this,"decoder");this.name=et,this.prefix=tt,this.baseEncode=nt,this.baseDecode=rt,this.encoder=new Encoder$2(et,tt,nt),this.decoder=new Decoder$2(et,tt,rt)}encode(et){return this.encoder.encode(et)}decode(et){return this.decoder.decode(et)}}function from$2({name:o,prefix:et,encode:tt,decode:nt}){return new Codec(o,et,tt,nt)}function baseX({name:o,prefix:et,alphabet:tt}){const{encode:nt,decode:rt}=_brrp__multiformats_scope_baseX(tt,o);return from$2({prefix:et,name:o,encode:nt,decode:ot=>coerce(rt(ot))})}function decode$a(o,et,tt,nt){const rt={};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$9(o,et,tt){const nt=et[et.length-1]==="=",rt=(1<tt;)it-=tt,ot+=et[rt&st>>it];if(it!==0&&(ot+=et[rt&st<(o[tt]=et,o),[]),alphabetCharsToBytes=alphabet.reduce((o,et,tt)=>{const nt=et.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${et}`);return o[nt]=tt,o},[]);function encode$8(o){return o.reduce((et,tt)=>(et+=alphabetBytesToChars[tt],et),"")}function decode$9(o){const et=[];for(const tt of o){const nt=tt.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${tt}`);const rt=alphabetCharsToBytes[nt];if(rt==null)throw new Error(`Non-base256emoji character: ${tt}`);et.push(rt)}return new Uint8Array(et)}const base256emoji=from$2({prefix:"🚀",name:"base256emoji",encode:encode$8,decode:decode$9}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$9(o),decode:o=>fromString$1(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var encode_1=encode$7,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode$7(o,et,tt){et=et||[],tt=tt||0;for(var nt=tt;o>=INT;)et[tt++]=o&255|MSB$1,o/=128;for(;o&MSBALL;)et[tt++]=o&255|MSB$1,o>>>=7;return et[tt]=o|0,encode$7.bytes=tt-nt+1,et}var decode$8=read$1,MSB$1$1=128,REST$1$1=127;function read$1(o,nt){var tt=0,nt=nt||0,rt=0,ot=nt,it,st=o.length;do{if(ot>=st)throw read$1.bytes=0,new RangeError("Could not decode varint");it=o[ot++],tt+=rt<28?(it&REST$1$1)<=MSB$1$1);return read$1.bytes=ot-nt,tt}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return ocreate$3(this.code,nt))}else throw Error("Unknown type, must be binary type")}}function sha(o){return async et=>new Uint8Array(await crypto.subtle.digest(o,et))}const sha256=from$1({name:"sha2-256",code:18,encode:sha("SHA-256")});function format(o,et){const{bytes:tt,version:nt}=o;switch(nt){case 0:return toStringV0(tt,baseCache(o),et??base58btc.encoder);default:return toStringV1(tt,baseCache(o),et??base32$2.encoder)}}const cache$1=new WeakMap;function baseCache(o){const et=cache$1.get(o);if(et==null){const tt=new Map;return cache$1.set(o,tt),tt}return et}var Qs;class CID{constructor(et,tt,nt,rt){Ct(this,"code");Ct(this,"version");Ct(this,"multihash");Ct(this,"bytes");Ct(this,"/");Ct(this,Qs,"CID");this.code=tt,this.version=et,this.multihash=nt,this.bytes=rt,this["/"]=rt}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:et,multihash:tt}=this;if(et!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(tt.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(tt)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:et,digest:tt}=this.multihash,nt=create$3(et,tt);return CID.createV1(this.code,nt)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(et){return CID.equals(this,et)}static equals(et,tt){const nt=tt;return nt!=null&&et.code===nt.code&&et.version===nt.version&&equals$1(et.multihash,nt.multihash)}toString(et){return format(this,et)}toJSON(){return{"/":format(this)}}link(){return this}[(Qs=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(et){if(et==null)return null;const tt=et;if(tt instanceof CID)return tt;if(tt["/"]!=null&&tt["/"]===tt.bytes||tt.asCID===tt){const{version:nt,code:rt,multihash:ot,bytes:it}=tt;return new CID(nt,rt,ot,it??encodeCID(nt,rt,ot.bytes))}else if(tt[cidSymbol]===!0){const{version:nt,multihash:rt,code:ot}=tt,it=decode$6(rt);return CID.create(nt,ot,it)}else return null}static create(et,tt,nt){if(typeof tt!="number")throw new Error("String codecs are no longer supported");if(!(nt.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(et){case 0:{if(tt!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(et,tt,nt,nt.bytes)}case 1:{const rt=encodeCID(et,tt,nt.bytes);return new CID(et,tt,nt,rt)}default:throw new Error("Invalid version")}}static createV0(et){return CID.create(0,DAG_PB_CODE,et)}static createV1(et,tt){return CID.create(1,et,tt)}static decode(et){const[tt,nt]=CID.decodeFirst(et);if(nt.length!==0)throw new Error("Incorrect length");return tt}static decodeFirst(et){const tt=CID.inspectBytes(et),nt=tt.size-tt.multihashSize,rt=coerce(et.subarray(nt,nt+tt.multihashSize));if(rt.byteLength!==tt.multihashSize)throw new Error("Incorrect length");const ot=rt.subarray(tt.multihashSize-tt.digestSize),it=new Digest(tt.multihashCode,tt.digestSize,ot,rt);return[tt.version===0?CID.createV0(it):CID.createV1(tt.codec,it),et.subarray(tt.size)]}static inspectBytes(et){let tt=0;const nt=()=>{const[dt,ht]=decode$7(et.subarray(tt));return tt+=ht,dt};let rt=nt(),ot=DAG_PB_CODE;if(rt===18?(rt=0,tt=0):ot=nt(),rt!==0&&rt!==1)throw new RangeError(`Invalid CID version ${rt}`);const it=tt,st=nt(),at=nt(),ct=tt+at,lt=ct-it;return{version:rt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(et,tt){const[nt,rt]=parseCIDtoBytes(et,tt),ot=CID.decode(rt);if(ot.version===0&&et[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(ot).set(nt,et),ot}}function parseCIDtoBytes(o,et){switch(o[0]){case"Q":{const tt=et??base58btc;return[base58btc.prefix,tt.decode(`${base58btc.prefix}${o}`)]}case base58btc.prefix:{const tt=et??base58btc;return[base58btc.prefix,tt.decode(o)]}case base32$2.prefix:{const tt=et??base32$2;return[base32$2.prefix,tt.decode(o)]}case base36.prefix:{const tt=et??base36;return[base36.prefix,tt.decode(o)]}default:{if(et==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[o[0],et.decode(o)]}}}function toStringV0(o,et,tt){const{prefix:nt}=tt;if(nt!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const rt=et.get(nt);if(rt==null){const ot=tt.encode(o).slice(1);return et.set(nt,ot),ot}else return rt}function toStringV1(o,et,tt){const{prefix:nt}=tt,rt=et.get(nt);if(rt==null){const ot=tt.encode(o);return et.set(nt,ot),ot}else return rt}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,et,tt){const nt=encodingLength$2(o),rt=nt+encodingLength$2(et),ot=new Uint8Array(rt+tt.byteLength);return encodeTo(o,ot,0),encodeTo(et,ot,nt),ot.set(tt,rt),ot}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$3,...base36$1,...base58,...base64$3,...base256emoji$1};function createCodec$1(o,et,tt,nt){return{name:o,prefix:et,encoder:{name:o,prefix:et,encode:tt},decoder:{decode:nt}}}const string$4=createCodec$1("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),ascii=createCodec$1("ascii","a",o=>{let et="a";for(let tt=0;tt{o=o.substring(1);const et=allocUnsafe(o.length);for(let tt=0;tt4096)return allocUnsafe(it);rt+it>8192&&(nt=allocUnsafe(8192),rt=0);const st=nt.subarray(rt,rt+=it);return rt&7&&(rt=(rt|7)+1),st}}let Op$1=class{constructor(et,tt,nt){Ct(this,"fn");Ct(this,"len");Ct(this,"next");Ct(this,"val");this.fn=et,this.len=tt,this.next=void 0,this.val=nt}};function noop$2(){}let State$1=class{constructor(et){Ct(this,"head");Ct(this,"tail");Ct(this,"len");Ct(this,"next");this.head=et.head,this.tail=et.tail,this.len=et.len,this.next=et.states}};const bufferPool=pool$1();function alloc$1(o){return globalThis.Buffer!=null?allocUnsafe(o):bufferPool(o)}class Uint8ArrayWriter{constructor(){Ct(this,"len");Ct(this,"head");Ct(this,"tail");Ct(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(et,tt,nt){return this.tail=this.tail.next=new Op$1(et,tt,nt),this.len+=tt,this}uint32(et){return this.len+=(this.tail=this.tail.next=new VarintOp$1((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this}int32(et){return et<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(et)):this.uint32(et)}sint32(et){return this.uint32((et<<1^et>>31)>>>0)}uint64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(et){return this._push(encodeUint8Array,encodingLength$3(et),et)}uint64String(et){return this.uint64(BigInt(et))}int64(et){return this.uint64(et)}int64Number(et){return this.uint64Number(et)}int64String(et){return this.uint64String(et)}sint64(et){const tt=LongBits$2.fromBigInt(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(et){const tt=LongBits$2.fromNumber(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(et){return this.sint64(BigInt(et))}bool(et){return this._push(writeByte$1,1,et?1:0)}fixed32(et){return this._push(writeFixed32$1,4,et>>>0)}sfixed32(et){return this.fixed32(et)}fixed64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(et){const tt=LongBits$2.fromNumber(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(et){return this.fixed64(BigInt(et))}sfixed64(et){return this.fixed64(et)}sfixed64Number(et){return this.fixed64Number(et)}sfixed64String(et){return this.fixed64String(et)}float(et){return this._push(writeFloatLE,4,et)}double(et){return this._push(writeDoubleLE,8,et)}bytes(et){const tt=et.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,et)}string(et){const tt=length$1(et);return tt!==0?this.uint32(tt)._push(write$2,tt,et):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 et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt!==0&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this}finish(){let et=this.head.next;const tt=alloc$1(this.len);let nt=0;for(;et!=null;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt}}function writeByte$1(o,et,tt){et[tt]=o&255}function writeVarint32$1(o,et,tt){for(;o>127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}let VarintOp$1=class extends Op$1{constructor(tt,nt){super(writeVarint32$1,tt,nt);Ct(this,"next");this.next=void 0}};function writeVarint64$1(o,et,tt){for(;o.hi!==0;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}function writeFixed32$1(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeBytes$1(o,et,tt){et.set(o,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(o){const et=o.length>>>0;return this.uint32(et),et>0&&this._push(writeBytesBuffer,et,o),this},Uint8ArrayWriter.prototype.string=function(o){const et=globalThis.Buffer.byteLength(o);return this.uint32(et),et>0&&this._push(writeStringBuffer$1,et,o),this});function writeBytesBuffer(o,et,tt){et.set(o,tt)}function writeStringBuffer$1(o,et,tt){o.length<40?write$2(o,et,tt):et.utf8Write!=null?et.utf8Write(o,tt):et.set(fromString(o),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(o,et){const tt=createWriter();return et.encode(o,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(o){o[o.VARINT=0]="VARINT",o[o.BIT64=1]="BIT64",o[o.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",o[o.START_GROUP=3]="START_GROUP",o[o.END_GROUP=4]="END_GROUP",o[o.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(o,et,tt,nt){return{name:o,type:et,encode:tt,decode:nt}}function enumeration(o){function et(rt){if(o[rt.toString()]==null)throw new Error("Invalid enum value");return o[rt]}const tt=function(ot,it){const st=et(ot);it.int32(st)},nt=function(ot){const it=ot.int32();return et(it)};return createCodec("enum",CODEC_TYPES.VARINT,tt,nt)}function message$1(o,et){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,o,et)}class MaxLengthError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_LENGTH");Ct(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_SIZE");Ct(this,"name","MaxSizeError")}}var RateLimitProof$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.contentTopic!=null&&rt.contentTopic!==""&&(ot.uint32(10),ot.string(rt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={contentTopic:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.contentTopic=rt.string();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.ContentFilter||(o.ContentFilter={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(nt.uint32(8),nt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(nt.uint32(18),nt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)nt.uint32(26),o.ContentFilter.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=rt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===rt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(o.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.messages!=null)for(const ot of tt.messages)nt.uint32(10),WakuMessage$3.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.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=rt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),FilterRequest.codec().encode(tt.request,nt)),tt.push!=null&&(nt.uint32(26),MessagePush$1.codec().encode(tt.push,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(o){let et;(function(rt){rt.SUBSCRIBER_PING="SUBSCRIBER_PING",rt.SUBSCRIBE="SUBSCRIBE",rt.UNSUBSCRIBE="UNSUBSCRIBE",rt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let tt;(function(rt){rt[rt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",rt[rt.SUBSCRIBE=1]="SUBSCRIBE",rt[rt.UNSUBSCRIBE=2]="UNSUBSCRIBE",rt[rt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(rt){rt.codec=()=>enumeration(tt)}(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let nt;o.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),rt.requestId!=null&&rt.requestId!==""&&(ot.uint32(10),ot.string(rt.requestId)),rt.filterSubscribeType!=null&&tt[rt.filterSubscribeType]!==0&&(ot.uint32(16),o.FilterSubscribeType.codec().encode(rt.filterSubscribeType,ot)),rt.pubsubTopic!=null&&(ot.uint32(82),ot.string(rt.pubsubTopic)),rt.contentTopics!=null)for(const st of rt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:et.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.requestId=rt.string();break}case 2:{st.filterSubscribeType=o.FilterSubscribeType.codec().decode(rt);break}case 10:{st.pubsubTopic=rt.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(rt.string());break}default:{rt.skipType(lt&7);break}}}return st})),nt),o.encode=rt=>encodeMessage(rt,o.codec()),o.decode=(rt,ot)=>decodeMessage(rt,o.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={requestId:"",statusCode:0},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.wakuMessage!=null&&(nt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,nt)),tt.pubsubTopic!=null&&(nt.uint32(18),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(nt.uint32(10),nt.string(tt.pubsubTopic)),tt.message!=null&&(nt.uint32(18),WakuMessage$1.codec().encode(tt.message,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={pubsubTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRequest||(PushRequest={}));var PushResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(nt.uint32(8),nt.bool(tt.isSuccess)),tt.info!=null&&(nt.uint32(18),nt.string(tt.info)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={isSuccess:!1},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushResponse||(PushResponse={}));var PushRpc$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),PushRequest.codec().encode(tt.request,nt)),tt.response!=null&&(nt.uint32(26),PushResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRpc$1||(PushRpc$1={}));var RateLimitProof$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.messageHash!=null&&(nt.uint32(10),nt.bytes(tt.messageHash)),tt.message!=null&&(nt.uint32(18),WakuMessage.codec().encode(tt.message,nt)),tt.pubsubTopic!=null&&(nt.uint32(26),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(nt.uint32(16),nt.bool(tt.includeData)),tt.pubsubTopic!=null&&(nt.uint32(82),nt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)nt.uint32(90),nt.string(ot);if(tt.timeStart!=null&&(nt.uint32(96),nt.sint64(tt.timeStart)),tt.timeEnd!=null&&(nt.uint32(104),nt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)nt.uint32(162),nt.bytes(ot);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(nt.uint32(416),nt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(nt.uint32(424),nt.uint64(tt.paginationLimit)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===rt.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=rt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)nt.uint32(162),WakuMessageKeyValue.codec().encode(ot,nt);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",messages:[]},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.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=rt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.enr!=null&&(nt.uint32(10),nt.bytes(tt.enr)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.numPeers!=null&&(nt.uint32(8),nt.uint64(tt.numPeers)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)nt.uint32(10),PeerInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerInfos:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===rt.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=rt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.query!=null&&(nt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,nt)),tt.response!=null&&(nt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataResponse||(WakuMetadataResponse={}));function isDefined(o){return!!o}function groupByContentTopic(o){const et=new Map;return o.forEach(tt=>{let nt=et.get(tt.contentTopic);nt||(et.set(tt.contentTopic,[]),nt=et.get(tt.contentTopic)),nt.push(tt)}),et}const FRAME_RATE=60;async function toAsyncIterator(o,et,tt){const nt=FRAME_RATE,rt=[];let ot;ot=await o.subscribeWithUnsubscribe(et,lt=>{rt.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(nt);const lt=rt.shift();if(!ot&&rt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(o){return new Promise(et=>{setTimeout(et,o)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(o,et){const tt=await o.toWire(et);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=o=>o.length/MB<=SIZE_CAP_IN_MB;var Protocols;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError$1;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(o){o.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(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function toString$8(o,et="utf8"){const tt=BASES[et];if(tt==null)throw new Error(`Unsupported encoding "${et}"`);return tt.encoder.encode(o).substring(1)}function hexToBytes$1(o){if(typeof o=="string"){const et=o.replace(/^0x/i,"");return fromString(et.toLowerCase(),"base16")}return o}function numberToBytes(o){const et=new ArrayBuffer(8),tt=new DataView(et);return typeof o=="number"?tt.setFloat64(0,o,!1):tt.setBigInt64(0,o,!1),new Uint8Array(et)}const bytesToHex$1=o=>toString$8(o,"base16"),bytesToUtf8=o=>toString$8(o,"utf8"),utf8ToBytes$1=o=>fromString(o,"utf8");function concat$2(o,et){const tt=o.reduce((ot,it)=>ot+it.length,0),nt=new Uint8Array(tt);let rt=0;for(const ot of o)nt.set(ot,rt),rt+=ot.length;return nt}function isStaticSharding(o){return"clusterId"in o&&"shards"in o&&!("contentTopics"in o)}function isAutoSharding(o){return"contentTopics"in o}function derivePubsubTopicsFromNetworkConfig(o){if(isStaticSharding(o)){if(o.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(o)}else if(isAutoSharding(o)){if(o.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=o=>{if(o.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${o.shard}`},shardInfoToPubsubTopics=o=>{if("contentTopics"in o&&o.contentTopics)return Array.from(new Set(o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))));if("shards"in o){if(o.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(o.shards.map(et=>`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${et}`)))}else{if("application"in o&&"version"in o)return[contentTopicToPubsubTopic(`/${o.application}/${o.version}/default/default`,o.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=o=>{const et=o.split("/");if(et.length!=6||et[1]!=="waku"||et[2]!=="2"||et[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(et[4]),nt=parseInt(et[5]);if(isNaN(tt)||isNaN(nt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:nt}},pubsubTopicsToShardInfo=o=>{const et=new Set,tt=new Set;for(const ot of o){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);et.add(`${it}:${st}`),tt.add(it)}if(et.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 nt=tt.values().next().value,rt=Array.from(et).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:nt,shards:rt}};function ensurePubsubTopicIsConfigured(o,et){if(!et.includes(o))throw new Error(`Pubsub topic ${o} has not been configured on this instance. Configured topics are: ${et}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(o){const et=o.split("/");if(et.length<5||et.length>6)throw Error("Content topic format is invalid");let tt=0;if(et.length==6){if(tt=parseInt(et[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 nt=et.splice(-4);if(nt[0].length==0)throw new Error("Application field cannot be empty");if(nt[1].length==0)throw new Error("Version field cannot be empty");if(nt[2].length==0)throw new Error("Topic name field cannot be empty");if(nt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:nt[0],version:nt[1],topicName:nt[2],encoding:nt[3]}}function contentTopicToShardIndex(o,et=8){const{application:tt,version:nt}=ensureValidContentTopic(o),rt=sha256$2(concat$2([utf8ToBytes$1(tt),utf8ToBytes$1(nt)])),ot=new DataView(rt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(et))}function contentTopicToPubsubTopic(o,et=DEFAULT_CLUSTER_ID,tt=8){if(!o)throw Error("Content topic must be specified");const nt=contentTopicToShardIndex(o,tt);return`/waku/2/rs/${et}/${nt}`}function determinePubsubTopic(o,et){return typeof et=="string"?et:(et==null?void 0:et.shard)!==void 0?singleShardInfoToPubsubTopic(et):contentTopicToPubsubTopic(o,(et==null?void 0:et.clusterId)??DEFAULT_CLUSTER_ID)}const decodeRelayShard=o=>{if(o=new Uint8Array(o),o.length<3)throw new Error("Insufficient data");const et=new DataView(o.buffer),tt=et.getUint16(0),nt=[];if(o.length===130)for(let rt=0;rt<1024;rt++){const ot=Math.floor(rt/8)+2,it=7-rt%8;et.getUint8(ot)&1<=o.length)throw new Error("Unexpected end of data");nt.push(et.getUint16(it))}}return{clusterId:tt,shards:nt}},encodeRelayShard=o=>{const{clusterId:et,shards:tt}=o,nt=tt.length>=64?130:3+2*tt.length,rt=new ArrayBuffer(nt),ot=new DataView(rt);if(ot.setUint16(0,et),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(!et)throw new Error("No ws multiaddr found in the given addresses");return et}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var o=1e3,et=o*60,tt=et*60,nt=tt*24,rt=nt*7,ot=nt*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]),pt=(dt[2]||"ms").toLowerCase();switch(pt){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*rt;case"days":case"day":case"d":return ht*nt;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*et;case"seconds":case"second":case"secs":case"sec":case"s":return ht*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=nt?Math.round(lt/nt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=et?Math.round(lt/et)+"m":dt>=o?Math.round(lt/o)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=nt?ct(lt,dt,nt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=et?ct(lt,dt,et,"minute"):dt>=o?ct(lt,dt,o,"second"):lt+" ms"}function ct(lt,dt,ht,pt){var mt=dt>=ht*1.5;return Math.round(lt/ht)+" "+pt+(mt?"s":"")}return ms$1}function setup$1(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=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`."))}})(),et.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 rt(){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 ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,pt=0;lt[0].replace(/%[a-zA-Z%]/g,mt=>{mt!=="%%"&&(ht++,mt==="%c"&&(pt=ht))}),lt.splice(pt,0,dt)}et.log=console.debug||console.log||(()=>{});function it(lt){try{lt?et.storage.setItem("debug",lt):et.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=et.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=nt.DEBUG),lt}function at(){try{return localStorage}catch{}}o.exports=common$1(et);const{formatters:ct}=o.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 Zo{constructor(et){Ct(this,"_info");Ct(this,"_warn");Ct(this,"_error");this._info=debug(Zo.createDebugNamespace("info",et)),this._warn=debug(Zo.createDebugNamespace("warn",et)),this._error=debug(Zo.createDebugNamespace("error",et))}static createDebugNamespace(et,tt){return tt?`${APP_NAME}:${et}:${tt}`:`${APP_NAME}:${et}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(et,...tt){const nt=this[et];nt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"proto");this.pubsubTopic=et,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 et=this.proto.timestamp/OneMillion;return new Date(Number(et))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$1=class{constructor(et,tt=!1,nt,rt){Ct(this,"contentTopic");Ct(this,"ephemeral");Ct(this,"pubsubTopic");Ct(this,"metaSetter");if(this.contentTopic=et,this.ephemeral=tt,this.pubsubTopic=nt,this.metaSetter=rt,!et||et==="")throw new Error("Content topic must be specified")}async toWire(et){return WakuMessage$4.encode(await this.toProtoObj(et))}async toProtoObj(et){const tt=et.timestamp??new Date,nt={payload:et.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:et.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const rt=this.metaSetter(nt);return{...nt,meta:rt}}return nt}};function createEncoder({pubsubTopic:o,pubsubTopicShardInfo:et,contentTopic:tt,ephemeral:nt,metaSetter:rt}){return new Encoder$1(tt,nt,determinePubsubTopic(tt,o??et),rt)}let Decoder$1=class{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"contentTopic");if(this.pubsubTopic=et,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(et){const tt=WakuMessage$4.decode(et);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(et,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(et,tt)}};function createDecoder(o,et){return new Decoder$1(determinePubsubTopic(o,et),o)}function isAsyncIterable$8(o){return o[Symbol.asyncIterator]!=null}function all$2(o){if(isAsyncIterable$8(o))return(async()=>{const tt=[];for await(const nt of o)tt.push(nt);return tt})();const et=[];for(const tt of o)et.push(tt);return et}function asUint8Array(o){return o}function concat$1(o,et){et==null&&(et=o.reduce((rt,ot)=>rt+ot.length,0));const tt=allocUnsafe(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function equals(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(et)}*[(Ys=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...et){this.appendAll(et)}appendAll(et){let tt=0;for(const nt of et)if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.push(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.push(...nt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...et){this.prependAll(et)}prependAll(et){let tt=0;for(const nt of et.reverse())if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.unshift(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.unshift(...nt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(et){const tt=findBufAndOffset(this.bufs,et);return tt.buf[tt.index]}set(et,tt){const nt=findBufAndOffset(this.bufs,et);nt.buf[nt.index]=tt}write(et,tt=0){if(et instanceof Uint8Array)for(let nt=0;nt0;)if(et>=this.bufs[0].byteLength)et-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(et),this.length-=et;break}}}slice(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return concat$1(nt,rt)}subarray(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return nt.length===1?nt[0]:concat$1(nt,rt)}sublist(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt),ot=new Uint8ArrayList;return ot.length=rt,ot.bufs=[...nt],ot}_subList(et,tt){if(et=et??0,tt=tt??this.length,et<0&&(et=this.length+et),tt<0&&(tt=this.length+tt),et<0||tt>this.length)throw new RangeError("index is out of bounds");if(et===tt)return{bufs:[],length:0};if(et===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const nt=[];let rt=0;for(let ot=0;ot=at)continue;const ct=et>=st&&etst&&tt<=at;if(ct&<){if(et===st&&tt===at){nt.push(it);break}const dt=et-st;nt.push(it.subarray(dt,dt+(tt-et)));break}if(ct){if(et===0){nt.push(it);continue}nt.push(it.subarray(et-st));continue}if(lt){if(tt===at){nt.push(it);break}nt.push(it.subarray(0,tt-st));break}nt.push(it)}return{bufs:nt,length:tt-et}}indexOf(et,tt=0){if(!isUint8ArrayList(et)&&!(et instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const nt=et instanceof Uint8Array?et:et.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),et.length===0)return tt>this.length?this.length:tt;const rt=nt.byteLength;if(rt===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 pt=this.get(dt+ht);if(nt[ht]!==pt){lt=Math.max(1,ht-st[pt]);break}}if(lt===0)return dt}return-1}getInt8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt8(0,tt),this.write(nt,et)}getInt16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt16(0,tt)}setInt16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt16(0,tt,nt),this.write(rt,et)}getInt32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(0,tt)}setInt32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt32(0,tt,nt),this.write(rt,et)}getBigInt64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigInt64(0,tt)}setBigInt64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigInt64(0,tt,nt),this.write(rt,et)}getUint8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint8(0,tt),this.write(nt,et)}getUint16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint16(0,tt)}setUint16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint16(0,tt,nt),this.write(rt,et)}getUint32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(0,tt)}setUint32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint32(0,tt,nt),this.write(rt,et)}getBigUint64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigUint64(0,tt)}setBigUint64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigUint64(0,tt,nt),this.write(rt,et)}getFloat32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(0,tt)}setFloat32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat32(0,tt,nt),this.write(rt,et)}getFloat64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(0,tt)}setFloat64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat64(0,tt,nt),this.write(rt,et)}equals(et){if(et==null||!(et instanceof Uint8ArrayList)||et.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttrt+ot.byteLength,0)),nt.length=tt,nt}}function isAsyncIterable$7(o){return o[Symbol.asyncIterator]!=null}const defaultEncoder=o=>{const et=encodingLength$3(o),tt=allocUnsafe(et);return encode$a(o,tt),defaultEncoder.bytes=et,tt};defaultEncoder.bytes=0;function encode$5(o,et){et=et??{};const tt=et.lengthEncoder??defaultEncoder;function*nt(rt){const ot=tt(rt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,rt instanceof Uint8Array?yield rt:yield*rt}return isAsyncIterable$7(o)?async function*(){for await(const rt of o)yield*nt(rt)}():function*(){for(const rt of o)yield*nt(rt)}()}encode$5.single=(o,et)=>{et=et??{};const tt=et.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(o.byteLength),o)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(o){o[o.LENGTH=0]="LENGTH",o[o.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=o=>{const et=decode$b(o);return defaultDecoder.bytes=encodingLength$3(et),et};defaultDecoder.bytes=0;function decode$5(o,et){const tt=new Uint8ArrayList;let nt=ReadMode.LENGTH,rt=-1;const ot=(et==null?void 0:et.lengthDecoder)??defaultDecoder,it=(et==null?void 0:et.maxLengthLength)??MAX_LENGTH_LENGTH,st=(et==null?void 0:et.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(nt===ReadMode.LENGTH)try{if(rt=ot(tt),rt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(rt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(et==null?void 0:et.onLength)!=null&&et.onLength(rt),nt=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(nt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of o)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$5.fromReader=(o,et)=>{let tt=1;const nt=async function*(){for(;;)try{const{done:ot,value:it}=await o.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$5(nt,{...et??{},onLength:ot=>{tt=ot}})};function pDefer(){const o={};return o.promise=new Promise((et,tt)=>{o.resolve=et,o.reject=tt}),o}class FixedFIFO{constructor(et){Ct(this,"buffer");Ct(this,"mask");Ct(this,"top");Ct(this,"btm");Ct(this,"next");if(!(et>0)||et-1&et)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(et),this.mask=et-1,this.top=0,this.btm=0,this.next=null}push(et){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=et,this.top=this.top+1&this.mask,!0)}shift(){const et=this.buffer[this.btm];if(et!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,et}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(et={}){Ct(this,"size");Ct(this,"hwm");Ct(this,"head");Ct(this,"tail");this.hwm=et.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(et){return(et==null?void 0:et.byteLength)!=null?et.byteLength:1}push(et){if((et==null?void 0:et.value)!=null&&(this.size+=this.calculateSize(et.value)),!this.head.push(et)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(et)}}shift(){let et=this.tail.shift();if(et===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,et=this.tail.shift()}return(et==null?void 0:et.value)!=null&&(this.size-=this.calculateSize(et.value)),et}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,nt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.code=nt??"ABORT_ERR"}};function pushable(o={}){return _pushable(tt=>{const nt=tt.shift();if(nt==null)return{done:!0};if(nt.error!=null)throw nt.error;return{done:nt.done===!0,value:nt.value}},o)}function _pushable(o,et){et=et??{};let tt=et.onEnd,nt=new FIFO,rt,ot,it,st=pDefer();const at=async()=>{try{return nt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=xt=>{ot=null,nt.push(xt);try{yt(o(nt))}catch(vt){gt(vt)}return rt}}):o(nt)}finally{nt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(nt.push(yt),rt),lt=yt=>(nt=new FIFO,ot!=null?ot({error:yt}):(nt.push({error:yt}),rt)),dt=yt=>{if(it)return rt;if((et==null?void 0:et.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?rt:(it=!0,yt!=null?lt(yt):ct({done:!0})),pt=()=>(nt=new FIFO,ht(),{done:!0}),mt=yt=>(ht(yt),{done:!0});if(rt={[Symbol.asyncIterator](){return this},next:at,return:pt,throw:mt,push:dt,end:ht,get readableLength(){return nt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),nt.isEmpty())return;let xt,vt;gt!=null&&(xt=new Promise((bt,Et)=>{vt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",vt)}));try{await Promise.race([st.promise,xt])}finally{vt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",vt))}}},tt==null)return rt;const ft=rt;return rt={[Symbol.asyncIterator](){return this},next(){return ft.next()},throw(yt){return ft.throw(yt),tt!=null&&(tt(yt),tt=void 0),{done:!0}},return(){return ft.return(),tt!=null&&(tt(),tt=void 0),{done:!0}},push:dt,end(yt){return ft.end(yt),tt!=null&&(tt(yt),tt=void 0),rt},get readableLength(){return ft.readableLength},onEmpty:yt=>ft.onEmpty(yt)},rt}function isAsyncIterable$6(o){return o[Symbol.asyncIterator]!=null}function merge$2(...o){const et=[];for(const tt of o)isAsyncIterable$6(tt)||et.push(tt);return et.length===o.length?function*(){for(const tt of et)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(o.map(async nt=>{for await(const rt of nt)tt.push(rt)})),tt.end()}catch(nt){tt.end(nt)}}),yield*tt}()}function pipe(o,...et){if(o==null)throw new Error("Empty pipeline");if(isDuplex(o)){const nt=o;o=()=>nt.source}else if(isIterable(o)||isAsyncIterable$5(o)){const nt=o;o=()=>nt}const tt=[o,...et];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let nt=1;nt{let et;for(;o.length>0;)et=o.shift()(et);return et},isAsyncIterable$5=o=>(o==null?void 0:o[Symbol.asyncIterator])!=null,isIterable=o=>(o==null?void 0:o[Symbol.iterator])!=null,isDuplex=o=>o==null?!1:o.sink!=null&&o.source!=null,duplexPipelineFn=o=>et=>{const tt=o.sink(et);if((tt==null?void 0:tt.then)!=null){const nt=pushable({objectMode:!0});tt.then(()=>{nt.end()},it=>{nt.end(it)});let rt;const ot=o.source;if(isAsyncIterable$5(ot))rt=async function*(){yield*ot,nt.end()};else if(isIterable(ot))rt=function*(){yield*ot,nt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(nt,rt())}return o.source};async function sortPeersByLatency(o,et){return et.length===0?[]:(await Promise.all(et.map(async rt=>{try{const ot=(await o.get(rt.id)).metadata.get("ping");if(!ot)return{peer:rt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:rt,ping:it}}catch{return{peer:rt,ping:1/0}}}))).filter(rt=>rt!==null).sort((rt,ot)=>rt.ping-ot.ping).map(rt=>rt.peer)}async function getPeersForProtocol(o,et){const tt=[];return await o.forEach(nt=>{for(let rt=0;rtit.tags.has(Tags.BOOTSTRAP)).slice(0,tt);et>0&&et!it.tags.has(Tags.BOOTSTRAP));if(et===0)return[...nt,...rt];const ot=[...nt];for(;ot.length0;){const it=Math.floor(Math.random()*rt.length),st=rt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(o){return o.filter(et=>et.status==="open").sort((et,tt)=>tt.timeline.open-et.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(et,tt,nt){Ct(this,"multicodec");Ct(this,"getConnections");Ct(this,"addEventListener");Ct(this,"log");Ct(this,"ongoingCreation",new Set);Ct(this,"streamPool",new Map);Ct(this,"handlePeerUpdateStreamPool",et=>{const{peer:tt}=et.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=et,this.getConnections=tt,this.addEventListener=nt,this.log=new Logger$1(`stream-manager:${et}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(et){const tt=et.id.toString(),nt=this.streamPool.get(tt);nt&&(this.streamPool.delete(tt),await nt);let rt=this.getOpenStreamForCodec(et.id);return rt?(this.log.info(`Found existing stream peerId=${et.id.toString()} multicodec=${this.multicodec}`),this.lockStream(et.id.toString(),rt),rt):(rt=await this.createStream(et),this.lockStream(et.id.toString(),rt),rt)}async createStream(et,tt=0){const nt=this.getConnections(et.id),rt=selectOpenConnection(nt);if(!rt)throw new Error(`Failed to get a connection to the peer peerId=${et.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!rt||["done","closed","closing"].includes(rt.writeStatus||"")||this.isStreamLocked(rt)))return rt}lockStream(et,tt){this.log.info(`Locking stream for peerId:${et} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(et){return!!et.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(et,tt,nt,rt){Ct(this,"multicodec");Ct(this,"components");Ct(this,"log");Ct(this,"pubsubTopics");Ct(this,"addLibp2pEventListener");Ct(this,"removeLibp2pEventListener");Ct(this,"streamManager");this.multicodec=et,this.components=tt,this.log=nt,this.pubsubTopics=rt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(et,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(et){return this.streamManager.getStream(et)}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:et,maxBootstrapPeers:tt,peerIdStr:nt}={maxBootstrapPeers:0,numPeers:0}){if(nt){const st=(await this.connectedPeers()).find(at=>at.id.toString()===nt);return st?[st]:(this.log.warn(`Passed node to use for ${this.multicodec} not found: ${nt}. Attempting to use random peers.`),this.getPeers({numPeers:et,maxBootstrapPeers:tt}))}const rt=await this.connectedPeers(),ot=filterPeersByDiscovery(rt,et,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,nt,rt){const ot=await this.getStream(nt),it=FilterSubscribeRpc.createSubscribeRequest(tt,rt);let st;try{st=await pipe([it.encode()],encode$5,ot,decode$5,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:nt.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:nt.id},success:null}):{failure:null,success:nt.id}}async unsubscribe(tt,nt,rt){let ot;try{ot=await this.getStream(nt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${nt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:nt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,rt);try{await pipe([it.encode()],encode$5,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}return{success:nt.id,failure:null}}async unsubscribeAll(tt,nt){const rt=await this.getStream(nt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$5,rt,decode$5,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$1.NO_RESPONSE,peerId:nt.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:nt.id},success:null}):{failure:null,success:nt.id}}async ping(tt){let nt;try{nt=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 rt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([rt.encode()],encode$5,nt,decode$5,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:nt,stream:rt}=tt,{remotePeer:ot}=nt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(rt,decode$5,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,nt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${nt.remotePeer.toString()} -- stream:${rt.id} -- protocol:${rt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}class PushRpc{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et,tt){return new PushRpc({requestId:v4$2(),request:{message:et,pubsubTopic:tt},response:void 0})}static decode(et){const tt=PushRpc$1.decode(et);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=o=>o?o.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=o=>{const et={[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=o.toLowerCase();for(const nt in et)if(tt.includes(nt.toLowerCase()))return et[nt];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,nt){super(LightPushCodec,nt.components,log$m,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,nt){try{if(!nt.payload||nt.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,nt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$1.SIZE_TOO_BIG};const rt=await tt.toProtoObj(nt);return rt?{query:PushRpc.createRequest(rt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$1.ENCODE_FAILED})}catch(rt){return log$m.error("Failed to prepare push message",rt),{query:null,error:ProtocolError$1.GENERIC_FAIL}}}async send(tt,nt,rt){const{query:ot,error:it}=await this.preparePushMessage(tt,nt);if(it||!ot)return{success:null,failure:{error:it,peerId:rt.id}};let st;try{st=await this.getStream(rt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:rt.id}}}let at;try{at=await pipe([ot.encode()],encode$5,st,decode$5,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:rt.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:rt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:rt.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:rt.id}}}return lt.isSuccess?{success:rt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(o){return{...EmptyMessage,...o}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;class StoreQueryRequest{constructor(et){Ct(this,"proto");this.proto=et}static create(et){const tt=new StoreQueryRequest({...et,requestId:v4$2(),timeStart:et.timeStart?BigInt(et.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:et.timeEnd?BigInt(et.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:et.messageHashes||[],paginationLimit:et.paginationLimit?BigInt(et.paginationLimit):void 0});if(et.pubsubTopic&&!et.contentTopics||!et.pubsubTopic&&et.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(et.messageHashes&&(et.pubsubTopic||et.contentTopics||et.timeStart||et.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(et){const tt=StoreQueryRequest$1.decode(et);return new StoreQueryRequest(tt)}encode(){return StoreQueryRequest$1.encode(this.proto)}}class StoreQueryResponse{constructor(et){Ct(this,"proto");this.proto=et}static decode(et){const tt=StoreQueryResponse$1.decode(et);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,nt){super(StoreCodec,nt.components,log$l,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,nt,rt){if(tt.contentTopics.toString()!==Array.from(nt.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(rt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$5,st,decode$5,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 pt=ht.message.contentTopic;if(pt){const mt=nt.get(pt);if(mt)return mt.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(o){return!!(o!=null&&o[peerIdSymbol$3])}var ss;let AbortError$9=(ss=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(ss,"name","AbortError"),ss);class UnexpectedPeerError extends Error{constructor(et="Unexpected Peer"){super(et),this.name="UnexpectedPeerError"}}Ct(UnexpectedPeerError,"name","UnexpectedPeerError");var as;let InvalidMessageError$3=(as=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(as,"name","InvalidMessageError"),as);class ProtocolError extends Error{constructor(et="Protocol error"){super(et),this.name="ProtocolError"}}Ct(ProtocolError,"name","ProtocolError");var cs;let TimeoutError$3=(cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(cs,"name","TimeoutError"),cs);function setMaxListeners$9(){}const setMaxListeners$8=(o,...et)=>{try{[...et]}catch{}};var Qn,Zs;let TypedEventEmitter$3=(Zs=class extends EventTarget{constructor(){super();fn(this,Qn,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const nt=Mt(this,Qn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Qn).get(tt);ot==null&&(ot=[],Mt(this,Qn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Qn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Qn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Qn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Qn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Qn=new WeakMap,Zs);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:et,relay:tt,libp2p:nt}){Ct(this,"relay");Ct(this,"libp2p");Ct(this,"options");Ct(this,"pingKeepAliveTimers",new Map);Ct(this,"relayKeepAliveTimers",new Map);this.options=et,this.relay=tt,this.libp2p=nt}start(et){this.stop(et);const{pingKeepAlive:tt,relayKeepAlive:nt}=this.options,rt=et.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(et),log$k.info(`Ping succeeded (${rt})`,st)}catch{log$k.error(`Ping failed for peer (${rt}). + */function _extends(){return _extends=Object.assign?Object.assign.bind():function(o){for(var et=1;et=0)&&(tt[rt]=o[rt]);return tt}function isModifiedEvent(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function shouldProcessLinkClick(o,et){return o.button===0&&(!et||et==="_self")&&!isModifiedEvent(o)}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(o){let{basename:et,children:tt,future:nt,window:rt}=o,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:rt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=nt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.useEffect(()=>logV6DeprecationWarnings(nt),[nt]),reactExports.createElement(Router,{basename:et,children:tt,location:st.location,navigationType:st.action,navigator:it,future:nt})}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(et,tt){let{onClick:nt,relative:rt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=et,ht=_objectWithoutPropertiesLoose(et,_excluded),{basename:ft}=reactExports.useContext(NavigationContext),mt,pt=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(mt=ct,isBrowser$1))try{let vt=new URL(window.location.href),bt=ct.startsWith("//")?new URL(vt.protocol+ct):new URL(ct),Et=stripBasename(bt.pathname,ft);bt.origin===vt.origin&&Et!=null?ct=Et+bt.search+bt.hash:pt=!0}catch{}let yt=useHref(ct,{relative:rt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:rt,viewTransition:dt});function xt(vt){nt&&nt(vt),vt.defaultPrevented||gt(vt)}return reactExports.createElement("a",_extends({},ht,{href:mt||yt,onClick:pt||ot?nt:xt,ref:tt,target:at}))});var DataRouterHook;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(o,et){let{target:tt,replace:nt,state:rt,preventScrollReset:ot,relative:it,viewTransition:st}=et===void 0?{}:et,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(o,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=nt!==void 0?nt:createPath(ct)===createPath(lt);at(o,{replace:ht,state:rt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,nt,rt,tt,o,ot,it,st])}function setRef(o,et){typeof o=="function"?o(et):o!=null&&(o.current=et)}function composeRefs(...o){return et=>o.forEach(tt=>setRef(tt,et))}function useComposedRefs(...o){return reactExports.useCallback(composeRefs(...o),o)}var Slot=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o,rt=reactExports.Children.toArray(tt),ot=rt.find(isSlottable);if(ot){const it=ot.props.children,st=rt.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,{...nt,ref:et,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o;if(reactExports.isValidElement(tt)){const rt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(nt,tt.props),ref:et?composeRefs(et,rt):rt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:o})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});function isSlottable(o){return reactExports.isValidElement(o)&&o.type===Slottable}function mergeProps(o,et){const tt={...et};for(const nt in et){const rt=o[nt],ot=et[nt];/^on[A-Z]/.test(nt)?rt&&ot?tt[nt]=(...st)=>{ot(...st),rt(...st)}:rt&&(tt[nt]=rt):nt==="style"?tt[nt]={...rt,...ot}:nt==="className"&&(tt[nt]=[rt,ot].filter(Boolean).join(" "))}return{...o,...tt}}function getElementRef$1(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}function r$1(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o))for(et=0;ettypeof o=="boolean"?"".concat(o):o===0?"0":o,cx=clsx$1,cva=(o,et)=>tt=>{var nt;if((et==null?void 0:et.variants)==null)return cx(o,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:rt,defaultVariants:ot}=et,it=Object.keys(rt).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 rt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=et==null||(nt=et.compoundVariants)===null||nt===void 0?void 0:nt.reduce((ct,lt)=>{let{class:dt,className:ht,...ft}=lt;return Object.entries(ft).every(mt=>{let[pt,yt]=mt;return Array.isArray(yt)?yt.includes({...ot,...st}[pt]):{...ot,...st}[pt]===yt})?[...ct,dt,ht]:ct},[]);return cx(o,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o)){var rt=o.length;for(et=0;et{const et=createClassMap(o),{conflictingClassGroups:tt,conflictingClassGroupModifiers:nt}=o;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,et)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&nt[it]?[...at,...nt[it]]:at}}},getGroupRecursive=(o,et)=>{var it;if(o.length===0)return et.classGroupId;const tt=o[0],nt=et.nextPart.get(tt),rt=nt?getGroupRecursive(o.slice(1),nt):void 0;if(rt)return rt;if(et.validators.length===0)return;const ot=o.join(CLASS_PART_SEPARATOR);return(it=et.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=o=>{if(arbitraryPropertyRegex.test(o)){const et=arbitraryPropertyRegex.exec(o)[1],tt=et==null?void 0:et.substring(0,et.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=o=>{const{theme:et,prefix:tt}=o,nt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(o.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,nt,ot,et)}),nt},processClassesRecursively=(o,et,tt,nt)=>{o.forEach(rt=>{if(typeof rt=="string"){const ot=rt===""?et:getPart(et,rt);ot.classGroupId=tt;return}if(typeof rt=="function"){if(isThemeGetter(rt)){processClassesRecursively(rt(nt),et,tt,nt);return}et.validators.push({validator:rt,classGroupId:tt});return}Object.entries(rt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(et,ot),tt,nt)})})},getPart=(o,et)=>{let tt=o;return et.split(CLASS_PART_SEPARATOR).forEach(nt=>{tt.nextPart.has(nt)||tt.nextPart.set(nt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(nt)}),tt},isThemeGetter=o=>o.isThemeGetter,getPrefixedClassGroupEntries=(o,et)=>et?o.map(([tt,nt])=>{const rt=nt.map(ot=>typeof ot=="string"?et+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[et+it,st])):ot);return[tt,rt]}):o,createLruCache=o=>{if(o<1)return{get:()=>{},set:()=>{}};let et=0,tt=new Map,nt=new Map;const rt=(ot,it)=>{tt.set(ot,it),et++,et>o&&(et=0,nt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=nt.get(ot))!==void 0)return rt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):rt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=o=>{const{separator:et,experimentalParseClassName:tt}=o,nt=et.length===1,rt=et[0],ot=et.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:ft,baseClassName:mt,maybePostfixModifierPosition:pt}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=o=>{if(o.length<=1)return o;const et=[];let tt=[];return o.forEach(nt=>{nt[0]==="["?(et.push(...tt.sort(),nt),tt=[]):tt.push(nt)}),et.push(...tt.sort()),et},createConfigUtils=o=>({cache:createLruCache(o.cacheSize),parseClassName:createParseClassName(o),...createClassGroupUtils(o)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(o,et)=>{const{parseClassName:tt,getClassGroupId:nt,getConflictingClassGroupIds:rt}=et,ot=[],it=o.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:ft}=tt(ct);let mt=!!ft,pt=nt(mt?ht.substring(0,ft):ht);if(!pt){if(!mt){st=ct+(st.length>0?" "+st:st);continue}if(pt=nt(ht),!pt){st=ct+(st.length>0?" "+st:st);continue}mt=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,xt=gt+pt;if(ot.includes(xt))continue;ot.push(xt);const vt=rt(pt,mt);for(let bt=0;bt0?" "+st:st)}return st};function twJoin(){let o=0,et,tt,nt="";for(;o{if(typeof o=="string")return o;let et,tt="";for(let nt=0;ntdt(lt),o());return tt=createConfigUtils(ct),nt=tt.cache.get,rt=tt.cache.set,ot=st,st(at)}function st(at){const ct=nt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return rt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=o=>{const et=tt=>tt[o]||[];return et.isThemeGetter=!0,et},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=o=>isNumber(o)||stringLengths.has(o)||fractionRegex.test(o),isArbitraryLength=o=>getIsArbitraryValue(o,"length",isLengthOnly),isNumber=o=>!!o&&!Number.isNaN(Number(o)),isArbitraryNumber=o=>getIsArbitraryValue(o,"number",isNumber),isInteger$1=o=>!!o&&Number.isInteger(Number(o)),isPercent=o=>o.endsWith("%")&&isNumber(o.slice(0,-1)),isArbitraryValue=o=>arbitraryValueRegex.test(o),isTshirtSize=o=>tshirtUnitRegex.test(o),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=o=>getIsArbitraryValue(o,sizeLabels,isNever),isArbitraryPosition=o=>getIsArbitraryValue(o,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=o=>getIsArbitraryValue(o,imageLabels,isImage),isArbitraryShadow=o=>getIsArbitraryValue(o,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(o,et,tt)=>{const nt=arbitraryValueRegex.exec(o);return nt?nt[1]?typeof et=="string"?nt[1]===et:et.has(nt[1]):tt(nt[2]):!1},isLengthOnly=o=>lengthUnitRegex.test(o)&&!colorFunctionRegex.test(o),isNever=()=>!1,isShadow=o=>shadowRegex.test(o),isImage=o=>imageRegex.test(o),getDefaultConfig=()=>{const o=fromTheme("colors"),et=fromTheme("spacing"),tt=fromTheme("blur"),nt=fromTheme("brightness"),rt=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"),ft=fromTheme("gradientColorStops"),mt=fromTheme("gradientColorStopPositions"),pt=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),xt=fromTheme("padding"),vt=fromTheme("saturate"),bt=fromTheme("scale"),Et=fromTheme("sepia"),wt=fromTheme("skew"),kt=fromTheme("space"),It=fromTheme("translate"),Rt=()=>["auto","contain","none"],$t=()=>["auto","hidden","clip","visible","scroll"],Nt=()=>["auto",isArbitraryValue,et],Mt=()=>[isArbitraryValue,et],Bt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ft=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Yt=()=>["solid","dashed","dotted","double","none"],Ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ut=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Pt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Zt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Zt(),borderColor:[o],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Mt(),borderWidth:Bt(),contrast:Zt(),grayscale:qt(),hueRotate:Zt(),invert:qt(),gap:Mt(),gradientColorStops:[o],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:Nt(),margin:Nt(),opacity:Zt(),padding:Mt(),saturate:Zt(),scale:Zt(),sepia:qt(),skew:Zt(),space:Mt(),translate:Mt()},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:[...Ft(),isArbitraryValue]}],overflow:[{overflow:$t()}],"overflow-x":[{"overflow-x":$t()}],"overflow-y":[{"overflow-y":$t()}],overscroll:[{overscroll:Rt()}],"overscroll-x":[{"overscroll-x":Rt()}],"overscroll-y":[{"overscroll-y":Rt()}],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",...Ut()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ut(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ut(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[xt]}],px:[{px:[xt]}],py:[{py:[xt]}],ps:[{ps:[xt]}],pe:[{pe:[xt]}],pt:[{pt:[xt]}],pr:[{pr:[xt]}],pb:[{pb:[xt]}],pl:[{pl:[xt]}],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":[kt]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[kt]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,et]}],"min-w":[{"min-w":[isArbitraryValue,et,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,et,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,et,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,et,"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:[o]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Yt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Mt()}],"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:[...Ft(),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:[o]}],"gradient-from-pos":[{from:[mt]}],"gradient-via-pos":[{via:[mt]}],"gradient-to-pos":[{to:[mt]}],"gradient-from":[{from:[ft]}],"gradient-via":[{via:[ft]}],"gradient-to":[{to:[ft]}],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:[...Yt(),"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:Yt()}],"border-color":[{border:[rt]}],"border-color-x":[{"border-x":[rt]}],"border-color-y":[{"border-y":[rt]}],"border-color-s":[{"border-s":[rt]}],"border-color-e":[{"border-e":[rt]}],"border-color-t":[{"border-t":[rt]}],"border-color-r":[{"border-r":[rt]}],"border-color-b":[{"border-b":[rt]}],"border-color-l":[{"border-l":[rt]}],"divide-color":[{divide:[rt]}],"outline-style":[{outline:["",...Yt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Bt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Ht(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ht()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[nt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[vt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[nt]}],"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":[vt]}],"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:Zt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[bt]}],"scale-x":[{"scale-x":[bt]}],"scale-y":[{"scale-y":[bt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[It]}],"translate-y":[{"translate-y":[It]}],"skew-x":[{"skew-x":[wt]}],"skew-y":[{"skew-y":[wt]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",o]}],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:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Mt()}],"scroll-mx":[{"scroll-mx":Mt()}],"scroll-my":[{"scroll-my":Mt()}],"scroll-ms":[{"scroll-ms":Mt()}],"scroll-me":[{"scroll-me":Mt()}],"scroll-mt":[{"scroll-mt":Mt()}],"scroll-mr":[{"scroll-mr":Mt()}],"scroll-mb":[{"scroll-mb":Mt()}],"scroll-ml":[{"scroll-ml":Mt()}],"scroll-p":[{"scroll-p":Mt()}],"scroll-px":[{"scroll-px":Mt()}],"scroll-py":[{"scroll-py":Mt()}],"scroll-ps":[{"scroll-ps":Mt()}],"scroll-pe":[{"scroll-pe":Mt()}],"scroll-pt":[{"scroll-pt":Mt()}],"scroll-pr":[{"scroll-pr":Mt()}],"scroll-pb":[{"scroll-pb":Mt()}],"scroll-pl":[{"scroll-pl":Mt()}],"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:[o,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[o,"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(...o){return twMerge(clsx(o))}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:o,variant:et,size:tt,asChild:nt=!1,...rt},ot)=>{const it=nt?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:et,size:tt,className:o})),ref:ot,...rt})});Button.displayName="Button";function alloc$2(o=0){return new Uint8Array(o)}function allocUnsafe(o=0){return new Uint8Array(o)}const N1$1=Math.pow(2,7),N2$1=Math.pow(2,14),N3$1=Math.pow(2,21),N4$1=Math.pow(2,28),N5$1=Math.pow(2,35),N6$1=Math.pow(2,42),N7$1=Math.pow(2,49),MSB$2=128,REST$2=127;function encodingLength$3(o){if(oNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(o,et,tt=0){switch(encodingLength$3(o)){case 8:et[tt++]=o&255|MSB$2,o/=128;case 7:et[tt++]=o&255|MSB$2,o/=128;case 6:et[tt++]=o&255|MSB$2,o/=128;case 5:et[tt++]=o&255|MSB$2,o/=128;case 4:et[tt++]=o&255|MSB$2,o>>>=7;case 3:et[tt++]=o&255|MSB$2,o>>>=7;case 2:et[tt++]=o&255|MSB$2,o>>>=7;case 1:{et[tt++]=o&255,o>>>=7;break}default:throw new Error("unreachable")}return et}function encodeUint8ArrayList(o,et,tt=0){switch(encodingLength$3(o)){case 8:et.set(tt++,o&255|MSB$2),o/=128;case 7:et.set(tt++,o&255|MSB$2),o/=128;case 6:et.set(tt++,o&255|MSB$2),o/=128;case 5:et.set(tt++,o&255|MSB$2),o/=128;case 4:et.set(tt++,o&255|MSB$2),o>>>=7;case 3:et.set(tt++,o&255|MSB$2),o>>>=7;case 2:et.set(tt++,o&255|MSB$2),o>>>=7;case 1:{et.set(tt++,o&255),o>>>=7;break}default:throw new Error("unreachable")}return et}function decodeUint8Array(o,et){let tt=o[et],nt=0;if(nt+=tt&REST$2,tt>>31>0){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(tt+nt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(et=!1){if(et)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(BigInt(tt)+(BigInt(nt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(et=!1){return this.toBigInt(et).toString()}zzEncode(){const et=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^et)>>>0,this.lo=(this.lo<<1^et)>>>0,this}zzDecode(){const et=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^et)>>>0,this.hi=(this.hi>>>1^et)>>>0,this}length(){const et=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,nt=this.hi>>>24;return nt===0?tt===0?et<16384?et<128?1:2:et<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:nt<128?9:10}static fromBigInt(et){if(et===0n)return zero;if(etMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(et));const tt=et<0n;tt&&(et=-et);let nt=et>>32n,rt=et-(nt<<32n);return tt&&(nt=~nt|0n,rt=~rt|0n,++rt>TWO_32&&(rt=0n,++nt>TWO_32&&(nt=0n))),new Er(Number(rt),Number(nt))}static fromNumber(et){if(et===0)return zero;const tt=et<0;tt&&(et=-et);let nt=et>>>0,rt=(et-nt)/4294967296>>>0;return tt&&(rt=~rt>>>0,nt=~nt>>>0,++nt>4294967295&&(nt=0,++rt>4294967295&&(rt=0))),new Er(nt,rt)}static from(et){return typeof et=="number"?Er.fromNumber(et):typeof et=="bigint"?Er.fromBigInt(et):typeof et=="string"?Er.fromBigInt(BigInt(et)):et.low!=null||et.high!=null?new Er(et.low>>>0,et.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$1(o){let et=0,tt=0;for(let nt=0;nt191&&st<224?ot[it++]=(st&31)<<6|o[et++]&63:st>239&&st<365?(st=((st&7)<<18|(o[et++]&63)<<12|(o[et++]&63)<<6|o[et++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(o[et++]&63)<<6|o[et++]&63,it>8191&&((rt??(rt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return rt!=null?(it>0&&rt.push(String.fromCharCode.apply(String,ot.slice(0,it))),rt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(o,et,tt){const nt=tt;let rt,ot;for(let it=0;it>6|192,et[tt++]=rt&63|128):(rt&64512)===55296&&((ot=o.charCodeAt(it+1))&64512)===56320?(rt=65536+((rt&1023)<<10)+(ot&1023),++it,et[tt++]=rt>>18|240,et[tt++]=rt>>12&63|128,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128):(et[tt++]=rt>>12|224,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128);return tt-nt}function indexOutOfRange$1(o,et){return RangeError(`index out of range: ${o.pos} + ${et??1} > ${o.len}`)}function readFixed32End(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}class Uint8ArrayReader{constructor(et){Ct(this,"buf");Ct(this,"pos");Ct(this,"len");Ct(this,"_slice",Uint8Array.prototype.subarray);this.buf=et,this.pos=0,this.len=et.length}uint32(){let et=4294967295;if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return et}int32(){return this.uint32()|0}sint32(){const et=this.uint32();return et>>>1^-(et&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 et=readFloatLE(this.buf,this.pos);return this.pos+=4,et}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const et=readDoubleLE(this.buf,this.pos);return this.pos+=8,et}bytes(){const et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange$1(this,et);return this.pos+=et,tt===nt?new Uint8Array(0):this.buf.subarray(tt,nt)}string(){const et=this.bytes();return read$2(et,0,et.length)}skip(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange$1(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(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}readLongVarint(){const et=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)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;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(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(;tt<5;++tt)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const et=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(et,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const et=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$3(et),et}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(o){return new Uint8ArrayReader(o instanceof Uint8Array?o:o.subarray())}function decodeMessage(o,et,tt){const nt=createReader(o);return et.decode(nt,void 0,tt)}function equals$2(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),nt=0;nt>>0,bt=new Uint8Array(vt);gt!==xt;){for(var Et=mt[gt],wt=0,kt=vt-1;(Et!==0||wt>>0,bt[kt]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=wt,gt++}for(var It=vt-yt;It!==vt&&bt[It]===0;)It++;for(var Rt=at.repeat(pt);It>>0,vt=new Uint8Array(xt);mt[pt];){var bt=tt[mt.charCodeAt(pt)];if(bt===255)return;for(var Et=0,wt=xt-1;(bt!==0||Et>>0,vt[wt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(mt[pt]!==" "){for(var kt=xt-gt;kt!==xt&&vt[kt]===0;)kt++;for(var It=new Uint8Array(yt+(xt-kt)),Rt=yt;kt!==xt;)It[Rt++]=vt[kt++];return It}}}function ft(mt){var pt=ht(mt);if(pt)return pt;throw new Error(`Non-${et} character`)}return{encode:dt,decodeUnsafe:ht,decode:ft}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;let Encoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");this.name=et,this.prefix=tt,this.baseEncode=nt}encode(et){if(et instanceof Uint8Array)return`${this.prefix}${this.baseEncode(et)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseDecode");Ct(this,"prefixCodePoint");this.name=et,this.prefix=tt;const rt=tt.codePointAt(0);if(rt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=rt,this.baseDecode=nt}decode(et){if(typeof et=="string"){if(et.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(et)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(et.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(et){return or$2(this,et)}};class ComposedDecoder{constructor(et){Ct(this,"decoders");this.decoders=et}or(et){return or$2(this,et)}decode(et){const tt=et[0],nt=this.decoders[tt];if(nt!=null)return nt.decode(et);throw RangeError(`Unable to decode multibase string ${JSON.stringify(et)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or$2(o,et){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...et.decoders??{[et.prefix]:et}})}class Codec{constructor(et,tt,nt,rt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");Ct(this,"baseDecode");Ct(this,"encoder");Ct(this,"decoder");this.name=et,this.prefix=tt,this.baseEncode=nt,this.baseDecode=rt,this.encoder=new Encoder$2(et,tt,nt),this.decoder=new Decoder$2(et,tt,rt)}encode(et){return this.encoder.encode(et)}decode(et){return this.decoder.decode(et)}}function from$2({name:o,prefix:et,encode:tt,decode:nt}){return new Codec(o,et,tt,nt)}function baseX({name:o,prefix:et,alphabet:tt}){const{encode:nt,decode:rt}=_brrp__multiformats_scope_baseX(tt,o);return from$2({prefix:et,name:o,encode:nt,decode:ot=>coerce(rt(ot))})}function decode$a(o,et,tt,nt){const rt={};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$9(o,et,tt){const nt=et[et.length-1]==="=",rt=(1<tt;)it-=tt,ot+=et[rt&st>>it];if(it!==0&&(ot+=et[rt&st<(o[tt]=et,o),[]),alphabetCharsToBytes=alphabet.reduce((o,et,tt)=>{const nt=et.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${et}`);return o[nt]=tt,o},[]);function encode$8(o){return o.reduce((et,tt)=>(et+=alphabetBytesToChars[tt],et),"")}function decode$9(o){const et=[];for(const tt of o){const nt=tt.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${tt}`);const rt=alphabetCharsToBytes[nt];if(rt==null)throw new Error(`Non-base256emoji character: ${tt}`);et.push(rt)}return new Uint8Array(et)}const base256emoji=from$2({prefix:"🚀",name:"base256emoji",encode:encode$8,decode:decode$9}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$9(o),decode:o=>fromString$1(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var encode_1=encode$7,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode$7(o,et,tt){et=et||[],tt=tt||0;for(var nt=tt;o>=INT;)et[tt++]=o&255|MSB$1,o/=128;for(;o&MSBALL;)et[tt++]=o&255|MSB$1,o>>>=7;return et[tt]=o|0,encode$7.bytes=tt-nt+1,et}var decode$8=read$1,MSB$1$1=128,REST$1$1=127;function read$1(o,nt){var tt=0,nt=nt||0,rt=0,ot=nt,it,st=o.length;do{if(ot>=st)throw read$1.bytes=0,new RangeError("Could not decode varint");it=o[ot++],tt+=rt<28?(it&REST$1$1)<=MSB$1$1);return read$1.bytes=ot-nt,tt}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return ocreate$3(this.code,nt))}else throw Error("Unknown type, must be binary type")}}function sha(o){return async et=>new Uint8Array(await crypto.subtle.digest(o,et))}const sha256=from$1({name:"sha2-256",code:18,encode:sha("SHA-256")});function format(o,et){const{bytes:tt,version:nt}=o;switch(nt){case 0:return toStringV0(tt,baseCache(o),et??base58btc.encoder);default:return toStringV1(tt,baseCache(o),et??base32$2.encoder)}}const cache$1=new WeakMap;function baseCache(o){const et=cache$1.get(o);if(et==null){const tt=new Map;return cache$1.set(o,tt),tt}return et}var Xs;class CID{constructor(et,tt,nt,rt){Ct(this,"code");Ct(this,"version");Ct(this,"multihash");Ct(this,"bytes");Ct(this,"/");Ct(this,Xs,"CID");this.code=tt,this.version=et,this.multihash=nt,this.bytes=rt,this["/"]=rt}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:et,multihash:tt}=this;if(et!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(tt.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(tt)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:et,digest:tt}=this.multihash,nt=create$3(et,tt);return CID.createV1(this.code,nt)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(et){return CID.equals(this,et)}static equals(et,tt){const nt=tt;return nt!=null&&et.code===nt.code&&et.version===nt.version&&equals$1(et.multihash,nt.multihash)}toString(et){return format(this,et)}toJSON(){return{"/":format(this)}}link(){return this}[(Xs=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(et){if(et==null)return null;const tt=et;if(tt instanceof CID)return tt;if(tt["/"]!=null&&tt["/"]===tt.bytes||tt.asCID===tt){const{version:nt,code:rt,multihash:ot,bytes:it}=tt;return new CID(nt,rt,ot,it??encodeCID(nt,rt,ot.bytes))}else if(tt[cidSymbol]===!0){const{version:nt,multihash:rt,code:ot}=tt,it=decode$6(rt);return CID.create(nt,ot,it)}else return null}static create(et,tt,nt){if(typeof tt!="number")throw new Error("String codecs are no longer supported");if(!(nt.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(et){case 0:{if(tt!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(et,tt,nt,nt.bytes)}case 1:{const rt=encodeCID(et,tt,nt.bytes);return new CID(et,tt,nt,rt)}default:throw new Error("Invalid version")}}static createV0(et){return CID.create(0,DAG_PB_CODE,et)}static createV1(et,tt){return CID.create(1,et,tt)}static decode(et){const[tt,nt]=CID.decodeFirst(et);if(nt.length!==0)throw new Error("Incorrect length");return tt}static decodeFirst(et){const tt=CID.inspectBytes(et),nt=tt.size-tt.multihashSize,rt=coerce(et.subarray(nt,nt+tt.multihashSize));if(rt.byteLength!==tt.multihashSize)throw new Error("Incorrect length");const ot=rt.subarray(tt.multihashSize-tt.digestSize),it=new Digest(tt.multihashCode,tt.digestSize,ot,rt);return[tt.version===0?CID.createV0(it):CID.createV1(tt.codec,it),et.subarray(tt.size)]}static inspectBytes(et){let tt=0;const nt=()=>{const[dt,ht]=decode$7(et.subarray(tt));return tt+=ht,dt};let rt=nt(),ot=DAG_PB_CODE;if(rt===18?(rt=0,tt=0):ot=nt(),rt!==0&&rt!==1)throw new RangeError(`Invalid CID version ${rt}`);const it=tt,st=nt(),at=nt(),ct=tt+at,lt=ct-it;return{version:rt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(et,tt){const[nt,rt]=parseCIDtoBytes(et,tt),ot=CID.decode(rt);if(ot.version===0&&et[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(ot).set(nt,et),ot}}function parseCIDtoBytes(o,et){switch(o[0]){case"Q":{const tt=et??base58btc;return[base58btc.prefix,tt.decode(`${base58btc.prefix}${o}`)]}case base58btc.prefix:{const tt=et??base58btc;return[base58btc.prefix,tt.decode(o)]}case base32$2.prefix:{const tt=et??base32$2;return[base32$2.prefix,tt.decode(o)]}case base36.prefix:{const tt=et??base36;return[base36.prefix,tt.decode(o)]}default:{if(et==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[o[0],et.decode(o)]}}}function toStringV0(o,et,tt){const{prefix:nt}=tt;if(nt!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const rt=et.get(nt);if(rt==null){const ot=tt.encode(o).slice(1);return et.set(nt,ot),ot}else return rt}function toStringV1(o,et,tt){const{prefix:nt}=tt,rt=et.get(nt);if(rt==null){const ot=tt.encode(o);return et.set(nt,ot),ot}else return rt}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,et,tt){const nt=encodingLength$2(o),rt=nt+encodingLength$2(et),ot=new Uint8Array(rt+tt.byteLength);return encodeTo(o,ot,0),encodeTo(et,ot,nt),ot.set(tt,rt),ot}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$3,...base36$1,...base58,...base64$3,...base256emoji$1};function createCodec$1(o,et,tt,nt){return{name:o,prefix:et,encoder:{name:o,prefix:et,encode:tt},decoder:{decode:nt}}}const string$4=createCodec$1("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),ascii=createCodec$1("ascii","a",o=>{let et="a";for(let tt=0;tt{o=o.substring(1);const et=allocUnsafe(o.length);for(let tt=0;tt4096)return allocUnsafe(it);rt+it>8192&&(nt=allocUnsafe(8192),rt=0);const st=nt.subarray(rt,rt+=it);return rt&7&&(rt=(rt|7)+1),st}}let Op$1=class{constructor(et,tt,nt){Ct(this,"fn");Ct(this,"len");Ct(this,"next");Ct(this,"val");this.fn=et,this.len=tt,this.next=void 0,this.val=nt}};function noop$2(){}let State$1=class{constructor(et){Ct(this,"head");Ct(this,"tail");Ct(this,"len");Ct(this,"next");this.head=et.head,this.tail=et.tail,this.len=et.len,this.next=et.states}};const bufferPool=pool$1();function alloc$1(o){return globalThis.Buffer!=null?allocUnsafe(o):bufferPool(o)}class Uint8ArrayWriter{constructor(){Ct(this,"len");Ct(this,"head");Ct(this,"tail");Ct(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(et,tt,nt){return this.tail=this.tail.next=new Op$1(et,tt,nt),this.len+=tt,this}uint32(et){return this.len+=(this.tail=this.tail.next=new VarintOp$1((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this}int32(et){return et<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(et)):this.uint32(et)}sint32(et){return this.uint32((et<<1^et>>31)>>>0)}uint64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(et){return this._push(encodeUint8Array,encodingLength$3(et),et)}uint64String(et){return this.uint64(BigInt(et))}int64(et){return this.uint64(et)}int64Number(et){return this.uint64Number(et)}int64String(et){return this.uint64String(et)}sint64(et){const tt=LongBits$2.fromBigInt(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(et){const tt=LongBits$2.fromNumber(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(et){return this.sint64(BigInt(et))}bool(et){return this._push(writeByte$1,1,et?1:0)}fixed32(et){return this._push(writeFixed32$1,4,et>>>0)}sfixed32(et){return this.fixed32(et)}fixed64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(et){const tt=LongBits$2.fromNumber(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(et){return this.fixed64(BigInt(et))}sfixed64(et){return this.fixed64(et)}sfixed64Number(et){return this.fixed64Number(et)}sfixed64String(et){return this.fixed64String(et)}float(et){return this._push(writeFloatLE,4,et)}double(et){return this._push(writeDoubleLE,8,et)}bytes(et){const tt=et.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,et)}string(et){const tt=length$1(et);return tt!==0?this.uint32(tt)._push(write$2,tt,et):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 et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt!==0&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this}finish(){let et=this.head.next;const tt=alloc$1(this.len);let nt=0;for(;et!=null;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt}}function writeByte$1(o,et,tt){et[tt]=o&255}function writeVarint32$1(o,et,tt){for(;o>127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}let VarintOp$1=class extends Op$1{constructor(tt,nt){super(writeVarint32$1,tt,nt);Ct(this,"next");this.next=void 0}};function writeVarint64$1(o,et,tt){for(;o.hi!==0;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}function writeFixed32$1(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeBytes$1(o,et,tt){et.set(o,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(o){const et=o.length>>>0;return this.uint32(et),et>0&&this._push(writeBytesBuffer,et,o),this},Uint8ArrayWriter.prototype.string=function(o){const et=globalThis.Buffer.byteLength(o);return this.uint32(et),et>0&&this._push(writeStringBuffer$1,et,o),this});function writeBytesBuffer(o,et,tt){et.set(o,tt)}function writeStringBuffer$1(o,et,tt){o.length<40?write$2(o,et,tt):et.utf8Write!=null?et.utf8Write(o,tt):et.set(fromString(o),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(o,et){const tt=createWriter();return et.encode(o,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(o){o[o.VARINT=0]="VARINT",o[o.BIT64=1]="BIT64",o[o.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",o[o.START_GROUP=3]="START_GROUP",o[o.END_GROUP=4]="END_GROUP",o[o.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(o,et,tt,nt){return{name:o,type:et,encode:tt,decode:nt}}function enumeration(o){function et(rt){if(o[rt.toString()]==null)throw new Error("Invalid enum value");return o[rt]}const tt=function(ot,it){const st=et(ot);it.int32(st)},nt=function(ot){const it=ot.int32();return et(it)};return createCodec("enum",CODEC_TYPES.VARINT,tt,nt)}function message$1(o,et){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,o,et)}class MaxLengthError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_LENGTH");Ct(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_SIZE");Ct(this,"name","MaxSizeError")}}var RateLimitProof$9;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$9||(RateLimitProof$9={}));var WakuMessage$9;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$9.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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$9.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$9||(WakuMessage$9={}));var FilterRequest$1;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.contentTopic!=null&&rt.contentTopic!==""&&(ot.uint32(10),ot.string(rt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={contentTopic:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.contentTopic=rt.string();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.ContentFilter||(o.ContentFilter={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(nt.uint32(8),nt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(nt.uint32(18),nt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)nt.uint32(26),o.ContentFilter.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=rt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===rt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(o.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRequest$1||(FilterRequest$1={}));var MessagePush$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.messages!=null)for(const ot of tt.messages)nt.uint32(10),WakuMessage$8.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessage$8.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$3||(MessagePush$3={}));var FilterRpc$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),FilterRequest$1.codec().encode(tt.request,nt)),tt.push!=null&&(nt.uint32(26),MessagePush$3.codec().encode(tt.push,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$3.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRpc$1||(FilterRpc$1={}));var RateLimitProof$8;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$8||(RateLimitProof$8={}));var WakuMessage$8;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$8.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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$8.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$8||(WakuMessage$8={}));var TopicOnlyMessage$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(TopicOnlyMessage$1||(TopicOnlyMessage$1={}));var FilterSubscribeRequest$1;(function(o){let et;(function(rt){rt.SUBSCRIBER_PING="SUBSCRIBER_PING",rt.SUBSCRIBE="SUBSCRIBE",rt.UNSUBSCRIBE="UNSUBSCRIBE",rt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let tt;(function(rt){rt[rt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",rt[rt.SUBSCRIBE=1]="SUBSCRIBE",rt[rt.UNSUBSCRIBE=2]="UNSUBSCRIBE",rt[rt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(rt){rt.codec=()=>enumeration(tt)}(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let nt;o.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),rt.requestId!=null&&rt.requestId!==""&&(ot.uint32(10),ot.string(rt.requestId)),rt.filterSubscribeType!=null&&tt[rt.filterSubscribeType]!==0&&(ot.uint32(16),o.FilterSubscribeType.codec().encode(rt.filterSubscribeType,ot)),rt.pubsubTopic!=null&&(ot.uint32(82),ot.string(rt.pubsubTopic)),rt.contentTopics!=null)for(const st of rt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:et.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.requestId=rt.string();break}case 2:{st.filterSubscribeType=o.FilterSubscribeType.codec().decode(rt);break}case 10:{st.pubsubTopic=rt.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(rt.string());break}default:{rt.skipType(lt&7);break}}}return st})),nt),o.encode=rt=>encodeMessage(rt,o.codec()),o.decode=(rt,ot)=>decodeMessage(rt,o.codec(),ot)})(FilterSubscribeRequest$1||(FilterSubscribeRequest$1={}));var FilterSubscribeResponse$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={requestId:"",statusCode:0},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterSubscribeResponse$2||(FilterSubscribeResponse$2={}));var MessagePush$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.wakuMessage!=null&&(nt.uint32(10),WakuMessage$7.codec().encode(tt.wakuMessage,nt)),tt.pubsubTopic!=null&&(nt.uint32(18),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$7.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$2||(MessagePush$2={}));var RateLimitProof$7;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$7||(RateLimitProof$7={}));var WakuMessage$7;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$7.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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$7.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$7||(WakuMessage$7={}));var PushRequest$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(nt.uint32(10),nt.string(tt.pubsubTopic)),tt.message!=null&&(nt.uint32(18),WakuMessage$6.codec().encode(tt.message,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={pubsubTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$6.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRequest$1||(PushRequest$1={}));var PushResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(nt.uint32(8),nt.bool(tt.isSuccess)),tt.info!=null&&(nt.uint32(18),nt.string(tt.info)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={isSuccess:!1},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushResponse$1||(PushResponse$1={}));var PushRpc$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),PushRequest$1.codec().encode(tt.request,nt)),tt.response!=null&&(nt.uint32(26),PushResponse$1.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRpc$2||(PushRpc$2={}));var RateLimitProof$6;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$6||(RateLimitProof$6={}));var WakuMessage$6;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$6.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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$6.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$6||(WakuMessage$6={}));var WakuMessageKeyValue$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.messageHash!=null&&(nt.uint32(10),nt.bytes(tt.messageHash)),tt.message!=null&&(nt.uint32(18),WakuMessage$5.codec().encode(tt.message,nt)),tt.pubsubTopic!=null&&(nt.uint32(26),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage$5.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessageKeyValue$1||(WakuMessageKeyValue$1={}));var StoreQueryRequest$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(nt.uint32(16),nt.bool(tt.includeData)),tt.pubsubTopic!=null&&(nt.uint32(82),nt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)nt.uint32(90),nt.string(ot);if(tt.timeStart!=null&&(nt.uint32(96),nt.sint64(tt.timeStart)),tt.timeEnd!=null&&(nt.uint32(104),nt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)nt.uint32(162),nt.bytes(ot);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(nt.uint32(416),nt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(nt.uint32(424),nt.uint64(tt.paginationLimit)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===rt.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=rt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryRequest$2||(StoreQueryRequest$2={}));var StoreQueryResponse$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)nt.uint32(162),WakuMessageKeyValue$1.codec().encode(ot,nt);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",messages:[]},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessageKeyValue$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryResponse$2||(StoreQueryResponse$2={}));var RateLimitProof$5;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$5||(RateLimitProof$5={}));var WakuMessage$5;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$5.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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$5.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$5||(WakuMessage$5={}));var PeerInfo$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.enr!=null&&(nt.uint32(10),nt.bytes(tt.enr)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerInfo$1||(PeerInfo$1={}));var PeerExchangeQuery$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.numPeers!=null&&(nt.uint32(8),nt.uint64(tt.numPeers)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeQuery$1||(PeerExchangeQuery$1={}));var PeerExchangeResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)nt.uint32(10),PeerInfo$1.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerInfos:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===rt.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');ot.peerInfos.push(PeerInfo$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeResponse$1||(PeerExchangeResponse$1={}));var PeerExchangeRPC$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.query!=null&&(nt.uint32(10),PeerExchangeQuery$1.codec().encode(tt.query,nt)),tt.response!=null&&(nt.uint32(18),PeerExchangeResponse$1.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeRPC$2||(PeerExchangeRPC$2={}));var WakuMetadataRequest$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataRequest$1||(WakuMetadataRequest$1={}));var WakuMetadataResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataResponse$1||(WakuMetadataResponse$1={}));function isDefined(o){return!!o}function groupByContentTopic(o){const et=new Map;return o.forEach(tt=>{let nt=et.get(tt.contentTopic);nt||(et.set(tt.contentTopic,[]),nt=et.get(tt.contentTopic)),nt.push(tt)}),et}const FRAME_RATE=60;async function toAsyncIterator(o,et,tt){const nt=FRAME_RATE,rt=[];let ot;ot=await o.subscribeWithUnsubscribe(et,lt=>{rt.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(nt);const lt=rt.shift();if(!ot&&rt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(o){return new Promise(et=>{setTimeout(et,o)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(o,et){const tt=await o.toWire(et);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=o=>o.length/MB<=SIZE_CAP_IN_MB;var Protocols$3;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols$3||(Protocols$3={}));var ProtocolError$4;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$4||(ProtocolError$4={}));var Tags$3;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags$3||(Tags$3={}));var EPeersByDiscoveryEvents$3;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents$3||(EPeersByDiscoveryEvents$3={}));var EConnectionStateEvents$3;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents$3||(EConnectionStateEvents$3={}));const DEFAULT_CLUSTER_ID$1=1;var HealthStatus$3;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus$3||(HealthStatus$3={}));function toString$8(o,et="utf8"){const tt=BASES[et];if(tt==null)throw new Error(`Unsupported encoding "${et}"`);return tt.encoder.encode(o).substring(1)}function hexToBytes$1(o){if(typeof o=="string"){const et=o.replace(/^0x/i,"");return fromString(et.toLowerCase(),"base16")}return o}function numberToBytes(o){const et=new ArrayBuffer(8),tt=new DataView(et);return typeof o=="number"?tt.setFloat64(0,o,!1):tt.setBigInt64(0,o,!1),new Uint8Array(et)}const bytesToHex$1=o=>toString$8(o,"base16"),bytesToUtf8=o=>toString$8(o,"utf8"),utf8ToBytes$1=o=>fromString(o,"utf8");function concat$2(o,et){const tt=o.reduce((ot,it)=>ot+it.length,0),nt=new Uint8Array(tt);let rt=0;for(const ot of o)nt.set(ot,rt),rt+=ot.length;return nt}function isStaticSharding(o){return"clusterId"in o&&"shards"in o&&!("contentTopics"in o)}function isAutoSharding(o){return"contentTopics"in o}function derivePubsubTopicsFromNetworkConfig(o){if(isStaticSharding(o)){if(o.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(o)}else if(isAutoSharding(o)){if(o.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=o=>{if(o.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID$1}/${o.shard}`},shardInfoToPubsubTopics=o=>{if("contentTopics"in o&&o.contentTopics)return Array.from(new Set(o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))));if("shards"in o){if(o.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(o.shards.map(et=>`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID$1}/${et}`)))}else{if("application"in o&&"version"in o)return[contentTopicToPubsubTopic(`/${o.application}/${o.version}/default/default`,o.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=o=>{const et=o.split("/");if(et.length!=6||et[1]!=="waku"||et[2]!=="2"||et[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(et[4]),nt=parseInt(et[5]);if(isNaN(tt)||isNaN(nt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:nt}},pubsubTopicsToShardInfo=o=>{const et=new Set,tt=new Set;for(const ot of o){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);et.add(`${it}:${st}`),tt.add(it)}if(et.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 nt=tt.values().next().value,rt=Array.from(et).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:nt,shards:rt}};function ensurePubsubTopicIsConfigured(o,et){if(!et.includes(o))throw new Error(`Pubsub topic ${o} has not been configured on this instance. Configured topics are: ${et}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(o){const et=o.split("/");if(et.length<5||et.length>6)throw Error("Content topic format is invalid");let tt=0;if(et.length==6){if(tt=parseInt(et[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 nt=et.splice(-4);if(nt[0].length==0)throw new Error("Application field cannot be empty");if(nt[1].length==0)throw new Error("Version field cannot be empty");if(nt[2].length==0)throw new Error("Topic name field cannot be empty");if(nt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:nt[0],version:nt[1],topicName:nt[2],encoding:nt[3]}}function contentTopicToShardIndex(o,et=8){const{application:tt,version:nt}=ensureValidContentTopic(o),rt=sha256$2(concat$2([utf8ToBytes$1(tt),utf8ToBytes$1(nt)])),ot=new DataView(rt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(et))}function contentTopicToPubsubTopic(o,et=DEFAULT_CLUSTER_ID$1,tt=8){if(!o)throw Error("Content topic must be specified");const nt=contentTopicToShardIndex(o,tt);return`/waku/2/rs/${et}/${nt}`}function determinePubsubTopic(o,et){return typeof et=="string"?et:(et==null?void 0:et.shard)!==void 0?singleShardInfoToPubsubTopic(et):contentTopicToPubsubTopic(o,(et==null?void 0:et.clusterId)??DEFAULT_CLUSTER_ID$1)}const decodeRelayShard=o=>{if(o=new Uint8Array(o),o.length<3)throw new Error("Insufficient data");const et=new DataView(o.buffer),tt=et.getUint16(0),nt=[];if(o.length===130)for(let rt=0;rt<1024;rt++){const ot=Math.floor(rt/8)+2,it=7-rt%8;et.getUint8(ot)&1<=o.length)throw new Error("Unexpected end of data");nt.push(et.getUint16(it))}}return{clusterId:tt,shards:nt}},encodeRelayShard=o=>{const{clusterId:et,shards:tt}=o,nt=tt.length>=64?130:3+2*tt.length,rt=new ArrayBuffer(nt),ot=new DataView(rt);if(ot.setUint16(0,et),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(!et)throw new Error("No ws multiaddr found in the given addresses");return et}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var o=1e3,et=o*60,tt=et*60,nt=tt*24,rt=nt*7,ot=nt*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]),ft=(dt[2]||"ms").toLowerCase();switch(ft){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*rt;case"days":case"day":case"d":return ht*nt;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*et;case"seconds":case"second":case"secs":case"sec":case"s":return ht*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=nt?Math.round(lt/nt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=et?Math.round(lt/et)+"m":dt>=o?Math.round(lt/o)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=nt?ct(lt,dt,nt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=et?ct(lt,dt,et,"minute"):dt>=o?ct(lt,dt,o,"second"):lt+" ms"}function ct(lt,dt,ht,ft){var mt=dt>=ht*1.5;return Math.round(lt/ht)+" "+ft+(mt?"s":"")}return ms$1}function setup$1(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),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=nt,pt.destroy=tt.destroy,Object.defineProperty(pt,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(ft!==tt.namespaces&&(ft=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(pt),pt}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),ft=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`."))}})(),et.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 rt(){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 ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,ft=0;lt[0].replace(/%[a-zA-Z%]/g,mt=>{mt!=="%%"&&(ht++,mt==="%c"&&(ft=ht))}),lt.splice(ft,0,dt)}et.log=console.debug||console.log||(()=>{});function it(lt){try{lt?et.storage.setItem("debug",lt):et.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=et.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=nt.DEBUG),lt}function at(){try{return localStorage}catch{}}o.exports=common$1(et);const{formatters:ct}=o.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 Zo{constructor(et){Ct(this,"_info");Ct(this,"_warn");Ct(this,"_error");this._info=debug(Zo.createDebugNamespace("info",et)),this._warn=debug(Zo.createDebugNamespace("warn",et)),this._error=debug(Zo.createDebugNamespace("error",et))}static createDebugNamespace(et,tt){return tt?`${APP_NAME}:${et}:${tt}`:`${APP_NAME}:${et}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(et,...tt){const nt=this[et];nt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"proto");this.pubsubTopic=et,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 et=this.proto.timestamp/OneMillion;return new Date(Number(et))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$1=class{constructor(et,tt=!1,nt,rt){Ct(this,"contentTopic");Ct(this,"ephemeral");Ct(this,"pubsubTopic");Ct(this,"metaSetter");if(this.contentTopic=et,this.ephemeral=tt,this.pubsubTopic=nt,this.metaSetter=rt,!et||et==="")throw new Error("Content topic must be specified")}async toWire(et){return WakuMessage$9.encode(await this.toProtoObj(et))}async toProtoObj(et){const tt=et.timestamp??new Date,nt={payload:et.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:et.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const rt=this.metaSetter(nt);return{...nt,meta:rt}}return nt}};function createEncoder({pubsubTopic:o,pubsubTopicShardInfo:et,contentTopic:tt,ephemeral:nt,metaSetter:rt}){return new Encoder$1(tt,nt,determinePubsubTopic(tt,o??et),rt)}let Decoder$1=class{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"contentTopic");if(this.pubsubTopic=et,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(et){const tt=WakuMessage$9.decode(et);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(et,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(et,tt)}};function createDecoder(o,et){return new Decoder$1(determinePubsubTopic(o,et),o)}var Protocols$2;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols$2||(Protocols$2={}));var ProtocolError$3;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$3||(ProtocolError$3={}));var Tags$2;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags$2||(Tags$2={}));var EPeersByDiscoveryEvents$2;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents$2||(EPeersByDiscoveryEvents$2={}));var EConnectionStateEvents$2;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents$2||(EConnectionStateEvents$2={}));const DNS_DISCOVERY_TAG$1="@waku/bootstrap";var HealthStatus$2;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus$2||(HealthStatus$2={}));function isAsyncIterable$8(o){return o[Symbol.asyncIterator]!=null}function all$2(o){if(isAsyncIterable$8(o))return(async()=>{const tt=[];for await(const nt of o)tt.push(nt);return tt})();const et=[];for(const tt of o)et.push(tt);return et}function asUint8Array(o){return o}function concat$1(o,et){et==null&&(et=o.reduce((rt,ot)=>rt+ot.length,0));const tt=allocUnsafe(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function equals(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(et)}*[(Js=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...et){this.appendAll(et)}appendAll(et){let tt=0;for(const nt of et)if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.push(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.push(...nt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...et){this.prependAll(et)}prependAll(et){let tt=0;for(const nt of et.reverse())if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.unshift(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.unshift(...nt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(et){const tt=findBufAndOffset(this.bufs,et);return tt.buf[tt.index]}set(et,tt){const nt=findBufAndOffset(this.bufs,et);nt.buf[nt.index]=tt}write(et,tt=0){if(et instanceof Uint8Array)for(let nt=0;nt0;)if(et>=this.bufs[0].byteLength)et-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(et),this.length-=et;break}}}slice(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return concat$1(nt,rt)}subarray(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return nt.length===1?nt[0]:concat$1(nt,rt)}sublist(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt),ot=new Uint8ArrayList;return ot.length=rt,ot.bufs=[...nt],ot}_subList(et,tt){if(et=et??0,tt=tt??this.length,et<0&&(et=this.length+et),tt<0&&(tt=this.length+tt),et<0||tt>this.length)throw new RangeError("index is out of bounds");if(et===tt)return{bufs:[],length:0};if(et===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const nt=[];let rt=0;for(let ot=0;ot=at)continue;const ct=et>=st&&etst&&tt<=at;if(ct&<){if(et===st&&tt===at){nt.push(it);break}const dt=et-st;nt.push(it.subarray(dt,dt+(tt-et)));break}if(ct){if(et===0){nt.push(it);continue}nt.push(it.subarray(et-st));continue}if(lt){if(tt===at){nt.push(it);break}nt.push(it.subarray(0,tt-st));break}nt.push(it)}return{bufs:nt,length:tt-et}}indexOf(et,tt=0){if(!isUint8ArrayList(et)&&!(et instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const nt=et instanceof Uint8Array?et:et.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),et.length===0)return tt>this.length?this.length:tt;const rt=nt.byteLength;if(rt===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 ft=this.get(dt+ht);if(nt[ht]!==ft){lt=Math.max(1,ht-st[ft]);break}}if(lt===0)return dt}return-1}getInt8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt8(0,tt),this.write(nt,et)}getInt16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt16(0,tt)}setInt16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt16(0,tt,nt),this.write(rt,et)}getInt32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(0,tt)}setInt32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt32(0,tt,nt),this.write(rt,et)}getBigInt64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigInt64(0,tt)}setBigInt64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigInt64(0,tt,nt),this.write(rt,et)}getUint8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint8(0,tt),this.write(nt,et)}getUint16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint16(0,tt)}setUint16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint16(0,tt,nt),this.write(rt,et)}getUint32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(0,tt)}setUint32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint32(0,tt,nt),this.write(rt,et)}getBigUint64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigUint64(0,tt)}setBigUint64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigUint64(0,tt,nt),this.write(rt,et)}getFloat32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(0,tt)}setFloat32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat32(0,tt,nt),this.write(rt,et)}getFloat64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(0,tt)}setFloat64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat64(0,tt,nt),this.write(rt,et)}equals(et){if(et==null||!(et instanceof Uint8ArrayList)||et.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttrt+ot.byteLength,0)),nt.length=tt,nt}}function isAsyncIterable$7(o){return o[Symbol.asyncIterator]!=null}const defaultEncoder=o=>{const et=encodingLength$3(o),tt=allocUnsafe(et);return encode$a(o,tt),defaultEncoder.bytes=et,tt};defaultEncoder.bytes=0;function encode$5(o,et){et=et??{};const tt=et.lengthEncoder??defaultEncoder;function*nt(rt){const ot=tt(rt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,rt instanceof Uint8Array?yield rt:yield*rt}return isAsyncIterable$7(o)?async function*(){for await(const rt of o)yield*nt(rt)}():function*(){for(const rt of o)yield*nt(rt)}()}encode$5.single=(o,et)=>{et=et??{};const tt=et.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(o.byteLength),o)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(o){o[o.LENGTH=0]="LENGTH",o[o.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=o=>{const et=decode$b(o);return defaultDecoder.bytes=encodingLength$3(et),et};defaultDecoder.bytes=0;function decode$5(o,et){const tt=new Uint8ArrayList;let nt=ReadMode.LENGTH,rt=-1;const ot=(et==null?void 0:et.lengthDecoder)??defaultDecoder,it=(et==null?void 0:et.maxLengthLength)??MAX_LENGTH_LENGTH,st=(et==null?void 0:et.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(nt===ReadMode.LENGTH)try{if(rt=ot(tt),rt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(rt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(et==null?void 0:et.onLength)!=null&&et.onLength(rt),nt=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(nt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of o)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$5.fromReader=(o,et)=>{let tt=1;const nt=async function*(){for(;;)try{const{done:ot,value:it}=await o.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$5(nt,{...et??{},onLength:ot=>{tt=ot}})};function pDefer(){const o={};return o.promise=new Promise((et,tt)=>{o.resolve=et,o.reject=tt}),o}class FixedFIFO{constructor(et){Ct(this,"buffer");Ct(this,"mask");Ct(this,"top");Ct(this,"btm");Ct(this,"next");if(!(et>0)||et-1&et)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(et),this.mask=et-1,this.top=0,this.btm=0,this.next=null}push(et){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=et,this.top=this.top+1&this.mask,!0)}shift(){const et=this.buffer[this.btm];if(et!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,et}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(et={}){Ct(this,"size");Ct(this,"hwm");Ct(this,"head");Ct(this,"tail");this.hwm=et.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(et){return(et==null?void 0:et.byteLength)!=null?et.byteLength:1}push(et){if((et==null?void 0:et.value)!=null&&(this.size+=this.calculateSize(et.value)),!this.head.push(et)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(et)}}shift(){let et=this.tail.shift();if(et===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,et=this.tail.shift()}return(et==null?void 0:et.value)!=null&&(this.size-=this.calculateSize(et.value)),et}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,nt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.code=nt??"ABORT_ERR"}};function pushable(o={}){return _pushable(tt=>{const nt=tt.shift();if(nt==null)return{done:!0};if(nt.error!=null)throw nt.error;return{done:nt.done===!0,value:nt.value}},o)}function _pushable(o,et){et=et??{};let tt=et.onEnd,nt=new FIFO,rt,ot,it,st=pDefer();const at=async()=>{try{return nt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=xt=>{ot=null,nt.push(xt);try{yt(o(nt))}catch(vt){gt(vt)}return rt}}):o(nt)}finally{nt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(nt.push(yt),rt),lt=yt=>(nt=new FIFO,ot!=null?ot({error:yt}):(nt.push({error:yt}),rt)),dt=yt=>{if(it)return rt;if((et==null?void 0:et.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?rt:(it=!0,yt!=null?lt(yt):ct({done:!0})),ft=()=>(nt=new FIFO,ht(),{done:!0}),mt=yt=>(ht(yt),{done:!0});if(rt={[Symbol.asyncIterator](){return this},next:at,return:ft,throw:mt,push:dt,end:ht,get readableLength(){return nt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),nt.isEmpty())return;let xt,vt;gt!=null&&(xt=new Promise((bt,Et)=>{vt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",vt)}));try{await Promise.race([st.promise,xt])}finally{vt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",vt))}}},tt==null)return rt;const pt=rt;return rt={[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),rt},get readableLength(){return pt.readableLength},onEmpty:yt=>pt.onEmpty(yt)},rt}function isAsyncIterable$6(o){return o[Symbol.asyncIterator]!=null}function merge$2(...o){const et=[];for(const tt of o)isAsyncIterable$6(tt)||et.push(tt);return et.length===o.length?function*(){for(const tt of et)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(o.map(async nt=>{for await(const rt of nt)tt.push(rt)})),tt.end()}catch(nt){tt.end(nt)}}),yield*tt}()}function pipe(o,...et){if(o==null)throw new Error("Empty pipeline");if(isDuplex(o)){const nt=o;o=()=>nt.source}else if(isIterable(o)||isAsyncIterable$5(o)){const nt=o;o=()=>nt}const tt=[o,...et];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let nt=1;nt{let et;for(;o.length>0;)et=o.shift()(et);return et},isAsyncIterable$5=o=>(o==null?void 0:o[Symbol.asyncIterator])!=null,isIterable=o=>(o==null?void 0:o[Symbol.iterator])!=null,isDuplex=o=>o==null?!1:o.sink!=null&&o.source!=null,duplexPipelineFn=o=>et=>{const tt=o.sink(et);if((tt==null?void 0:tt.then)!=null){const nt=pushable({objectMode:!0});tt.then(()=>{nt.end()},it=>{nt.end(it)});let rt;const ot=o.source;if(isAsyncIterable$5(ot))rt=async function*(){yield*ot,nt.end()};else if(isIterable(ot))rt=function*(){yield*ot,nt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(nt,rt())}return o.source};async function sortPeersByLatency(o,et){return et.length===0?[]:(await Promise.all(et.map(async rt=>{try{const ot=(await o.get(rt.id)).metadata.get("ping");if(!ot)return{peer:rt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:rt,ping:it}}catch{return{peer:rt,ping:1/0}}}))).filter(rt=>rt!==null).sort((rt,ot)=>rt.ping-ot.ping).map(rt=>rt.peer)}async function getPeersForProtocol(o,et){const tt=[];return await o.forEach(nt=>{for(let rt=0;rtit.tags.has(Tags$2.BOOTSTRAP)).slice(0,tt);et>0&&et!it.tags.has(Tags$2.BOOTSTRAP));if(et===0)return[...nt,...rt];const ot=[...nt];for(;ot.length0;){const it=Math.floor(Math.random()*rt.length),st=rt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(o){return o.filter(et=>et.status==="open").sort((et,tt)=>tt.timeline.open-et.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(et,tt,nt){Ct(this,"multicodec");Ct(this,"getConnections");Ct(this,"addEventListener");Ct(this,"log");Ct(this,"ongoingCreation",new Set);Ct(this,"streamPool",new Map);Ct(this,"handlePeerUpdateStreamPool",et=>{const{peer:tt}=et.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=et,this.getConnections=tt,this.addEventListener=nt,this.log=new Logger$1(`stream-manager:${et}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(et){const tt=et.id.toString(),nt=this.streamPool.get(tt);nt&&(this.streamPool.delete(tt),await nt);let rt=this.getOpenStreamForCodec(et.id);return rt?(this.log.info(`Found existing stream peerId=${et.id.toString()} multicodec=${this.multicodec}`),this.lockStream(et.id.toString(),rt),rt):(rt=await this.createStream(et),this.lockStream(et.id.toString(),rt),rt)}async createStream(et,tt=0){const nt=this.getConnections(et.id),rt=selectOpenConnection(nt);if(!rt)throw new Error(`Failed to get a connection to the peer peerId=${et.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!rt||["done","closed","closing"].includes(rt.writeStatus||"")||this.isStreamLocked(rt)))return rt}lockStream(et,tt){this.log.info(`Locking stream for peerId:${et} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(et){return!!et.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(et,tt,nt,rt){Ct(this,"multicodec");Ct(this,"components");Ct(this,"log");Ct(this,"pubsubTopics");Ct(this,"addLibp2pEventListener");Ct(this,"removeLibp2pEventListener");Ct(this,"streamManager");this.multicodec=et,this.components=tt,this.log=nt,this.pubsubTopics=rt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(et,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(et){return this.streamManager.getStream(et)}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:et,maxBootstrapPeers:tt,peerIdStr:nt}={maxBootstrapPeers:0,numPeers:0}){if(nt){const st=(await this.connectedPeers()).find(at=>at.id.toString()===nt);return st?[st]:(this.log.warn(`Passed node to use for ${this.multicodec} not found: ${nt}. Attempting to use random peers.`),this.getPeers({numPeers:et,maxBootstrapPeers:tt}))}const rt=await this.connectedPeers(),ot=filterPeersByDiscovery(rt,et,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,nt,rt){const ot=await this.getStream(nt),it=FilterSubscribeRpc.createSubscribeRequest(tt,rt);let st;try{st=await pipe([it.encode()],encode$5,ot,decode$5,async dt=>await all$2(dt))}catch(dt){return log$n.error("Failed to send subscribe request",dt),{success:null,failure:{error:ProtocolError$3.GENERIC_FAIL,peerId:nt.id}}}const{statusCode:at,requestId:ct,statusDesc:lt}=FilterSubscribeResponse$1.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$3.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async unsubscribe(tt,nt,rt){let ot;try{ot=await this.getStream(nt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${nt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$3.NO_STREAM_AVAILABLE,peerId:nt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,rt);try{await pipe([it.encode()],encode$5,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$3.GENERIC_FAIL,peerId:nt.id}}}return{success:nt.id,failure:null}}async unsubscribeAll(tt,nt){const rt=await this.getStream(nt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$5,rt,decode$5,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$3.NO_RESPONSE,peerId:nt.id},success:null};const{statusCode:st,requestId:at,statusDesc:ct}=FilterSubscribeResponse$1.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$3.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async ping(tt){let nt;try{nt=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$3.NO_STREAM_AVAILABLE,peerId:tt.id}}}const rt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([rt.encode()],encode$5,nt,decode$5,async ct=>await all$2(ct))}catch(ct){return log$n.error("Failed to send ping request",ct),{success:null,failure:{error:ProtocolError$3.GENERIC_FAIL,peerId:tt.id}}}if(!ot||!ot.length)return{success:null,failure:{error:ProtocolError$3.NO_RESPONSE,peerId:tt.id}};const{statusCode:it,requestId:st,statusDesc:at}=FilterSubscribeResponse$1.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$3.REMOTE_PEER_REJECTED,peerId:tt.id}}):{success:tt.id,failure:null}}onRequest(tt){const{connection:nt,stream:rt}=tt,{remotePeer:ot}=nt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(rt,decode$5,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,nt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${nt.remotePeer.toString()} -- stream:${rt.id} -- protocol:${rt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}let PushRpc$1=class Ms{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et,tt){return new Ms({requestId:v4$2(),request:{message:et,pubsubTopic:tt},response:void 0})}static decode(et){const tt=PushRpc$2.decode(et);return new Ms(tt)}encode(){return PushRpc$2.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=o=>o?o.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=o=>{const et={[ProtocolError$3.RLN_IDENTITY_MISSING]:ProtocolError$3.RLN_IDENTITY_MISSING,[ProtocolError$3.RLN_MEMBERSHIP_INDEX]:ProtocolError$3.RLN_MEMBERSHIP_INDEX,[ProtocolError$3.RLN_LIMIT_MISSING]:ProtocolError$3.RLN_LIMIT_MISSING},tt=o.toLowerCase();for(const nt in et)if(tt.includes(nt.toLowerCase()))return et[nt];return ProtocolError$3.RLN_PROOF_GENERATION},log$m=new Logger$1("light-push"),LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";class LightPushCore extends BaseProtocol{constructor(tt,nt){super(LightPushCodec,nt.components,log$m,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,nt){try{if(!nt.payload||nt.payload.length===0)return log$m.error("Failed to send waku light push: payload is empty"),{query:null,error:ProtocolError$3.EMPTY_PAYLOAD};if(!await isMessageSizeUnderCap(tt,nt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$3.SIZE_TOO_BIG};const rt=await tt.toProtoObj(nt);return rt?{query:PushRpc$1.createRequest(rt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$3.ENCODE_FAILED})}catch(rt){return log$m.error("Failed to prepare push message",rt),{query:null,error:ProtocolError$3.GENERIC_FAIL}}}async send(tt,nt,rt){const{query:ot,error:it}=await this.preparePushMessage(tt,nt);if(it||!ot)return{success:null,failure:{error:it,peerId:rt.id}};let st;try{st=await this.getStream(rt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$3.NO_STREAM_AVAILABLE,peerId:rt.id}}}let at;try{at=await pipe([ot.encode()],encode$5,st,decode$5,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$3.GENERIC_FAIL,peerId:rt.id}}}const ct=new Uint8ArrayList;at.forEach(dt=>{ct.append(dt)});let lt;try{lt=PushRpc$1.decode(ct).response}catch(dt){return log$m.error("Failed to decode push reply",dt),{success:null,failure:{error:ProtocolError$3.DECODE_FAILED,peerId:rt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$3.NO_RESPONSE,peerId:rt.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:rt.id}}}return lt.isSuccess?{success:rt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$3.REMOTE_PEER_REJECTED,peerId:rt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(o){return{...EmptyMessage,...o}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;let StoreQueryRequest$1=class js{constructor(et){Ct(this,"proto");this.proto=et}static create(et){const tt=new js({...et,requestId:v4$2(),timeStart:et.timeStart?BigInt(et.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:et.timeEnd?BigInt(et.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:et.messageHashes||[],paginationLimit:et.paginationLimit?BigInt(et.paginationLimit):void 0});if(et.pubsubTopic&&!et.contentTopics||!et.pubsubTopic&&et.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(et.messageHashes&&(et.pubsubTopic||et.contentTopics||et.timeStart||et.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(et){const tt=StoreQueryRequest$2.decode(et);return new js(tt)}encode(){return StoreQueryRequest$2.encode(this.proto)}},StoreQueryResponse$1=class eu{constructor(et){Ct(this,"proto");this.proto=et}static decode(et){const tt=StoreQueryResponse$2.decode(et);return new eu(tt)}encode(){return StoreQueryResponse$2.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,nt){super(StoreCodec,nt.components,log$l,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,nt,rt){if(tt.contentTopics.toString()!==Array.from(nt.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let ot=tt.paginationCursor;for(;;){const it=StoreQueryRequest$1.create({...tt,paginationCursor:ot});let st;try{st=await this.getStream(rt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$5,st,decode$5,async ht=>await all$2(ht)),ct=new Uint8ArrayList;at.forEach(ht=>{ct.append(ht)});const lt=StoreQueryResponse$1.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 ft=ht.message.contentTopic;if(ft){const mt=nt.get(ft);if(mt)return mt.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(o){return!!(o!=null&&o[peerIdSymbol$3])}var ss;let AbortError$9=(ss=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(ss,"name","AbortError"),ss);class UnexpectedPeerError extends Error{constructor(et="Unexpected Peer"){super(et),this.name="UnexpectedPeerError"}}Ct(UnexpectedPeerError,"name","UnexpectedPeerError");var as;let InvalidMessageError$3=(as=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(as,"name","InvalidMessageError"),as);var cs;let ProtocolError$2=(cs=class extends Error{constructor(et="Protocol error"){super(et),this.name="ProtocolError"}},Ct(cs,"name","ProtocolError"),cs);var ls;let TimeoutError$3=(ls=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(ls,"name","TimeoutError"),ls);function setMaxListeners$9(){}const setMaxListeners$8=(o,...et)=>{try{[...et]}catch{}};var Qn,na;let TypedEventEmitter$3=(na=class extends EventTarget{constructor(){super();pn(this,Qn,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const nt=jt(this,Qn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=jt(this,Qn).get(tt);ot==null&&(ot=[],jt(this,Qn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=jt(this,Qn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),jt(this,Qn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=jt(this,Qn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),jt(this,Qn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Qn=new WeakMap,na);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:et,relay:tt,libp2p:nt}){Ct(this,"relay");Ct(this,"libp2p");Ct(this,"options");Ct(this,"pingKeepAliveTimers",new Map);Ct(this,"relayKeepAliveTimers",new Map);this.options=et,this.relay=tt,this.libp2p=nt}start(et){this.stop(et);const{pingKeepAlive:tt,relayKeepAlive:nt}=this.options,rt=et.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(et),log$k.info(`Ping succeeded (${rt})`,st)}catch{log$k.error(`Ping failed for peer (${rt}). Next ping will be attempted in ${tt} seconds. - `);return}try{await this.libp2p.peerStore.merge(et,{metadata:{ping:utf8ToBytes$1(st.toString())}})}catch(at){log$k.error("Failed to update ping",at)}}catch(at){log$k.error(`Ping failed (${rt})`,at)}})()},tt*1e3);this.pingKeepAliveTimers.set(rt,it)}const ot=this.relay;if(ot&&nt!==0){const it=this.scheduleRelayPings(ot,nt,et.toString());this.relayKeepAliveTimers.set(et,it)}}stop(et){var nt;const tt=et.toString();this.pingKeepAliveTimers.has(tt)&&(clearInterval(this.pingKeepAliveTimers.get(tt)),this.pingKeepAliveTimers.delete(tt)),this.relayKeepAliveTimers.has(et)&&((nt=this.relayKeepAliveTimers.get(et))==null||nt.map(clearInterval),this.relayKeepAliveTimers.delete(et))}stopAll(){for(const et of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(et);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}connectionsExist(){return this.pingKeepAliveTimers.size>0||this.relayKeepAliveTimers.size>0}scheduleRelayPings(et,tt,nt){const rt=[];for(const ot of et.pubsubTopics){if(!et.getMeshPeers(ot).includes(nt))continue;const st=createEncoder({pubsubTopicShardInfo:pubsubTopicToSingleShardInfo(ot),contentTopic:RelayPingContentTopic,ephemeral:!0}),at=setInterval(()=>{log$k.info("Sending Waku Relay ping message"),et.send(st,{payload:new Uint8Array([1])}).catch(ct=>log$k.error("Failed to send relay ping",ct))},tt*1e3);rt.push(at)}return rt}}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,Pr=class Pr extends TypedEventEmitter$3{constructor(tt,nt,rt,ot,it){super();Ct(this,"configuredPubsubTopics");Ct(this,"keepAliveManager");Ct(this,"options");Ct(this,"libp2p");Ct(this,"dialAttemptsForPeer",new Map);Ct(this,"dialErrorsForPeer",new Map);Ct(this,"currentActiveParallelDialCount",0);Ct(this,"pendingPeerDialQueue",[]);Ct(this,"isP2PNetworkConnected",!1);Ct(this,"onEventHandlers",{"peer:discovery":tt=>{(async()=>{const{id:nt}=tt.detail;await this.dispatchDiscoveryEvent(nt);try{await this.attemptDial(nt)}catch(rt){log$j.error(`Error dialing peer ${nt.toString()} : ${rt}`)}})()},"peer:connect":tt=>{(async()=>{log$j.info(`Connected to peer ${tt.detail.toString()}`);const nt=tt.detail;this.keepAliveManager.start(nt),(await this.getTagNamesForPeer(nt)).includes(Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.includes(Tags.BOOTSTRAP)).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(nt):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_BOOTSTRAP,{detail:nt})):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_PEER_EXCHANGE,{detail:nt})),this.setP2PNetworkConnected()})()},"peer:disconnect":tt=>{(async()=>(this.keepAliveManager.stop(tt.detail),this.setP2PNetworkDisconnected()))()},"browser:network":()=>{this.dispatchWakuConnectionEvent()}});this.configuredPubsubTopics=rt,this.libp2p=tt,this.configuredPubsubTopics=rt,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:nt}),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,nt,rt,ot,it,st){let at=Pr.instances.get(tt);return at||(at=new Pr(nt,rt,ot,it,st),Pr.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(nt){log$j.error(`Error dropping connection with peer ${tt.toString()} - ${nt}`)}}async getPeersByDiscovery(){const tt=await this.libp2p.peerStore.all(),nt=this.libp2p.getConnections().map(lt=>lt.remotePeer),rt=[],ot=[],it=[],st=[],at=[],ct=[];for(const lt of tt){const dt=await this.getTagNamesForPeer(lt.id);dt.includes(Tags.BOOTSTRAP)?rt.push(lt):dt.includes(Tags.PEER_EXCHANGE)?ot.push(lt):dt.includes(Tags.LOCAL)&&it.push(lt)}for(const lt of nt){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]:rt,[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(),nt=[];for(const rt of tt)this.libp2p.getConnections().find(ot=>ot.remotePeer===rt.id)||nt.push(this.attemptDial(rt.id));try{await Promise.all(nt)}catch(rt){log$j.error("Unexpected error while dialing peer store peers",rt)}}async startEventListeners(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener(),this.startNetworkStatusListener()}async dialPeer(tt){this.currentActiveParallelDialCount+=1;let nt=0;for(;nt{ot.tags=Array.from(new Set([...ot.tags,...rt]))}),this.dialAttemptsForPeer.set(tt.toString(),-1),this.keepAliveManager.start(tt);break}catch(rt){rt instanceof AggregateError?log$j.error(`Error dialing peer ${tt.toString()} - ${rt.errors}`):log$j.error(`Error dialing peer ${tt.toString()} - ${rt.message}`),this.dialErrorsForPeer.set(tt.toString(),rt),nt++,this.dialAttemptsForPeer.set(tt.toString(),nt)}if(this.currentActiveParallelDialCount--,this.processDialQueue(),nt===this.options.maxDialAttemptsForPeer)try{const rt=this.dialErrorsForPeer.get(tt.toString());if(rt){let ot;rt instanceof AggregateError?rt.errors?rt.errors.length===0?log$j.warn("Errors array is empty for AggregateError"):ot=JSON.stringify(rt.errors[0]):log$j.warn("No errors array found for AggregateError"):ot=rt.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(rt){throw new Error(`Error deleting undialable peer ${tt.toString()} from peer store - ${rt}`)}}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(nt=>nt&&nt.toString?nt.toString().includes(DNS_DISCOVERY_TAG):!1);tt&&await tt.findPeers()}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveParallelDialCount{log$j.error(nt)})}}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,nt){const ot=(await nt.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()}))}};Ct(Pr,"instances",new Map);let ConnectionManager=Pr;const wr=class wr{constructor(){Ct(this,"health");this.health={overallStatus:HealthStatus.Unhealthy,protocolStatuses:new Map}}static getInstance(){return wr.instance||(wr.instance=new wr),wr.instance}getHealthStatus(){return this.health.overallStatus}getProtocolStatus(et){return this.health.protocolStatuses.get(et)}updateProtocolHealth(et,tt){const nt=this.getNameFromMulticodec(et);let rt=HealthStatus.Unhealthy;tt==1?rt=HealthStatus.MinimallyHealthy:tt>=2&&(rt=HealthStatus.SufficientlyHealthy),this.health.protocolStatuses.set(nt,{name:nt,status:rt,lastUpdate:new Date}),this.updateOverallHealth()}getNameFromMulticodec(et){let tt;if(et.includes("filter"))tt=Protocols.Filter;else if(et.includes("lightpush"))tt=Protocols.LightPush;else if(et.includes("store"))tt=Protocols.Store;else throw new Error(`Unknown protocol: ${et}`);return tt}updateOverallHealth(){const tt=[Protocols.LightPush,Protocols.Filter].map(nt=>{var rt;return(rt=this.getProtocolStatus(nt))==null?void 0:rt.status});tt.some(nt=>nt===HealthStatus.Unhealthy)?this.health.overallStatus=HealthStatus.Unhealthy:tt.some(nt=>nt===HealthStatus.MinimallyHealthy)?this.health.overallStatus=HealthStatus.MinimallyHealthy:this.health.overallStatus=HealthStatus.SufficientlyHealthy}};Ct(wr,"instance");let HealthManager=wr;const getHealthManager=()=>HealthManager.getInstance(),log$i=new Logger$1("metadata"),MetadataCodec="/vac/waku/metadata/1.0.0";class Metadata extends BaseProtocol{constructor(tt,nt){super(MetadataCodec,nt.components,log$i,tt);Ct(this,"pubsubTopics");Ct(this,"libp2pComponents");Ct(this,"handshakesConfirmed",new Map);this.pubsubTopics=tt,this.libp2pComponents=nt,nt.registrar.handle(MetadataCodec,rt=>{this.onRequest(rt)})}async query(tt){const nt=WakuMetadataRequest.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),rt=await this.libp2pComponents.peerStore.get(tt);if(!rt)return{shardInfo:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let ot;try{ot=await this.getStream(rt)}catch(ct){return log$i.error("Failed to get stream",ct),{shardInfo:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const it=await pipe([nt],encode$5,ot,decode$5,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 nt=this.handshakesConfirmed.get(tt.toString());return nt?{shardInfo:nt,error:null}:await this.query(tt)}async onRequest(tt){try{const{stream:nt,connection:rt}=tt,ot=WakuMetadataResponse.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),it=await pipe([ot],encode$5,nt,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);if(st)return;await this.savePeerShardInfo(rt.remotePeer,at)}catch(nt){log$i.error("Error handling metadata request",nt)}}decodeMetadataResponse(tt){const nt=new Uint8ArrayList;tt.forEach(ot=>{nt.append(ot)});const rt=WakuMetadataResponse.decode(nt);return rt?{shardInfo:rt,error:null}:(log$i.error("Error decoding metadata response"),{shardInfo:null,error:ProtocolError$1.DECODE_FAILED})}async savePeerShardInfo(tt,nt){await this.libp2pComponents.peerStore.merge(tt,{metadata:{shardInfo:encodeRelayShard(nt)}}),this.handshakesConfirmed.set(tt.toString(),nt)}}function wakuMetadata(o){return et=>new Metadata(o,et)}class Parser{constructor(){Ct(this,"index",0);Ct(this,"input","")}new(et){return this.index=0,this.input=et,this}readAtomically(et){const tt=this.index,nt=et();return nt===void 0&&(this.index=tt),nt}parseWith(et){const tt=et();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(et){return this.readAtomically(()=>{const tt=this.readChar();if(tt===et)return tt})}readSeparator(et,tt,nt){return this.readAtomically(()=>{if(!(tt>0&&this.readGivenChar(et)===void 0))return nt()})}readNumber(et,tt,nt,rt){return this.readAtomically(()=>{let ot=0,it=0;const st=this.peekChar();if(st===void 0)return;const at=st==="0",ct=2**(8*rt)-1;for(;;){const lt=this.readAtomically(()=>{const dt=this.readChar();if(dt===void 0)return;const ht=Number.parseInt(dt,et);if(!Number.isNaN(ht))return ht});if(lt===void 0)break;if(ot*=et,ot+=lt,ot>ct||(it+=1,tt!==void 0&&it>tt))return}if(it!==0)return!nt&&at&&it>1?void 0:ot})}readIPv4Addr(){return this.readAtomically(()=>{const et=new Uint8Array(4);for(let tt=0;ttthis.readNumber(10,3,!1,1));if(nt===void 0)return;et[tt]=nt}return et})}readIPv6Addr(){const et=tt=>{for(let nt=0;ntthis.readIPv4Addr());if(it!==void 0)return tt[rt]=it[0],tt[rt+1]=it[1],tt[rt+2]=it[2],tt[rt+3]=it[3],[rt+4,!0]}const ot=this.readSeparator(":",nt,()=>this.readNumber(16,4,!0,2));if(ot===void 0)return[rt,!1];tt[rt]=ot>>8,tt[rt+1]=ot&255}return[tt.length,!1]};return this.readAtomically(()=>{const tt=new Uint8Array(16),[nt,rt]=et(tt);if(nt===16)return tt;if(rt||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const ot=new Uint8Array(14),it=16-(nt+2),[st]=et(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(o){if(!(o.length>MAX_IPV4_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv6Addr())}function parseIP(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPAddr())}function isIPv4(o){return!!parseIPv4(o)}function isIPv6(o){return!!parseIPv6(o)}function isIP(o){return!!parseIP(o)}const isV4=isIPv4,isV6=isIPv6,toBytes$1=function(o){let et=0;if(o=o.toString().trim(),isV4(o)){const tt=new Uint8Array(et+4);return o.split(/\./g).forEach(nt=>{tt[et++]=parseInt(nt,10)&255}),tt}if(isV6(o)){const tt=o.split(":",8);let nt;for(nt=0;nt0;nt--)ot.push("0");tt.splice.apply(tt,ot)}const rt=new Uint8Array(et+16);for(nt=0;nt>8&255,rt[et++]=ot&255}return rt}throw new Error("invalid ip address")},toString$7=function(o,et=0,tt){et=~~et,tt=tt??o.length-et;const nt=new DataView(o.buffer);if(tt===4){const rt=[];for(let ot=0;ot{const et=createProtocol(...o);codes[et.code]=et,names[et.name]=et});function createProtocol(o,et,tt,nt,rt){return{code:o,size:et,name:tt,resolvable:!!nt,path:!!rt}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(o,et){switch(getProtocol(o).code){case 4:case 41:return bytes2ip(et);case 42:return bytes2str(et);case 6:case 273:case 33:case 132:return bytes2port(et).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(et);case 421:return bytes2mh(et);case 444:return bytes2onion(et);case 445:return bytes2onion(et);case 466:return bytes2mb(et);case 481:return globalThis.encodeURIComponent(bytes2str(et));default:return toString$8(et,"base16")}}function convertToBytes(o,et){switch(getProtocol(o).code){case 4:return ip2bytes(et);case 41:return ip2bytes(et);case 42:return str2bytes(et);case 6:case 273:case 33:case 132:return port2bytes(parseInt(et,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(et);case 421:return mh2bytes(et);case 444:return onion2bytes(et);case 445:return onion32bytes(et);case 466:return mb2bytes(et);case 481:return str2bytes(globalThis.decodeURIComponent(et));default:return fromString(et,"base16")}}const decoders=Object.values(bases).map(o=>o.decoder),anybaseDecoder=function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(et=>o=o.or(et)),o}();function ip2bytes(o){if(!isIP(o))throw new Error("invalid ip address");return toBytes$1(o)}function bytes2ip(o){const et=toString$7(o,0,o.length);if(et==null)throw new Error("ipBuff is required");if(!isIP(et))throw new Error("invalid ip address");return et}function port2bytes(o){const et=new ArrayBuffer(2);return new DataView(et).setUint16(0,o),new Uint8Array(et)}function bytes2port(o){return new DataView(o.buffer).getUint16(o.byteOffset)}function str2bytes(o){const et=fromString(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2str(o){const et=decode$b(o);if(o=o.slice(encodingLength$3(et)),o.length!==et)throw new Error("inconsistent lengths");return toString$8(o)}function mh2bytes(o){let et;o[0]==="Q"||o[0]==="1"?et=decode$6(base58btc.decode(`z${o}`)).bytes:et=CID.parse(o).multihash.bytes;const tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function mb2bytes(o){const et=anybaseDecoder.decode(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2mb(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return"u"+toString$8(tt,"base64url")}function bytes2mh(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return toString$8(tt,"base58btc")}function onion2bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==16)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion address.`);const tt=base32$2.decode("b"+et[0]),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function onion32bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==56)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion3 address.`);const tt=base32$2.decode(`b${et[0]}`),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function bytes2onion(o){const et=o.slice(0,o.length-2),tt=o.slice(o.length-2),nt=toString$8(et,"base32"),rt=bytes2port(tt);return`${nt}:${rt}`}function stringToMultiaddrParts(o){o=cleanPath(o);const et=[],tt=[];let nt=null;const rt=o.split("/").slice(1);if(rt.length===1&&rt[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let ot=0;ot=rt.length)throw ParseError("invalid address: "+o);if(st.path===!0){nt=cleanPath(rt.slice(ot).join("/")),et.push([st.code,convertToBytes(st.code,nt)]),tt.push([st.code,nt]);break}const at=convertToBytes(st.code,rt[ot]);et.push([st.code,at]),tt.push([st.code,convertToString(st.code,at)])}return{string:stringTuplesToString(tt),bytes:tuplesToBytes(et),tuples:et,stringTuples:tt,path:nt}}function bytesToMultiaddrParts(o){const et=[],tt=[];let nt=null,rt=0;for(;rto.length)throw ParseError("Invalid address Uint8Array: "+toString$8(o,"base16"));et.push([ot,ct]);const lt=convertToString(ot,ct);if(tt.push([ot,lt]),st.path===!0){nt=lt;break}}return{bytes:Uint8Array.from(o),string:stringTuplesToString(tt),tuples:et,stringTuples:tt,path:nt}}function stringTuplesToString(o){const et=[];return o.map(tt=>{const nt=getProtocol(tt[0]);return et.push(nt.name),tt.length>1&&tt[1]!=null&&et.push(tt[1]),null}),cleanPath(et.join("/"))}function tuplesToBytes(o){return concat$1(o.map(et=>{const tt=getProtocol(et[0]);let nt=Uint8Array.from(encode$a(tt.code));return et.length>1&&et[1]!=null&&(nt=concat$1([nt,et[1]])),nt}))}function sizeForAddr(o,et){if(o.size>0)return o.size/8;if(o.size===0)return 0;{const tt=decode$b(et instanceof Uint8Array?et:Uint8Array.from(et));return tt+encodingLength$3(tt)}}function cleanPath(o){return"/"+o.trim().split("/").filter(et=>et).join("/")}function ParseError(o){return new Error("Error parsing address: "+o)}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(et="No available resolver"){super(et),this.name="NoAvailableResolverError"}}var Xs,Kr,xr,so,ao;const Lr=class Lr{constructor(et){Ct(this,"bytes");fn(this,Kr);fn(this,xr);fn(this,so);fn(this,ao);Ct(this,Xs,!0);et==null&&(et="");let tt;if(et instanceof Uint8Array)tt=bytesToMultiaddrParts(et);else if(typeof et=="string"){if(et.length>0&&et.charAt(0)!=="/")throw new Error(`multiaddr "${et}" must start with a "/"`);tt=stringToMultiaddrParts(et)}else if(isMultiaddr(et))tt=bytesToMultiaddrParts(et.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=tt.bytes,un(this,Kr,tt.string),un(this,xr,tt.tuples),un(this,so,tt.stringTuples),un(this,ao,tt.path)}toString(){return Mt(this,Kr)}toJSON(){return this.toString()}toOptions(){let et,tt,nt,rt,ot="";const it=getProtocol("tcp"),st=getProtocol("udp"),at=getProtocol("ip4"),ct=getProtocol("ip6"),lt=getProtocol("dns6"),dt=getProtocol("ip6zone");for(const[pt,mt]of this.stringTuples())pt===dt.code&&(ot=`%${mt??""}`),DNS_CODES.includes(pt)&&(tt=it.name,rt=443,nt=`${mt??""}${ot}`,et=pt===lt.code?6:4),(pt===it.code||pt===st.code)&&(tt=getProtocol(pt).name,rt=parseInt(mt??"")),(pt===at.code||pt===ct.code)&&(tt=getProtocol(pt).name,nt=`${mt??""}${ot}`,et=pt===ct.code?6:4);if(et==null||tt==null||nt==null||rt==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:et,host:nt,transport:tt,port:rt}}protos(){return Mt(this,xr).map(([et])=>Object.assign({},getProtocol(et)))}protoCodes(){return Mt(this,xr).map(([et])=>et)}protoNames(){return Mt(this,xr).map(([et])=>getProtocol(et).name)}tuples(){return Mt(this,xr)}stringTuples(){return Mt(this,so)}encapsulate(et){return et=new Lr(et),new Lr(this.toString()+et.toString())}decapsulate(et){const tt=et.toString(),nt=this.toString(),rt=nt.lastIndexOf(tt);if(rt<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${et.toString()}`);return new Lr(nt.slice(0,rt))}decapsulateCode(et){const tt=this.tuples();for(let nt=tt.length-1;nt>=0;nt--)if(tt[nt][0]===et)return new Lr(tuplesToBytes(tt.slice(0,nt)));return this}getPeerId(){try{let et=[];this.stringTuples().forEach(([nt,rt])=>{nt===names.p2p.code&&et.push([nt,rt]),nt===names["p2p-circuit"].code&&(et=[])});const tt=et.pop();if((tt==null?void 0:tt[1])!=null){const nt=tt[1];return nt[0]==="Q"||nt[0]==="1"?toString$8(base58btc.decode(`z${nt}`),"base58btc"):toString$8(CID.parse(nt).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return Mt(this,ao)}equals(et){return equals(this.bytes,et.bytes)}async resolve(et){const tt=this.protos().find(ot=>ot.resolvable);if(tt==null)return[this];const nt=resolvers$1.get(tt.name);if(nt==null)throw new NoAvailableResolverError(`no available resolver for ${tt.name}`);return(await nt(this,et)).map(ot=>multiaddr(ot))}nodeAddress(){const et=this.toOptions();if(et.transport!=="tcp"&&et.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${et.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:et.family,address:et.host,port:et.port}}isThinWaistAddress(et){const tt=(et??this).protos();return!(tt.length!==2||tt[0].code!==4&&tt[0].code!==41||tt[1].code!==6&&tt[1].code!==273)}[(Xs=symbol,inspect$1)](){return`Multiaddr(${Mt(this,Kr)})`}};Kr=new WeakMap,xr=new WeakMap,so=new WeakMap,ao=new WeakMap;let Multiaddr=Lr;const resolvers$1=new Map;function isMultiaddr(o){return!!(o!=null&&o[symbol])}function multiaddr(o){return new Multiaddr(o)}const E_CANCELED=new Error("request for lock canceled");var __awaiter$2=function(o,et,tt,nt){function rt(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(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Semaphore{constructor(et,tt=E_CANCELED){this._value=et,this._cancelError=tt,this._queue=[],this._weightedWaiters=[]}acquire(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return new Promise((nt,rt)=>{const ot={resolve:nt,reject:rt,weight:et,priority:tt},it=findIndexFromEnd(this._queue,st=>tt<=st.priority);it===-1&&et<=this._value?this._dispatchItem(ot):this._queue.splice(it+1,0,ot)})}runExclusive(et){return __awaiter$2(this,arguments,void 0,function*(tt,nt=1,rt=0){const[ot,it]=yield this.acquire(nt,rt);try{return yield tt(ot)}finally{it()}})}waitForUnlock(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return this._couldLockImmediately(et,tt)?Promise.resolve():new Promise(nt=>{this._weightedWaiters[et-1]||(this._weightedWaiters[et-1]=[]),insertSorted(this._weightedWaiters[et-1],{resolve:nt,priority:tt})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(et){this._value=et,this._dispatchQueue()}release(et=1){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);this._value+=et,this._dispatchQueue()}cancel(){this._queue.forEach(et=>et.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(et){const tt=this._value;this._value-=et.weight,et.resolve([tt,this._newReleaser(et.weight)])}_newReleaser(et){let tt=!1;return()=>{tt||(tt=!0,this.release(et))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let et=this._value;et>0;et--){const tt=this._weightedWaiters[et-1];tt&&(tt.forEach(nt=>nt.resolve()),this._weightedWaiters[et-1]=[])}else{const et=this._queue[0].priority;for(let tt=this._value;tt>0;tt--){const nt=this._weightedWaiters[tt-1];if(!nt)continue;const rt=nt.findIndex(ot=>ot.priority<=et);(rt===-1?nt:nt.splice(0,rt)).forEach(ot=>ot.resolve())}}}_couldLockImmediately(et,tt){return(this._queue.length===0||this._queue[0].priorityet.priority<=nt.priority);o.splice(tt+1,0,et)}function findIndexFromEnd(o,et){for(let tt=o.length-1;tt>=0;tt--)if(et(o[tt]))return tt;return-1}var __awaiter$1=function(o,et,tt,nt){function rt(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(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Mutex{constructor(et){this._semaphore=new Semaphore(1,et)}acquire(){return __awaiter$1(this,arguments,void 0,function*(et=0){const[,tt]=yield this._semaphore.acquire(1,et);return tt})}runExclusive(et,tt=0){return this._semaphore.runExclusive(()=>et(),1,tt)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(et=0){return this._semaphore.waitForUnlock(1,et)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class PeerManager{constructor(et,tt,nt){Ct(this,"connectionManager");Ct(this,"core");Ct(this,"log");Ct(this,"peers",new Map);Ct(this,"healthManager");Ct(this,"readMutex",new Mutex);Ct(this,"writeMutex",new Mutex);Ct(this,"writeLockHolder",null);this.connectionManager=et,this.core=tt,this.log=nt,this.healthManager=getHealthManager(),this.healthManager.updateProtocolHealth(this.core.multicodec,0)}getWriteLockHolder(){return this.writeLockHolder}getPeers(){return Array.from(this.peers.values())}async addPeer(et){return this.writeMutex.runExclusive(async()=>{this.writeLockHolder=`addPeer: ${et.id.toString()}`,await this.connectionManager.attemptDial(et.id),this.peers.set(et.id.toString(),et),this.log.info(`Added and dialed peer: ${et.id.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async removePeer(et){return this.writeMutex.runExclusive(()=>{this.writeLockHolder=`removePeer: ${et.toString()}`,this.peers.delete(et.toString()),this.log.info(`Removed peer: ${et.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(et){this.log.info(`Removing ${et} excess peer(s)`);const tt=Array.from(this.peers.values()).slice(0,et);for(const nt of tt)await this.removePeer(nt.id)}async findAndAddPeers(et){const tt=await this.findPeers(et);return tt.length===0?(this.log.warn("No additional peers found"),[]):this.addMultiplePeers(tt)}async findPeers(et){const tt=await this.core.getPeers();return this.readMutex.runExclusive(async()=>tt.filter(rt=>!this.peers.has(rt.id.toString())).slice(0,et))}async addMultiplePeers(et){const tt=[];for(const nt of et)await this.addPeer(nt),tt.push(nt);return tt}}const DEFAULT_NUM_PEERS_TO_USE=2,DEFAULT_MAINTAIN_PEERS_INTERVAL=3e4;class BaseProtocolSDK{constructor(et,tt,nt){Ct(this,"core");Ct(this,"connectionManager");Ct(this,"peerManager");Ct(this,"numPeersToUse");Ct(this,"maintainPeersIntervalId",null);Ct(this,"log");this.core=et,this.connectionManager=tt,this.log=new Logger$1(`sdk:${et.multicodec}`),this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE;const rt=(nt==null?void 0:nt.maintainPeersInterval)??DEFAULT_MAINTAIN_PEERS_INTERVAL;this.peerManager=new PeerManager(tt,et,this.log),this.log.info(`Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${rt}ms`),this.startMaintainPeersInterval(rt)}get connectedPeers(){return this.peerManager.getPeers().slice(0,this.numPeersToUse)}async renewPeer(et){this.log.info(`Attempting to renew peer ${et}`);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(et),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(et={}){const{forceUseAllPeers:tt=!1,maxAttempts:nt=3}=et;this.log.info(`Checking for peers. forceUseAllPeers: ${tt}, maxAttempts: ${nt}`);for(let rt=0;rt0)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 ${nt} attempts`),!1}async startMaintainPeersInterval(et){this.log.info(`Starting maintain peers interval with ${et}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)})},et),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 et=await this.peerManager.getPeerCount(),tt=this.numPeersToUse-et;if(this.log.info(`Current peer count: ${et}, 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 nt=await this.peerManager.getPeerCount();this.log.info(`Peer maintenance completed. Initial count: ${et}, Final count: ${nt}`)}catch(et){this.log.error("Error during peer maintenance",{error:et})}}}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(o,et){const tt=utf8ToBytes$1(o),nt=utf8ToBytes$1(et.contentTopic),rt=tryConvertTimestampToBytes(et.timestamp),ot=concat$2([tt,et.payload,nt,et.meta,rt].filter(isDefined));return sha256$2(ot)}function tryConvertTimestampToBytes(o){if(!o)return;let et;return typeof o=="bigint"?et=o:et=BigInt(o.valueOf())*1000000n,numberToBytes(et)}function messageHashStr(o,et){const tt=messageHash(o,et);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(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"getContentTopics");Ct(this,"protocolSubscribe");Ct(this,"addLibp2pEventListener");Ct(this,"sendLightPushMessage");Ct(this,"receivedMessagesFormPeer",new Set);Ct(this,"receivedMessages",new Set);Ct(this,"scheduledVerification",new Map);Ct(this,"verifiedPeers",new Set);Ct(this,"peerFailures",new Map);Ct(this,"maxPingFailures",DEFAULT_MAX_PINGS);Ct(this,"peerRenewalLocks",new Set);this.pubsubTopic=et,this.getPeers=tt,this.renewPeer=nt,this.getContentTopics=rt,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(et){et!==void 0&&(this.maxPingFailures=et)}async handlePingResult(et,tt){if(tt!=null&&tt.success){this.peerFailures.delete(et.toString());return}const nt=(this.peerFailures.get(et.toString())||0)+1;if(this.peerFailures.set(et.toString(),nt),nt>=this.maxPingFailures)try{log$h.info(`Attempting to renew ${et.toString()} due to ping failures.`),await this.renewAndSubscribePeer(et),this.peerFailures.delete(et.toString())}catch(rt){log$h.error(`Failed to renew peer ${et.toString()}: ${rt}.`)}}notifyMessageReceived(et,tt){const nt=this.buildMessageHash(tt);return this.verifiedPeers.add(et),this.receivedMessagesFormPeer.add(`${et}-${nt}`),log$h.info(`notifyMessage received debug: ephemeral:${tt.ephemeral} ${bytesToUtf8(tt.payload)}`),log$h.info(`notifyMessage received: peer:${et} message:${nt}`),this.receivedMessages.has(nt)?!0:(this.receivedMessages.add(nt),!1)}notifyMessageSent(et,tt){const nt=et.toString(),rt=this.buildMessageHash(tt);if(log$h.info(`notifyMessage sent debug: ${bytesToUtf8(tt.payload)}`),this.scheduledVerification.has(nt)){log$h.warn(`notifyMessage sent: attempting to schedule verification for pending peer:${nt} message:${rt}`);return}const ot=setTimeout(async()=>{const it=this.verifiedPeers.has(nt),st=this.receivedMessagesFormPeer.has(`${nt}-${rt}`);if(it||st){log$h.info(`notifyMessage sent setTimeout: verified that peer pushes filter messages, peer:${nt} message:${rt}`);return}log$h.warn(`notifyMessage sent setTimeout: peer didn't return probe message, attempting renewAndSubscribe, peer:${nt} message:${rt}`),this.scheduledVerification.delete(nt),await this.renewAndSubscribePeer(et)},MESSAGE_VERIFICATION_DELAY);this.scheduledVerification.set(nt,ot)}shouldVerifyPeer(et){const tt=et.toString(),nt=this.verifiedPeers.has(tt),rt=this.scheduledVerification.has(tt);return!(nt||rt)}buildMessageHash(et){return messageHashStr(this.pubsubTopic,et)}async renewAndSubscribePeer(et){const tt=et.toString();try{if(this.peerRenewalLocks.has(tt)){log$h.info(`Peer ${tt} is already being renewed.`);return}this.peerRenewalLocks.add(tt);const nt=await this.renewPeer(et);if(!nt){log$h.warn(`Failed to renew peer ${tt}: No new peer found.`);return}return await this.protocolSubscribe(this.pubsubTopic,nt,this.getContentTopics()),await this.sendLightPushMessage(nt),this.peerFailures.delete(tt),nt}catch(nt){log$h.error(`Failed to renew peer ${tt}: ${nt}.`);return}finally{this.peerRenewalLocks.delete(tt)}}}const Nr=class Nr{static createReceiverMonitor(et,tt,nt,rt,ot,it,st){if(Nr.receiverMonitors.has(et))return Nr.receiverMonitors.get(et);const at=new ReceiverReliabilityMonitor(et,tt,nt,rt,ot,it,st);return Nr.receiverMonitors.set(et,at),at}constructor(){}static stop(et){this.receiverMonitors.delete(et)}static stopAll(){for(const[et,tt]of this.receiverMonitors)tt.setMaxPingFailures(void 0),this.receiverMonitors.delete(et)}};Ct(Nr,"receiverMonitors",new Map);let ReliabilityMonitorManager=Nr;const log$g=new Logger$1("sdk:filter:subscription_manager");class SubscriptionManager{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"protocol");Ct(this,"connectionManager");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"reliabilityMonitor");Ct(this,"keepAliveTimeout",DEFAULT_KEEP_ALIVE);Ct(this,"keepAliveInterval",null);Ct(this,"enableLightPushFilterCheck",DEFAULT_LIGHT_PUSH_FILTER_CHECK);Ct(this,"subscriptionCallbacks");this.pubsubTopic=et,this.protocol=tt,this.connectionManager=nt,this.getPeers=rt,this.renewPeer=ot,this.libp2p=it,this.lightPush=st,this.pubsubTopic=et,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(et,tt,nt=DEFAULT_SUBSCRIBE_OPTIONS){this.reliabilityMonitor.setMaxPingFailures(nt.pingsBeforePeerRenewed),this.keepAliveTimeout=nt.keepAlive||DEFAULT_KEEP_ALIVE,this.enableLightPushFilterCheck=(nt==null?void 0:nt.enableLightPushFilterCheck)||DEFAULT_LIGHT_PUSH_FILTER_CHECK;const rt=Array.isArray(et)?et:[et];for(const lt of rt)if(lt.pubsubTopic!==this.pubsubTopic)return{failures:[{error:ProtocolError$1.TOPIC_DECODER_MISMATCH}],successes:[]};this.enableLightPushFilterCheck&&rt.push(createDecoder(this.buildLightPushContentTopic(),this.pubsubTopic));const ot=groupByContentTopic(rt),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(et){const tt=this.getPeers().map(async ot=>{const it=await this.protocol.unsubscribe(this.pubsubTopic,ot,et);return et.forEach(st=>{this.subscriptionCallbacks.delete(st)}),it}),nt=await Promise.allSettled(tt),rt=this.handleResult(nt,"unsubscribe");return this.subscriptionCallbacks.size===0&&this.stopSubscriptionsMaintenance(),rt}async ping(et){log$g.info("Sending keep-alive ping");const nt=(et?[et]:this.getPeers().map(ot=>ot.id)).map(ot=>this.pingSpecificPeer(ot)),rt=await Promise.allSettled(nt);return this.handleResult(rt,"ping")}async unsubscribeAll(){const et=this.getPeers().map(async rt=>this.protocol.unsubscribeAll(this.pubsubTopic,rt)),tt=await Promise.allSettled(et);this.subscriptionCallbacks.clear();const nt=this.handleResult(tt,"unsubscribeAll");return this.stopSubscriptionsMaintenance(),nt}async processIncomingMessage(et,tt){if(this.reliabilityMonitor.notifyMessageReceived(tt,et)){log$g.info("Message already received, skipping");return}const{contentTopic:rt}=et,ot=this.subscriptionCallbacks.get(rt);if(!ot){log$g.error("No subscription callback available for ",rt);return}log$g.info("Processing message with content topic ",rt," on pubsub topic ",this.pubsubTopic),await pushMessage(ot,this.pubsubTopic,et)}async subscribeWithPeerVerification(et,tt){const nt=await this.protocol.subscribe(this.pubsubTopic,et,tt);return await this.sendLightPushCheckMessage(et),nt}handleResult(et,tt){const nt={failures:[],successes:[]};for(const rt of et)if(rt.status==="rejected")log$g.error(`Failed to resolve ${tt} promise successfully: `,rt.reason),nt.failures.push({error:ProtocolError$1.GENERIC_FAIL});else{const ot=rt.value;ot.failure?nt.failures.push(ot.failure):nt.successes.push(ot.success)}return nt}async pingSpecificPeer(et){var rt,ot;const tt=this.getPeers().find(it=>it.id.equals(et));if(!tt)return{success:null,failure:{peerId:et,error:ProtocolError$1.NO_PEER_AVAILABLE}};let nt;try{nt=await this.protocol.ping(tt)}catch{nt={success:null,failure:{peerId:et,error:ProtocolError$1.GENERIC_FAIL}}}return log$g.info(`Received result from filter ping peerId:${et.toString()} success:${(rt=nt.success)==null?void 0:rt.toString()} failure:${(ot=nt.failure)==null?void 0:ot.error}`),await this.reliabilityMonitor.handlePingResult(et,nt),nt}startSubscriptionsMaintenance(et){log$g.info("Starting subscriptions maintenance"),this.startKeepAlivePings(et),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:et}){if(!et){this.stopKeepAlivePings();return}try{await this.ping()}catch(tt){log$g.error(`networkStateListener failed to recover: ${tt}`)}this.startKeepAlivePings(this.keepAliveTimeout)}startKeepAlivePings(et){if(this.keepAliveInterval){log$g.info("Recurring pings already set up.");return}this.keepAliveInterval=setInterval(()=>{this.ping()},et)}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(et){if(this.lightPush&&this.libp2p&&this.reliabilityMonitor.shouldVerifyPeer(et.id)){const tt=createEncoder({contentTopic:this.buildLightPushContentTopic(),pubsubTopic:this.pubsubTopic,ephemeral:!0}),nt={payload:new Uint8Array(1)},rt=await tt.toProtoObj(nt);setTimeout(async()=>{const ot=await this.lightPush.protocol.send(tt,nt,et);if(this.reliabilityMonitor.notifyMessageSent(et.id,rt),ot.failure){log$g.error(`failed to send lightPush ping message to peer:${et.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(o,et,tt){const{decoders:nt,callback:rt}=o,{contentTopic:ot}=tt;if(!ot){log$g.warn("Message has no content topic, skipping");return}try{const it=nt.map(at=>at.fromProtoObj(et,tt).then(ct=>ct||Promise.reject("Decoding failed"))),st=await Promise.any(it);await rt(st)}catch(it){log$g.error("Error decoding message",it)}}const log$f=new Logger$1("sdk:filter");class Filter extends BaseProtocolSDK{constructor(tt,nt,rt,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,nt),tt,{numPeersToUse:ot==null?void 0:ot.numPeersToUse});Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"protocol");Ct(this,"activeSubscriptions",new Map);this.libp2p=nt,this.lightPush=rt,this.protocol=this.core,this.activeSubscriptions=new Map}async subscribe(tt,nt,rt,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,rt);if(ct)return{subscription:null,error:ct,results:null};const{failures:lt,successes:dt}=await at.subscribe(tt,nt,ot);return{subscription:at,error:null,results:{failures:lt,successes:dt}}}async createSubscription(tt,nt){var st;nt={autoRetry:!0,...nt};const rt=typeof tt=="string"?tt:(st=shardInfoToPubsubTopics(tt))==null?void 0:st[0];return ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics),await this.hasPeers(nt)?(log$f.info(`Creating filter subscription with ${this.connectedPeers.length} peers: `,this.connectedPeers.map(at=>at.id.toString())),{error:null,subscription:this.getActiveSubscription(rt)??this.setActiveSubscription(rt,new SubscriptionManager(rt,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,nt,rt=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,nt,rt);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,nt){return this.activeSubscriptions.set(tt,nt),nt}getUniquePubsubTopics(tt){return Array.isArray(tt)?tt.length===0?[]:[...new Set(tt.map(rt=>rt.pubsubTopic))]:[tt.pubsubTopic]}}function wakuFilter(o,et,tt){return nt=>new Filter(o,nt,et,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(et,tt,nt){Ct(this,"libp2p");Ct(this,"numPeersToUse",DEFAULT_NUM_PEERS_TO_USE);Ct(this,"protocol");this.libp2p=tt,this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE,this.protocol=new LightPushCore(et.configuredPubsubTopics,tt)}async send(et,tt,nt=DEFAULT_SEND_OPTIONS){const rt=[],ot=[],{pubsubTopic:it}=et;try{ensurePubsubTopicIsConfigured(it,this.protocol.pubsubTopics)}catch{return log$e.error("Failed to send waku light push: pubsub topic not configured"),{successes:rt,failures:[{error:ProtocolError$1.TOPIC_NOT_CONFIGURED}]}}const st=await this.getConnectedPeers();if(st.length===0)return{successes:rt,failures:[{error:ProtocolError$1.NO_PEER_AVAILABLE}]};const at=await Promise.allSettled(st.map(ct=>this.protocol.send(et,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){rt.push(dt);continue}lt&&(ot.push(lt),nt!=null&&nt.autoRetry&&this.attemptRetries(ht=>this.protocol.send(et,tt,ht),nt.maxAttempts))}return getHealthManager().updateProtocolHealth(this.protocol.multicodec,rt.length),{successes:rt,failures:ot}}async attemptRetries(et,tt){var rt;tt=tt||DEFAULT_MAX_ATTEMPTS;const nt=await this.getConnectedPeers();if(nt.length===0){log$e.warn("Cannot retry with no connected peers.");return}for(let ot=0;ot{try{return await this.libp2p.peerStore.get(nt)}catch{return null}}))).filter(nt=>!!nt).filter(nt=>nt.protocols.includes(LightPushCodec)).slice(0,this.numPeersToUse)}}function wakuLightPush(o,et={}){return tt=>new LightPush(o,tt,et)}const DEFAULT_NUM_PEERS=1,log$d=new Logger$1("waku:store:sdk");class Store extends BaseProtocolSDK{constructor(tt,nt,rt){super(new StoreCore(tt.configuredPubsubTopics,nt),tt,{numPeersToUse:DEFAULT_NUM_PEERS});Ct(this,"peerIdStrToUse");Ct(this,"protocol");this.peerIdStrToUse=rt,this.protocol=this.core}async*queryGenerator(tt,nt){const{pubsubTopic:rt,contentTopics:ot,decodersAsMap:it}=this.validateDecodersAndPubsubTopic(tt),st={pubsubTopic:rt,contentTopics:ot,includeData:!0,paginationForward:!0,...nt},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(nt)}`);const ct=this.protocol.queryPerPage(st,it,at);for await(const lt of ct)yield lt}async queryWithOrderedCallback(tt,nt,rt){log$d.info("Querying store with ordered callback");for await(const ot of this.queryGenerator(tt,rt))if(await this.processMessages(ot,nt))break}async queryWithPromiseCallback(tt,nt,rt){log$d.info("Querying store with promise callback");let ot=!1;for await(const it of this.queryGenerator(tt,rt)){const st=it.map(async at=>{ot||(ot=!!await nt(at))});if(await Promise.all(st),ot)break}}async processMessages(tt,nt){let rt=!1;const it=(await Promise.all(tt)).filter(isDefined);return await Promise.all(it.map(async st=>{st&&!rt&&(rt=!!await nt(st))})),rt}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 nt=Array.from(new Set(tt.map(st=>st.pubsubTopic)));if(nt.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 rt=nt[0];ensurePubsubTopicIsConfigured(rt,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===rt).map(st=>st.contentTopic);if(it.length===0)throw log$d.error(`No decoders found for topic ${rt}`),new Error("No decoders found for topic "+rt);return{pubsubTopic:rt,contentTopics:it,decodersAsMap:ot}}}function wakuStore(o,et){return tt=>new Store(o,tt,et)}const log$c=new Logger$1("wait-for-remote-peer");async function waitForRemotePeer(o,et,tt){et=et!=null&&et.length?et:getEnabledProtocols(o);const nt=o.libp2p.getConnections();if(!o.isStarted())throw Error("Waku node is not started");for(const ot of et)switch(ot){case Protocols.Relay:if(!o.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");break;case Protocols.LightPush:if(!o.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");break;case Protocols.Store:if(!o.store)throw Error("Cannot wait for Store peer: protocol not mounted");break;case Protocols.Filter:if(!o.filter)throw Error("Cannot wait for Filter peer: protocol not mounted");break}const rt=[waitForProtocols(o,et)];nt.length>0&&!et.includes(Protocols.Relay)&&rt.push(waitForMetadata(o,et)),tt?await rejectOnTimeout(Promise.any(rt),tt,"Timed out waiting for a remote peer."):await Promise.any(rt)}async function waitForProtocols(o,et){const tt=[];return o.relay&&et.includes(Protocols.Relay)&&tt.push(o.relay.waitForPeers()),o.store&&et.includes(Protocols.Store)&&tt.push(waitForConnectedPeer(StoreCodec,o.libp2p)),o.lightPush&&et.includes(Protocols.LightPush)&&tt.push(waitForConnectedPeer(LightPushCodec,o.libp2p)),o.filter&&et.includes(Protocols.Filter)&&tt.push(waitForConnectedPeer(FilterCodecs.SUBSCRIBE,o.libp2p)),Promise.all(tt)}async function waitForConnectedPeer(o,et){log$c.info(`Waiting for ${o} peer.`),await new Promise(tt=>{const nt=async rt=>{var ot,it;if((it=(ot=rt.detail)==null?void 0:ot.protocols)!=null&&it.includes(o)){const st=et.services.metadata;if(!st){et.removeEventListener("peer:identify",nt),tt();return}try{await st.confirmOrAttemptHandshake(rt.detail.peerId),et.removeEventListener("peer:identify",nt),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}`)}}};et.addEventListener("peer:identify",nt)})}async function waitForMetadata(o,et){const tt=o.libp2p.getPeers(),nt=o.libp2p.services.metadata,rt=mapProtocolsToCodecs(et);if(!tt.length||!nt){log$c.info(`Skipping waitForMetadata due to missing connections:${tt.length} or metadataService:${!!nt}`);return}for(const ot of tt)try{const it=await o.libp2p.peerStore.get(ot);if(it.protocols.some(at=>rt.has(at))&&!(await nt.confirmOrAttemptHandshake(ot)).error&&(it.protocols.forEach(lt=>{rt.has(lt)&&rt.set(lt,!0)}),Array.from(rt.values()).every(lt=>lt)))return}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}}const awaitTimeout=(o,et)=>new Promise((tt,nt)=>setTimeout(()=>nt(Error(et)),o));async function rejectOnTimeout(o,et,tt){await Promise.race([o,awaitTimeout(et,tt)])}function getEnabledProtocols(o){const et=[];return o.relay&&et.push(Protocols.Relay),o.filter&&et.push(Protocols.Filter),o.store&&et.push(Protocols.Store),o.lightPush&&et.push(Protocols.LightPush),et}function mapProtocolsToCodecs(o){const et=new Map,tt={[Protocols.Filter]:FilterCodecs.SUBSCRIBE,[Protocols.LightPush]:LightPushCodec,[Protocols.Store]:StoreCodec};for(const nt of o)tt[nt]&&et.set(tt[nt],!1);return et}const DefaultPingKeepAliveValueSecs=5*60,DefaultRelayKeepAliveValueSecs=5*60,DefaultUserAgent="js-waku",DefaultPingMaxInboundStreams=10,log$b=new Logger$1("waku");class WakuNode{constructor(et,tt,nt,rt,ot){Ct(this,"pubsubTopics");Ct(this,"libp2p");Ct(this,"relay");Ct(this,"store");Ct(this,"filter");Ct(this,"lightPush");Ct(this,"connectionManager");Ct(this,"health");var ct;this.pubsubTopics=et,this.relay=ot,this.libp2p=nt,rt={filter:!1,lightpush:!1,store:!1,...rt};const it=tt.pingKeepAlive||DefaultPingKeepAliveValueSecs,st=this.relay?tt.relayKeepAlive||DefaultRelayKeepAliveValueSecs:0,at=this.libp2p.peerId.toString();if(this.connectionManager=ConnectionManager.create(at,nt,{pingKeepAlive:it,relayKeepAlive:st},this.pubsubTopics,this.relay),this.health=getHealthManager(),rt.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(nt)}if(rt.lightpush){const lt=wakuLightPush(this.connectionManager,tt);this.lightPush=lt(nt)}if(rt.filter){const lt=wakuFilter(this.connectionManager,this.lightPush,tt);this.filter=lt(nt)}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(et,tt){const nt=tt??[],rt=this.mapToPeerIdOrMultiaddr(et);typeof tt>"u"&&(this.relay&&nt.push(Protocols.Relay),this.store&&nt.push(Protocols.Store),this.filter&&nt.push(Protocols.Filter),this.lightPush&&nt.push(Protocols.LightPush));const ot=[];return nt.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")),nt.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")),nt.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")),nt.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 ${rt.toString()} with protocols ${nt}`),this.libp2p.dialProtocol(rt,ot)}async start(){await this.libp2p.start()}async stop(){ReliabilityMonitorManager.stopAll(),this.connectionManager.stop(),await this.libp2p.stop()}async waitForPeers(et,tt){return waitForRemotePeer(this,et,tt)}isStarted(){return this.libp2p.status=="started"}isConnected(){return this.connectionManager.isConnected()}async dialMultiaddr(et,tt){const nt=multiaddr(et);if(!nt.getPeerId())throw new Error("Failed to dial multiaddr: missing peer ID");return await this.libp2p.dialProtocol(nt,[tt]),nt.getPeerId()}mapToPeerIdOrMultiaddr(et){return isPeerId$2(et)?et:multiaddr(et)}}var ls;let InvalidParametersError$3=(ls=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ls,"name","InvalidParametersError"),ls);class InvalidPublicKeyError extends Error{constructor(et="Invalid public key"){super(et),this.name="InvalidPublicKeyError"}}Ct(InvalidPublicKeyError,"name","InvalidPublicKeyError");var us;let UnsupportedKeyTypeError$1=(us=class extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}},Ct(us,"name","UnsupportedKeyTypeError"),us);/*! 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(o){const et=validateBasic(o);return validateObject(o,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...et})}function twistedEdwards(o){const et=validateOpts$1(o),{Fp:tt,n:nt,prehash:rt,hash:ot,randomBytes:it,nByteLength:st,h:at}=et,ct=_2n$2<{try{return{isValid:!0,value:tt.sqrt(Yt*tt.inv(Ht))}}catch{return{isValid:!1,value:_0n$2}}}),pt=et.adjustScalarBytes||(Yt=>Yt),mt=et.domain||((Yt,Ht,Ut)=>{if(abool("phflag",Ut),Ht.length||Ut)throw new Error("Contexts/pre-hash are not supported");return Yt});function ft(Yt,Ht){aInRange("coordinate "+Yt,Ht,_0n$2,ct)}function yt(Yt){if(!(Yt instanceof vt))throw new Error("ExtendedPoint expected")}const gt=memoized((Yt,Ht)=>{const{ex:Ut,ey:qt,ez:Lt}=Yt,Zt=Yt.is0();Ht==null&&(Ht=Zt?_8n$2:tt.inv(Lt));const Qt=lt(Ut*Ht),Nt=lt(qt*Ht),Gt=lt(Lt*Ht);if(Zt)return{x:_0n$2,y:_1n$3};if(Gt!==_1n$3)throw new Error("invZ was invalid");return{x:Qt,y:Nt}}),xt=memoized(Yt=>{const{a:Ht,d:Ut}=et;if(Yt.is0())throw new Error("bad point: ZERO");const{ex:qt,ey:Lt,ez:Zt,et:Qt}=Yt,Nt=lt(qt*qt),Gt=lt(Lt*Lt),nn=lt(Zt*Zt),Wt=lt(nn*nn),hn=lt(Nt*Ht),Xt=lt(nn*lt(hn+Gt)),Jt=lt(Wt+lt(Ut*lt(Nt*Gt)));if(Xt!==Jt)throw new Error("bad point: equation left != right (1)");const tn=lt(qt*Lt),_t=lt(Zt*Qt);if(tn!==_t)throw new Error("bad point: equation left != right (2)");return!0});class vt{constructor(Ht,Ut,qt,Lt){this.ex=Ht,this.ey=Ut,this.ez=qt,this.et=Lt,ft("x",Ht),ft("y",Ut),ft("z",qt),ft("t",Lt),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Ht){if(Ht instanceof vt)throw new Error("extended point not allowed");const{x:Ut,y:qt}=Ht||{};return ft("x",Ut),ft("y",qt),new vt(Ut,qt,_1n$3,lt(Ut*qt))}static normalizeZ(Ht){const Ut=tt.invertBatch(Ht.map(qt=>qt.ez));return Ht.map((qt,Lt)=>qt.toAffine(Ut[Lt])).map(vt.fromAffine)}static msm(Ht,Ut){return pippenger(vt,dt,Ht,Ut)}_setWindowSize(Ht){wt.setWindowSize(this,Ht)}assertValidity(){xt(this)}equals(Ht){yt(Ht);const{ex:Ut,ey:qt,ez:Lt}=this,{ex:Zt,ey:Qt,ez:Nt}=Ht,Gt=lt(Ut*Nt),nn=lt(Zt*Lt),Wt=lt(qt*Nt),hn=lt(Qt*Lt);return Gt===nn&&Wt===hn}is0(){return this.equals(vt.ZERO)}negate(){return new vt(lt(-this.ex),this.ey,this.ez,lt(-this.et))}double(){const{a:Ht}=et,{ex:Ut,ey:qt,ez:Lt}=this,Zt=lt(Ut*Ut),Qt=lt(qt*qt),Nt=lt(_2n$2*lt(Lt*Lt)),Gt=lt(Ht*Zt),nn=Ut+qt,Wt=lt(lt(nn*nn)-Zt-Qt),hn=Gt+Qt,Xt=hn-Nt,Jt=Gt-Qt,tn=lt(Wt*Xt),_t=lt(hn*Jt),Dt=lt(Wt*Jt),Vt=lt(Xt*hn);return new vt(tn,_t,Vt,Dt)}add(Ht){yt(Ht);const{a:Ut,d:qt}=et,{ex:Lt,ey:Zt,ez:Qt,et:Nt}=this,{ex:Gt,ey:nn,ez:Wt,et:hn}=Ht;if(Ut===BigInt(-1)){const mn=lt((Zt-Lt)*(nn+Gt)),wn=lt((Zt+Lt)*(nn-Gt)),Tn=lt(wn-mn);if(Tn===_0n$2)return this.double();const Pn=lt(Qt*_2n$2*hn),yn=lt(Nt*_2n$2*Wt),En=yn+Pn,on=wn+mn,Tt=yn-Pn,St=lt(En*Tn),At=lt(on*Tt),$t=lt(En*Tt),Kt=lt(Tn*on);return new vt(St,At,Kt,$t)}const Xt=lt(Lt*Gt),Jt=lt(Zt*nn),tn=lt(Nt*qt*hn),_t=lt(Qt*Wt),Dt=lt((Lt+Zt)*(Gt+nn)-Xt-Jt),Vt=_t-tn,en=_t+tn,an=lt(Jt-Ut*Xt),dn=lt(Dt*Vt),ln=lt(en*an),pn=lt(Dt*an),kn=lt(Vt*en);return new vt(dn,ln,kn,pn)}subtract(Ht){return this.add(Ht.negate())}wNAF(Ht){return wt.wNAFCached(this,Ht,vt.normalizeZ)}multiply(Ht){const Ut=Ht;aInRange("scalar",Ut,_1n$3,nt);const{p:qt,f:Lt}=this.wNAF(Ut);return vt.normalizeZ([qt,Lt])[0]}multiplyUnsafe(Ht){const Ut=Ht;return aInRange("scalar",Ut,_0n$2,nt),Ut===_0n$2?Et:this.equals(Et)||Ut===_1n$3?this:this.equals(bt)?this.wNAF(Ut).p:wt.unsafeLadder(this,Ut)}isSmallOrder(){return this.multiplyUnsafe(at).is0()}isTorsionFree(){return wt.unsafeLadder(this,nt).is0()}toAffine(Ht){return gt(this,Ht)}clearCofactor(){const{h:Ht}=et;return Ht===_1n$3?this:this.multiplyUnsafe(Ht)}static fromHex(Ht,Ut=!1){const{d:qt,a:Lt}=et,Zt=tt.BYTES;Ht=ensureBytes$1("pointHex",Ht,Zt),abool("zip215",Ut);const Qt=Ht.slice(),Nt=Ht[Zt-1];Qt[Zt-1]=Nt&-129;const Gt=bytesToNumberLE(Qt),nn=Ut?ct:tt.ORDER;aInRange("pointHex.y",Gt,_0n$2,nn);const Wt=lt(Gt*Gt),hn=lt(Wt-_1n$3),Xt=lt(qt*Wt-Lt);let{isValid:Jt,value:tn}=ht(hn,Xt);if(!Jt)throw new Error("Point.fromHex: invalid y coordinate");const _t=(tn&_1n$3)===_1n$3,Dt=(Nt&128)!==0;if(!Ut&&tn===_0n$2&&Dt)throw new Error("Point.fromHex: x=0 and x_0=1");return Dt!==_t&&(tn=lt(-tn)),vt.fromAffine({x:tn,y:Gt})}static fromPrivateKey(Ht){return Rt(Ht).point}toRawBytes(){const{x:Ht,y:Ut}=this.toAffine(),qt=numberToBytesLE(Ut,tt.BYTES);return qt[qt.length-1]|=Ht&_1n$3?128:0,qt}toHex(){return bytesToHex$2(this.toRawBytes())}}vt.BASE=new vt(et.Gx,et.Gy,_1n$3,lt(et.Gx*et.Gy)),vt.ZERO=new vt(_0n$2,_1n$3,_1n$3,_0n$2);const{BASE:bt,ZERO:Et}=vt,wt=wNAF(vt,st*8);function kt(Yt){return mod$1(Yt,nt)}function It(Yt){return kt(bytesToNumberLE(Yt))}function Rt(Yt){const Ht=st;Yt=ensureBytes$1("private key",Yt,Ht);const Ut=ensureBytes$1("hashed private key",ot(Yt),2*Ht),qt=pt(Ut.slice(0,Ht)),Lt=Ut.slice(Ht,2*Ht),Zt=It(qt),Qt=bt.multiply(Zt),Nt=Qt.toRawBytes();return{head:qt,prefix:Lt,scalar:Zt,point:Qt,pointBytes:Nt}}function Pt(Yt){return Rt(Yt).pointBytes}function jt(Yt=new Uint8Array,...Ht){const Ut=concatBytes$1(...Ht);return It(ot(mt(Ut,ensureBytes$1("context",Yt),!!rt)))}function Ot(Yt,Ht,Ut={}){Yt=ensureBytes$1("message",Yt),rt&&(Yt=rt(Yt));const{prefix:qt,scalar:Lt,pointBytes:Zt}=Rt(Ht),Qt=jt(Ut.context,qt,Yt),Nt=bt.multiply(Qt).toRawBytes(),Gt=jt(Ut.context,Nt,Zt,Yt),nn=kt(Qt+Gt*Lt);aInRange("signature.s",nn,_0n$2,nt);const Wt=concatBytes$1(Nt,numberToBytesLE(nn,tt.BYTES));return ensureBytes$1("result",Wt,st*2)}const Bt=VERIFY_DEFAULT;function zt(Yt,Ht,Ut,qt=Bt){const{context:Lt,zip215:Zt}=qt,Qt=tt.BYTES;Yt=ensureBytes$1("signature",Yt,2*Qt),Ht=ensureBytes$1("message",Ht),Zt!==void 0&&abool("zip215",Zt),rt&&(Ht=rt(Ht));const Nt=bytesToNumberLE(Yt.slice(Qt,2*Qt));let Gt,nn,Wt;try{Gt=vt.fromHex(Ut,Zt),nn=vt.fromHex(Yt.slice(0,Qt),Zt),Wt=bt.multiplyUnsafe(Nt)}catch{return!1}if(!Zt&&Gt.isSmallOrder())return!1;const hn=jt(Lt,nn.toRawBytes(),Gt.toRawBytes(),Ht);return nn.add(Gt.multiplyUnsafe(hn)).subtract(Wt).clearCofactor().equals(vt.ZERO)}return bt._setWindowSize(8),{CURVE:et,getPublicKey:Pt,sign:Ot,verify:zt,ExtendedPoint:vt,utils:{getExtendedPublicKey:Rt,randomPrivateKey:()=>it(tt.BYTES),precompute(Yt=8,Ht=vt.BASE){return Ht._setWindowSize(Yt),Ht.multiply(BigInt(3)),Ht}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function validateOpts(o){return validateObject(o,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...o})}function montgomery(o){const et=validateOpts(o),{P:tt}=et,nt=xt=>mod$1(xt,tt),rt=et.montgomeryBits,ot=Math.ceil(rt/8),it=et.nByteLength,st=et.adjustScalarBytes||(xt=>xt),at=et.powPminus2||(xt=>pow(xt,tt-BigInt(2),tt));function ct(xt,vt,bt){const Et=nt(xt*(vt-bt));return vt=nt(vt-Et),bt=nt(bt+Et),[vt,bt]}const lt=(et.a-BigInt(2))/BigInt(4);function dt(xt,vt){aInRange("u",xt,_0n$1,tt),aInRange("scalar",vt,_0n$1,tt);const bt=vt,Et=xt;let wt=_1n$2,kt=_0n$1,It=xt,Rt=_1n$2,Pt=_0n$1,jt;for(let Bt=BigInt(rt-1);Bt>=_0n$1;Bt--){const zt=bt>>Bt&_1n$2;Pt^=zt,jt=ct(Pt,wt,It),wt=jt[0],It=jt[1],jt=ct(Pt,kt,Rt),kt=jt[0],Rt=jt[1],Pt=zt;const Ft=wt+kt,Yt=nt(Ft*Ft),Ht=wt-kt,Ut=nt(Ht*Ht),qt=Yt-Ut,Lt=It+Rt,Zt=It-Rt,Qt=nt(Zt*Ft),Nt=nt(Lt*Ht),Gt=Qt+Nt,nn=Qt-Nt;It=nt(Gt*Gt),Rt=nt(Et*nt(nn*nn)),wt=nt(Yt*Ut),kt=nt(qt*(Yt+nt(lt*qt)))}jt=ct(Pt,wt,It),wt=jt[0],It=jt[1],jt=ct(Pt,kt,Rt),kt=jt[0],Rt=jt[1];const Ot=at(kt);return nt(wt*Ot)}function ht(xt){return numberToBytesLE(nt(xt),ot)}function pt(xt){const vt=ensureBytes$1("u coordinate",xt,ot);return it===32&&(vt[31]&=127),bytesToNumberLE(vt)}function mt(xt){const vt=ensureBytes$1("scalar",xt),bt=vt.length;if(bt!==ot&&bt!==it)throw new Error(`Expected ${ot} or ${it} bytes, got ${bt}`);return bytesToNumberLE(st(vt))}function ft(xt,vt){const bt=pt(vt),Et=mt(xt),wt=dt(bt,Et);if(wt===_0n$1)throw new Error("Invalid private or public key received");return ht(wt)}const yt=ht(et.Gu);function gt(xt){return ft(xt,yt)}return{scalarMult:ft,scalarMultBase:gt,getSharedSecret:(xt,vt)=>ft(xt,vt),getPublicKey:xt=>gt(xt),utils:{randomPrivateKey:()=>et.randomBytes(et.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(o){const et=BigInt(10),tt=BigInt(20),nt=BigInt(40),rt=BigInt(80),ot=ED25519_P,st=o*o%ot*o%ot,at=pow2$1(st,_2n$1,ot)*st%ot,ct=pow2$1(at,_1n$1,ot)*o%ot,lt=pow2$1(ct,_5n,ot)*ct%ot,dt=pow2$1(lt,et,ot)*lt%ot,ht=pow2$1(dt,tt,ot)*dt%ot,pt=pow2$1(ht,nt,ot)*ht%ot,mt=pow2$1(pt,rt,ot)*pt%ot,ft=pow2$1(mt,rt,ot)*pt%ot,yt=pow2$1(ft,et,ot)*lt%ot;return{pow_p_5_8:pow2$1(yt,_2n$1,ot)*o%ot,b2:st}}function adjustScalarBytes(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function uvRatio(o,et){const tt=ED25519_P,nt=mod$1(et*et*et,tt),rt=mod$1(nt*nt*et,tt),ot=ed25519_pow_2_252_3(o*rt).pow_p_5_8;let it=mod$1(o*nt*ot,tt);const st=mod$1(et*it*it,tt),at=it,ct=mod$1(it*ED25519_SQRT_M1,tt),lt=st===o,dt=st===mod$1(-o,tt),ht=st===mod$1(-o*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:o=>{const et=ED25519_P,{pow_p_5_8:tt,b2:nt}=ed25519_pow_2_252_3(o);return mod$1(pow2$1(tt,_3n$1,et)*nt,et)},adjustScalarBytes,randomBytes:randomBytes$1}),PUBLIC_KEY_BYTE_LENGTH=32,PRIVATE_KEY_BYTE_LENGTH=64,KEYS_BYTE_LENGTH=32;function generateKey(){const o=ed25519.utils.randomPrivateKey(),et=ed25519.getPublicKey(o);return{privateKey:concatKeys(o,et),publicKey:et}}function hashAndSign(o,et){const tt=o.subarray(0,KEYS_BYTE_LENGTH);return ed25519.sign(et instanceof Uint8Array?et:et.subarray(),tt)}function hashAndVerify$2(o,et,tt){return ed25519.verify(et,tt instanceof Uint8Array?tt:tt.subarray(),o)}function concatKeys(o,et){const tt=new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);for(let nt=0;ntenumeration(__KeyTypeValues)})(KeyType||(KeyType={}));var PublicKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PublicKey||(PublicKey={}));var PrivateKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PrivateKey||(PrivateKey={}));/*! + `);return}try{await this.libp2p.peerStore.merge(et,{metadata:{ping:utf8ToBytes$1(st.toString())}})}catch(at){log$k.error("Failed to update ping",at)}}catch(at){log$k.error(`Ping failed (${rt})`,at)}})()},tt*1e3);this.pingKeepAliveTimers.set(rt,it)}const ot=this.relay;if(ot&&nt!==0){const it=this.scheduleRelayPings(ot,nt,et.toString());this.relayKeepAliveTimers.set(et,it)}}stop(et){var nt;const tt=et.toString();this.pingKeepAliveTimers.has(tt)&&(clearInterval(this.pingKeepAliveTimers.get(tt)),this.pingKeepAliveTimers.delete(tt)),this.relayKeepAliveTimers.has(et)&&((nt=this.relayKeepAliveTimers.get(et))==null||nt.map(clearInterval),this.relayKeepAliveTimers.delete(et))}stopAll(){for(const et of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(et);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}connectionsExist(){return this.pingKeepAliveTimers.size>0||this.relayKeepAliveTimers.size>0}scheduleRelayPings(et,tt,nt){const rt=[];for(const ot of et.pubsubTopics){if(!et.getMeshPeers(ot).includes(nt))continue;const st=createEncoder({pubsubTopicShardInfo:pubsubTopicToSingleShardInfo(ot),contentTopic:RelayPingContentTopic,ephemeral:!0}),at=setInterval(()=>{log$k.info("Sending Waku Relay ping message"),et.send(st,{payload:new Uint8Array([1])}).catch(ct=>log$k.error("Failed to send relay ping",ct))},tt*1e3);rt.push(at)}return rt}}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,$r=class $r extends TypedEventEmitter$3{constructor(tt,nt,rt,ot,it){super();Ct(this,"configuredPubsubTopics");Ct(this,"keepAliveManager");Ct(this,"options");Ct(this,"libp2p");Ct(this,"dialAttemptsForPeer",new Map);Ct(this,"dialErrorsForPeer",new Map);Ct(this,"currentActiveParallelDialCount",0);Ct(this,"pendingPeerDialQueue",[]);Ct(this,"isP2PNetworkConnected",!1);Ct(this,"onEventHandlers",{"peer:discovery":tt=>{(async()=>{const{id:nt}=tt.detail;await this.dispatchDiscoveryEvent(nt);try{await this.attemptDial(nt)}catch(rt){log$j.error(`Error dialing peer ${nt.toString()} : ${rt}`)}})()},"peer:connect":tt=>{(async()=>{log$j.info(`Connected to peer ${tt.detail.toString()}`);const nt=tt.detail;this.keepAliveManager.start(nt),(await this.getTagNamesForPeer(nt)).includes(Tags$2.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.includes(Tags$2.BOOTSTRAP)).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(nt):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents$2.PEER_CONNECT_BOOTSTRAP,{detail:nt})):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents$2.PEER_CONNECT_PEER_EXCHANGE,{detail:nt})),this.setP2PNetworkConnected()})()},"peer:disconnect":tt=>{(async()=>(this.keepAliveManager.stop(tt.detail),this.setP2PNetworkDisconnected()))()},"browser:network":()=>{this.dispatchWakuConnectionEvent()}});this.configuredPubsubTopics=rt,this.libp2p=tt,this.configuredPubsubTopics=rt,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:nt}),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,nt,rt,ot,it,st){let at=$r.instances.get(tt);return at||(at=new $r(nt,rt,ot,it,st),$r.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(nt){log$j.error(`Error dropping connection with peer ${tt.toString()} - ${nt}`)}}async getPeersByDiscovery(){const tt=await this.libp2p.peerStore.all(),nt=this.libp2p.getConnections().map(lt=>lt.remotePeer),rt=[],ot=[],it=[],st=[],at=[],ct=[];for(const lt of tt){const dt=await this.getTagNamesForPeer(lt.id);dt.includes(Tags$2.BOOTSTRAP)?rt.push(lt):dt.includes(Tags$2.PEER_EXCHANGE)?ot.push(lt):dt.includes(Tags$2.LOCAL)&&it.push(lt)}for(const lt of nt){const dt=await this.libp2p.peerStore.get(lt),ht=await this.getTagNamesForPeer(lt);ht.includes(Tags$2.BOOTSTRAP)?st.push(dt):ht.includes(Tags$2.PEER_EXCHANGE)?at.push(dt):ht.includes(Tags$2.LOCAL)&&ct.push(dt)}return{DISCOVERED:{[Tags$2.BOOTSTRAP]:rt,[Tags$2.PEER_EXCHANGE]:ot,[Tags$2.LOCAL]:it},CONNECTED:{[Tags$2.BOOTSTRAP]:st,[Tags$2.PEER_EXCHANGE]:at,[Tags$2.LOCAL]:ct}}}async dialPeerStorePeers(){const tt=await this.libp2p.peerStore.all(),nt=[];for(const rt of tt)this.libp2p.getConnections().find(ot=>ot.remotePeer===rt.id)||nt.push(this.attemptDial(rt.id));try{await Promise.all(nt)}catch(rt){log$j.error("Unexpected error while dialing peer store peers",rt)}}async startEventListeners(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener(),this.startNetworkStatusListener()}async dialPeer(tt){this.currentActiveParallelDialCount+=1;let nt=0;for(;nt{ot.tags=Array.from(new Set([...ot.tags,...rt]))}),this.dialAttemptsForPeer.set(tt.toString(),-1),this.keepAliveManager.start(tt);break}catch(rt){rt instanceof AggregateError?log$j.error(`Error dialing peer ${tt.toString()} - ${rt.errors}`):log$j.error(`Error dialing peer ${tt.toString()} - ${rt.message}`),this.dialErrorsForPeer.set(tt.toString(),rt),nt++,this.dialAttemptsForPeer.set(tt.toString(),nt)}if(this.currentActiveParallelDialCount--,this.processDialQueue(),nt===this.options.maxDialAttemptsForPeer)try{const rt=this.dialErrorsForPeer.get(tt.toString());if(rt){let ot;rt instanceof AggregateError?rt.errors?rt.errors.length===0?log$j.warn("Errors array is empty for AggregateError"):ot=JSON.stringify(rt.errors[0]):log$j.warn("No errors array found for AggregateError"):ot=rt.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(rt){throw new Error(`Error deleting undialable peer ${tt.toString()} from peer store - ${rt}`)}}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(nt=>nt&&nt.toString?nt.toString().includes(DNS_DISCOVERY_TAG$1):!1);tt&&await tt.findPeers()}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveParallelDialCount{log$j.error(nt)})}}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$2.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.find(st=>st===Tags$2.BOOTSTRAP)).lengththis.configuredPubsubTopics.includes(it)):!0}async getPeerShardInfo(tt,nt){const ot=(await nt.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$2.CONNECTION_STATUS,{detail:this.isConnected()}))}};Ct($r,"instances",new Map);let ConnectionManager=$r;const wr=class wr{constructor(){Ct(this,"health");this.health={overallStatus:HealthStatus$2.Unhealthy,protocolStatuses:new Map}}static getInstance(){return wr.instance||(wr.instance=new wr),wr.instance}getHealthStatus(){return this.health.overallStatus}getProtocolStatus(et){return this.health.protocolStatuses.get(et)}updateProtocolHealth(et,tt){const nt=this.getNameFromMulticodec(et);let rt=HealthStatus$2.Unhealthy;tt==1?rt=HealthStatus$2.MinimallyHealthy:tt>=2&&(rt=HealthStatus$2.SufficientlyHealthy),this.health.protocolStatuses.set(nt,{name:nt,status:rt,lastUpdate:new Date}),this.updateOverallHealth()}getNameFromMulticodec(et){let tt;if(et.includes("filter"))tt=Protocols$2.Filter;else if(et.includes("lightpush"))tt=Protocols$2.LightPush;else if(et.includes("store"))tt=Protocols$2.Store;else throw new Error(`Unknown protocol: ${et}`);return tt}updateOverallHealth(){const tt=[Protocols$2.LightPush,Protocols$2.Filter].map(nt=>{var rt;return(rt=this.getProtocolStatus(nt))==null?void 0:rt.status});tt.some(nt=>nt===HealthStatus$2.Unhealthy)?this.health.overallStatus=HealthStatus$2.Unhealthy:tt.some(nt=>nt===HealthStatus$2.MinimallyHealthy)?this.health.overallStatus=HealthStatus$2.MinimallyHealthy:this.health.overallStatus=HealthStatus$2.SufficientlyHealthy}};Ct(wr,"instance");let HealthManager=wr;const getHealthManager=()=>HealthManager.getInstance(),log$i=new Logger$1("metadata"),MetadataCodec="/vac/waku/metadata/1.0.0";class Metadata extends BaseProtocol{constructor(tt,nt){super(MetadataCodec,nt.components,log$i,tt);Ct(this,"pubsubTopics");Ct(this,"libp2pComponents");Ct(this,"handshakesConfirmed",new Map);this.pubsubTopics=tt,this.libp2pComponents=nt,nt.registrar.handle(MetadataCodec,rt=>{this.onRequest(rt)})}async query(tt){const nt=WakuMetadataRequest$1.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),rt=await this.libp2pComponents.peerStore.get(tt);if(!rt)return{shardInfo:null,error:ProtocolError$3.NO_PEER_AVAILABLE};let ot;try{ot=await this.getStream(rt)}catch(ct){return log$i.error("Failed to get stream",ct),{shardInfo:null,error:ProtocolError$3.NO_STREAM_AVAILABLE}}const it=await pipe([nt],encode$5,ot,decode$5,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 nt=this.handshakesConfirmed.get(tt.toString());return nt?{shardInfo:nt,error:null}:await this.query(tt)}async onRequest(tt){try{const{stream:nt,connection:rt}=tt,ot=WakuMetadataResponse$1.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),it=await pipe([ot],encode$5,nt,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);if(st)return;await this.savePeerShardInfo(rt.remotePeer,at)}catch(nt){log$i.error("Error handling metadata request",nt)}}decodeMetadataResponse(tt){const nt=new Uint8ArrayList;tt.forEach(ot=>{nt.append(ot)});const rt=WakuMetadataResponse$1.decode(nt);return rt?{shardInfo:rt,error:null}:(log$i.error("Error decoding metadata response"),{shardInfo:null,error:ProtocolError$3.DECODE_FAILED})}async savePeerShardInfo(tt,nt){await this.libp2pComponents.peerStore.merge(tt,{metadata:{shardInfo:encodeRelayShard(nt)}}),this.handshakesConfirmed.set(tt.toString(),nt)}}function wakuMetadata(o){return et=>new Metadata(o,et)}class Parser{constructor(){Ct(this,"index",0);Ct(this,"input","")}new(et){return this.index=0,this.input=et,this}readAtomically(et){const tt=this.index,nt=et();return nt===void 0&&(this.index=tt),nt}parseWith(et){const tt=et();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(et){return this.readAtomically(()=>{const tt=this.readChar();if(tt===et)return tt})}readSeparator(et,tt,nt){return this.readAtomically(()=>{if(!(tt>0&&this.readGivenChar(et)===void 0))return nt()})}readNumber(et,tt,nt,rt){return this.readAtomically(()=>{let ot=0,it=0;const st=this.peekChar();if(st===void 0)return;const at=st==="0",ct=2**(8*rt)-1;for(;;){const lt=this.readAtomically(()=>{const dt=this.readChar();if(dt===void 0)return;const ht=Number.parseInt(dt,et);if(!Number.isNaN(ht))return ht});if(lt===void 0)break;if(ot*=et,ot+=lt,ot>ct||(it+=1,tt!==void 0&&it>tt))return}if(it!==0)return!nt&&at&&it>1?void 0:ot})}readIPv4Addr(){return this.readAtomically(()=>{const et=new Uint8Array(4);for(let tt=0;ttthis.readNumber(10,3,!1,1));if(nt===void 0)return;et[tt]=nt}return et})}readIPv6Addr(){const et=tt=>{for(let nt=0;ntthis.readIPv4Addr());if(it!==void 0)return tt[rt]=it[0],tt[rt+1]=it[1],tt[rt+2]=it[2],tt[rt+3]=it[3],[rt+4,!0]}const ot=this.readSeparator(":",nt,()=>this.readNumber(16,4,!0,2));if(ot===void 0)return[rt,!1];tt[rt]=ot>>8,tt[rt+1]=ot&255}return[tt.length,!1]};return this.readAtomically(()=>{const tt=new Uint8Array(16),[nt,rt]=et(tt);if(nt===16)return tt;if(rt||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const ot=new Uint8Array(14),it=16-(nt+2),[st]=et(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(o){if(!(o.length>MAX_IPV4_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv6Addr())}function parseIP(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPAddr())}function isIPv4(o){return!!parseIPv4(o)}function isIPv6(o){return!!parseIPv6(o)}function isIP(o){return!!parseIP(o)}const isV4=isIPv4,isV6=isIPv6,toBytes$1=function(o){let et=0;if(o=o.toString().trim(),isV4(o)){const tt=new Uint8Array(et+4);return o.split(/\./g).forEach(nt=>{tt[et++]=parseInt(nt,10)&255}),tt}if(isV6(o)){const tt=o.split(":",8);let nt;for(nt=0;nt0;nt--)ot.push("0");tt.splice.apply(tt,ot)}const rt=new Uint8Array(et+16);for(nt=0;nt>8&255,rt[et++]=ot&255}return rt}throw new Error("invalid ip address")},toString$7=function(o,et=0,tt){et=~~et,tt=tt??o.length-et;const nt=new DataView(o.buffer);if(tt===4){const rt=[];for(let ot=0;ot{const et=createProtocol(...o);codes[et.code]=et,names[et.name]=et});function createProtocol(o,et,tt,nt,rt){return{code:o,size:et,name:tt,resolvable:!!nt,path:!!rt}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(o,et){switch(getProtocol(o).code){case 4:case 41:return bytes2ip(et);case 42:return bytes2str(et);case 6:case 273:case 33:case 132:return bytes2port(et).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(et);case 421:return bytes2mh(et);case 444:return bytes2onion(et);case 445:return bytes2onion(et);case 466:return bytes2mb(et);case 481:return globalThis.encodeURIComponent(bytes2str(et));default:return toString$8(et,"base16")}}function convertToBytes(o,et){switch(getProtocol(o).code){case 4:return ip2bytes(et);case 41:return ip2bytes(et);case 42:return str2bytes(et);case 6:case 273:case 33:case 132:return port2bytes(parseInt(et,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(et);case 421:return mh2bytes(et);case 444:return onion2bytes(et);case 445:return onion32bytes(et);case 466:return mb2bytes(et);case 481:return str2bytes(globalThis.decodeURIComponent(et));default:return fromString(et,"base16")}}const decoders=Object.values(bases).map(o=>o.decoder),anybaseDecoder=function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(et=>o=o.or(et)),o}();function ip2bytes(o){if(!isIP(o))throw new Error("invalid ip address");return toBytes$1(o)}function bytes2ip(o){const et=toString$7(o,0,o.length);if(et==null)throw new Error("ipBuff is required");if(!isIP(et))throw new Error("invalid ip address");return et}function port2bytes(o){const et=new ArrayBuffer(2);return new DataView(et).setUint16(0,o),new Uint8Array(et)}function bytes2port(o){return new DataView(o.buffer).getUint16(o.byteOffset)}function str2bytes(o){const et=fromString(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2str(o){const et=decode$b(o);if(o=o.slice(encodingLength$3(et)),o.length!==et)throw new Error("inconsistent lengths");return toString$8(o)}function mh2bytes(o){let et;o[0]==="Q"||o[0]==="1"?et=decode$6(base58btc.decode(`z${o}`)).bytes:et=CID.parse(o).multihash.bytes;const tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function mb2bytes(o){const et=anybaseDecoder.decode(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2mb(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return"u"+toString$8(tt,"base64url")}function bytes2mh(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return toString$8(tt,"base58btc")}function onion2bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==16)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion address.`);const tt=base32$2.decode("b"+et[0]),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function onion32bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==56)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion3 address.`);const tt=base32$2.decode(`b${et[0]}`),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function bytes2onion(o){const et=o.slice(0,o.length-2),tt=o.slice(o.length-2),nt=toString$8(et,"base32"),rt=bytes2port(tt);return`${nt}:${rt}`}function stringToMultiaddrParts(o){o=cleanPath(o);const et=[],tt=[];let nt=null;const rt=o.split("/").slice(1);if(rt.length===1&&rt[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let ot=0;ot=rt.length)throw ParseError("invalid address: "+o);if(st.path===!0){nt=cleanPath(rt.slice(ot).join("/")),et.push([st.code,convertToBytes(st.code,nt)]),tt.push([st.code,nt]);break}const at=convertToBytes(st.code,rt[ot]);et.push([st.code,at]),tt.push([st.code,convertToString(st.code,at)])}return{string:stringTuplesToString(tt),bytes:tuplesToBytes(et),tuples:et,stringTuples:tt,path:nt}}function bytesToMultiaddrParts(o){const et=[],tt=[];let nt=null,rt=0;for(;rto.length)throw ParseError("Invalid address Uint8Array: "+toString$8(o,"base16"));et.push([ot,ct]);const lt=convertToString(ot,ct);if(tt.push([ot,lt]),st.path===!0){nt=lt;break}}return{bytes:Uint8Array.from(o),string:stringTuplesToString(tt),tuples:et,stringTuples:tt,path:nt}}function stringTuplesToString(o){const et=[];return o.map(tt=>{const nt=getProtocol(tt[0]);return et.push(nt.name),tt.length>1&&tt[1]!=null&&et.push(tt[1]),null}),cleanPath(et.join("/"))}function tuplesToBytes(o){return concat$1(o.map(et=>{const tt=getProtocol(et[0]);let nt=Uint8Array.from(encode$a(tt.code));return et.length>1&&et[1]!=null&&(nt=concat$1([nt,et[1]])),nt}))}function sizeForAddr(o,et){if(o.size>0)return o.size/8;if(o.size===0)return 0;{const tt=decode$b(et instanceof Uint8Array?et:Uint8Array.from(et));return tt+encodingLength$3(tt)}}function cleanPath(o){return"/"+o.trim().split("/").filter(et=>et).join("/")}function ParseError(o){return new Error("Error parsing address: "+o)}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(et="No available resolver"){super(et),this.name="NoAvailableResolverError"}}var ga,Kr,xr,so,ao;const Pr=class Pr{constructor(et){Ct(this,"bytes");pn(this,Kr);pn(this,xr);pn(this,so);pn(this,ao);Ct(this,ga,!0);et==null&&(et="");let tt;if(et instanceof Uint8Array)tt=bytesToMultiaddrParts(et);else if(typeof et=="string"){if(et.length>0&&et.charAt(0)!=="/")throw new Error(`multiaddr "${et}" must start with a "/"`);tt=stringToMultiaddrParts(et)}else if(isMultiaddr(et))tt=bytesToMultiaddrParts(et.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=tt.bytes,un(this,Kr,tt.string),un(this,xr,tt.tuples),un(this,so,tt.stringTuples),un(this,ao,tt.path)}toString(){return jt(this,Kr)}toJSON(){return this.toString()}toOptions(){let et,tt,nt,rt,ot="";const it=getProtocol("tcp"),st=getProtocol("udp"),at=getProtocol("ip4"),ct=getProtocol("ip6"),lt=getProtocol("dns6"),dt=getProtocol("ip6zone");for(const[ft,mt]of this.stringTuples())ft===dt.code&&(ot=`%${mt??""}`),DNS_CODES.includes(ft)&&(tt=it.name,rt=443,nt=`${mt??""}${ot}`,et=ft===lt.code?6:4),(ft===it.code||ft===st.code)&&(tt=getProtocol(ft).name,rt=parseInt(mt??"")),(ft===at.code||ft===ct.code)&&(tt=getProtocol(ft).name,nt=`${mt??""}${ot}`,et=ft===ct.code?6:4);if(et==null||tt==null||nt==null||rt==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:et,host:nt,transport:tt,port:rt}}protos(){return jt(this,xr).map(([et])=>Object.assign({},getProtocol(et)))}protoCodes(){return jt(this,xr).map(([et])=>et)}protoNames(){return jt(this,xr).map(([et])=>getProtocol(et).name)}tuples(){return jt(this,xr)}stringTuples(){return jt(this,so)}encapsulate(et){return et=new Pr(et),new Pr(this.toString()+et.toString())}decapsulate(et){const tt=et.toString(),nt=this.toString(),rt=nt.lastIndexOf(tt);if(rt<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${et.toString()}`);return new Pr(nt.slice(0,rt))}decapsulateCode(et){const tt=this.tuples();for(let nt=tt.length-1;nt>=0;nt--)if(tt[nt][0]===et)return new Pr(tuplesToBytes(tt.slice(0,nt)));return this}getPeerId(){try{let et=[];this.stringTuples().forEach(([nt,rt])=>{nt===names.p2p.code&&et.push([nt,rt]),nt===names["p2p-circuit"].code&&(et=[])});const tt=et.pop();if((tt==null?void 0:tt[1])!=null){const nt=tt[1];return nt[0]==="Q"||nt[0]==="1"?toString$8(base58btc.decode(`z${nt}`),"base58btc"):toString$8(CID.parse(nt).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return jt(this,ao)}equals(et){return equals(this.bytes,et.bytes)}async resolve(et){const tt=this.protos().find(ot=>ot.resolvable);if(tt==null)return[this];const nt=resolvers$1.get(tt.name);if(nt==null)throw new NoAvailableResolverError(`no available resolver for ${tt.name}`);return(await nt(this,et)).map(ot=>multiaddr(ot))}nodeAddress(){const et=this.toOptions();if(et.transport!=="tcp"&&et.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${et.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:et.family,address:et.host,port:et.port}}isThinWaistAddress(et){const tt=(et??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(${jt(this,Kr)})`}};Kr=new WeakMap,xr=new WeakMap,so=new WeakMap,ao=new WeakMap;let Multiaddr=Pr;const resolvers$1=new Map;function isMultiaddr(o){return!!(o!=null&&o[symbol])}function multiaddr(o){return new Multiaddr(o)}var Protocols$1;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols$1||(Protocols$1={}));var ProtocolError$1;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags$1;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags$1||(Tags$1={}));var EPeersByDiscoveryEvents$1;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents$1||(EPeersByDiscoveryEvents$1={}));var EConnectionStateEvents$1;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents$1||(EConnectionStateEvents$1={}));const DEFAULT_CLUSTER_ID=1,DefaultShardInfo={clusterId:DEFAULT_CLUSTER_ID,shards:[0,1,2,3,4,5,6,7,8]},DefaultNetworkConfig=DefaultShardInfo;var HealthStatus$1;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus$1||(HealthStatus$1={}));const E_CANCELED=new Error("request for lock canceled");var __awaiter$2=function(o,et,tt,nt){function rt(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(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Semaphore{constructor(et,tt=E_CANCELED){this._value=et,this._cancelError=tt,this._queue=[],this._weightedWaiters=[]}acquire(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return new Promise((nt,rt)=>{const ot={resolve:nt,reject:rt,weight:et,priority:tt},it=findIndexFromEnd(this._queue,st=>tt<=st.priority);it===-1&&et<=this._value?this._dispatchItem(ot):this._queue.splice(it+1,0,ot)})}runExclusive(et){return __awaiter$2(this,arguments,void 0,function*(tt,nt=1,rt=0){const[ot,it]=yield this.acquire(nt,rt);try{return yield tt(ot)}finally{it()}})}waitForUnlock(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return this._couldLockImmediately(et,tt)?Promise.resolve():new Promise(nt=>{this._weightedWaiters[et-1]||(this._weightedWaiters[et-1]=[]),insertSorted(this._weightedWaiters[et-1],{resolve:nt,priority:tt})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(et){this._value=et,this._dispatchQueue()}release(et=1){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);this._value+=et,this._dispatchQueue()}cancel(){this._queue.forEach(et=>et.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(et){const tt=this._value;this._value-=et.weight,et.resolve([tt,this._newReleaser(et.weight)])}_newReleaser(et){let tt=!1;return()=>{tt||(tt=!0,this.release(et))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let et=this._value;et>0;et--){const tt=this._weightedWaiters[et-1];tt&&(tt.forEach(nt=>nt.resolve()),this._weightedWaiters[et-1]=[])}else{const et=this._queue[0].priority;for(let tt=this._value;tt>0;tt--){const nt=this._weightedWaiters[tt-1];if(!nt)continue;const rt=nt.findIndex(ot=>ot.priority<=et);(rt===-1?nt:nt.splice(0,rt)).forEach(ot=>ot.resolve())}}}_couldLockImmediately(et,tt){return(this._queue.length===0||this._queue[0].priorityet.priority<=nt.priority);o.splice(tt+1,0,et)}function findIndexFromEnd(o,et){for(let tt=o.length-1;tt>=0;tt--)if(et(o[tt]))return tt;return-1}var __awaiter$1=function(o,et,tt,nt){function rt(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(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Mutex{constructor(et){this._semaphore=new Semaphore(1,et)}acquire(){return __awaiter$1(this,arguments,void 0,function*(et=0){const[,tt]=yield this._semaphore.acquire(1,et);return tt})}runExclusive(et,tt=0){return this._semaphore.runExclusive(()=>et(),1,tt)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(et=0){return this._semaphore.waitForUnlock(1,et)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class PeerManager{constructor(et,tt,nt){Ct(this,"connectionManager");Ct(this,"core");Ct(this,"log");Ct(this,"peers",new Map);Ct(this,"healthManager");Ct(this,"readMutex",new Mutex);Ct(this,"writeMutex",new Mutex);Ct(this,"writeLockHolder",null);this.connectionManager=et,this.core=tt,this.log=nt,this.healthManager=getHealthManager(),this.healthManager.updateProtocolHealth(this.core.multicodec,0)}getWriteLockHolder(){return this.writeLockHolder}getPeers(){return Array.from(this.peers.values())}async addPeer(et){return this.writeMutex.runExclusive(async()=>{this.writeLockHolder=`addPeer: ${et.id.toString()}`,await this.connectionManager.attemptDial(et.id),this.peers.set(et.id.toString(),et),this.log.info(`Added and dialed peer: ${et.id.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async removePeer(et){return this.writeMutex.runExclusive(()=>{this.writeLockHolder=`removePeer: ${et.toString()}`,this.peers.delete(et.toString()),this.log.info(`Removed peer: ${et.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(et){this.log.info(`Removing ${et} excess peer(s)`);const tt=Array.from(this.peers.values()).slice(0,et);for(const nt of tt)await this.removePeer(nt.id)}async findAndAddPeers(et){const tt=await this.findPeers(et);return tt.length===0?(this.log.warn("No additional peers found"),[]):this.addMultiplePeers(tt)}async findPeers(et){const tt=await this.core.getPeers();return this.readMutex.runExclusive(async()=>tt.filter(rt=>!this.peers.has(rt.id.toString())).slice(0,et))}async addMultiplePeers(et){const tt=[];for(const nt of et)await this.addPeer(nt),tt.push(nt);return tt}}const DEFAULT_NUM_PEERS_TO_USE=2,DEFAULT_MAINTAIN_PEERS_INTERVAL=3e4;class BaseProtocolSDK{constructor(et,tt,nt){Ct(this,"core");Ct(this,"connectionManager");Ct(this,"peerManager");Ct(this,"numPeersToUse");Ct(this,"maintainPeersIntervalId",null);Ct(this,"log");this.core=et,this.connectionManager=tt,this.log=new Logger$1(`sdk:${et.multicodec}`),this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE;const rt=(nt==null?void 0:nt.maintainPeersInterval)??DEFAULT_MAINTAIN_PEERS_INTERVAL;this.peerManager=new PeerManager(tt,et,this.log),this.log.info(`Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${rt}ms`),this.startMaintainPeersInterval(rt)}get connectedPeers(){return this.peerManager.getPeers().slice(0,this.numPeersToUse)}async renewPeer(et){this.log.info(`Attempting to renew peer ${et}`);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(et),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(et={}){const{forceUseAllPeers:tt=!1,maxAttempts:nt=3}=et;this.log.info(`Checking for peers. forceUseAllPeers: ${tt}, maxAttempts: ${nt}`);for(let rt=0;rt0)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 ${nt} attempts`),!1}async startMaintainPeersInterval(et){this.log.info(`Starting maintain peers interval with ${et}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)})},et),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 et=await this.peerManager.getPeerCount(),tt=this.numPeersToUse-et;if(this.log.info(`Current peer count: ${et}, 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 nt=await this.peerManager.getPeerCount();this.log.info(`Peer maintenance completed. Initial count: ${et}, Final count: ${nt}`)}catch(et){this.log.error("Error during peer maintenance",{error:et})}}}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(o,et){const tt=utf8ToBytes$1(o),nt=utf8ToBytes$1(et.contentTopic),rt=tryConvertTimestampToBytes(et.timestamp),ot=concat$2([tt,et.payload,nt,et.meta,rt].filter(isDefined));return sha256$2(ot)}function tryConvertTimestampToBytes(o){if(!o)return;let et;return typeof o=="bigint"?et=o:et=BigInt(o.valueOf())*1000000n,numberToBytes(et)}function messageHashStr(o,et){const tt=messageHash(o,et);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(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"getContentTopics");Ct(this,"protocolSubscribe");Ct(this,"addLibp2pEventListener");Ct(this,"sendLightPushMessage");Ct(this,"receivedMessagesFormPeer",new Set);Ct(this,"receivedMessages",new Set);Ct(this,"scheduledVerification",new Map);Ct(this,"verifiedPeers",new Set);Ct(this,"peerFailures",new Map);Ct(this,"maxPingFailures",DEFAULT_MAX_PINGS);Ct(this,"peerRenewalLocks",new Set);this.pubsubTopic=et,this.getPeers=tt,this.renewPeer=nt,this.getContentTopics=rt,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(et){et!==void 0&&(this.maxPingFailures=et)}async handlePingResult(et,tt){if(tt!=null&&tt.success){this.peerFailures.delete(et.toString());return}const nt=(this.peerFailures.get(et.toString())||0)+1;if(this.peerFailures.set(et.toString(),nt),nt>=this.maxPingFailures)try{log$h.info(`Attempting to renew ${et.toString()} due to ping failures.`),await this.renewAndSubscribePeer(et),this.peerFailures.delete(et.toString())}catch(rt){log$h.error(`Failed to renew peer ${et.toString()}: ${rt}.`)}}notifyMessageReceived(et,tt){const nt=this.buildMessageHash(tt);return this.verifiedPeers.add(et),this.receivedMessagesFormPeer.add(`${et}-${nt}`),log$h.info(`notifyMessage received debug: ephemeral:${tt.ephemeral} ${bytesToUtf8(tt.payload)}`),log$h.info(`notifyMessage received: peer:${et} message:${nt}`),this.receivedMessages.has(nt)?!0:(this.receivedMessages.add(nt),!1)}notifyMessageSent(et,tt){const nt=et.toString(),rt=this.buildMessageHash(tt);if(log$h.info(`notifyMessage sent debug: ${bytesToUtf8(tt.payload)}`),this.scheduledVerification.has(nt)){log$h.warn(`notifyMessage sent: attempting to schedule verification for pending peer:${nt} message:${rt}`);return}const ot=setTimeout(async()=>{const it=this.verifiedPeers.has(nt),st=this.receivedMessagesFormPeer.has(`${nt}-${rt}`);if(it||st){log$h.info(`notifyMessage sent setTimeout: verified that peer pushes filter messages, peer:${nt} message:${rt}`);return}log$h.warn(`notifyMessage sent setTimeout: peer didn't return probe message, attempting renewAndSubscribe, peer:${nt} message:${rt}`),this.scheduledVerification.delete(nt),await this.renewAndSubscribePeer(et)},MESSAGE_VERIFICATION_DELAY);this.scheduledVerification.set(nt,ot)}shouldVerifyPeer(et){const tt=et.toString(),nt=this.verifiedPeers.has(tt),rt=this.scheduledVerification.has(tt);return!(nt||rt)}buildMessageHash(et){return messageHashStr(this.pubsubTopic,et)}async renewAndSubscribePeer(et){const tt=et.toString();try{if(this.peerRenewalLocks.has(tt)){log$h.info(`Peer ${tt} is already being renewed.`);return}this.peerRenewalLocks.add(tt);const nt=await this.renewPeer(et);if(!nt){log$h.warn(`Failed to renew peer ${tt}: No new peer found.`);return}return await this.protocolSubscribe(this.pubsubTopic,nt,this.getContentTopics()),await this.sendLightPushMessage(nt),this.peerFailures.delete(tt),nt}catch(nt){log$h.error(`Failed to renew peer ${tt}: ${nt}.`);return}finally{this.peerRenewalLocks.delete(tt)}}}const Lr=class Lr{static createReceiverMonitor(et,tt,nt,rt,ot,it,st){if(Lr.receiverMonitors.has(et))return Lr.receiverMonitors.get(et);const at=new ReceiverReliabilityMonitor(et,tt,nt,rt,ot,it,st);return Lr.receiverMonitors.set(et,at),at}constructor(){}static stop(et){this.receiverMonitors.delete(et)}static stopAll(){for(const[et,tt]of this.receiverMonitors)tt.setMaxPingFailures(void 0),this.receiverMonitors.delete(et)}};Ct(Lr,"receiverMonitors",new Map);let ReliabilityMonitorManager=Lr;const log$g=new Logger$1("sdk:filter:subscription_manager");class SubscriptionManager{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"protocol");Ct(this,"connectionManager");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"reliabilityMonitor");Ct(this,"keepAliveTimeout",DEFAULT_KEEP_ALIVE);Ct(this,"keepAliveInterval",null);Ct(this,"enableLightPushFilterCheck",DEFAULT_LIGHT_PUSH_FILTER_CHECK);Ct(this,"subscriptionCallbacks");this.pubsubTopic=et,this.protocol=tt,this.connectionManager=nt,this.getPeers=rt,this.renewPeer=ot,this.libp2p=it,this.lightPush=st,this.pubsubTopic=et,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(et,tt,nt=DEFAULT_SUBSCRIBE_OPTIONS){this.reliabilityMonitor.setMaxPingFailures(nt.pingsBeforePeerRenewed),this.keepAliveTimeout=nt.keepAlive||DEFAULT_KEEP_ALIVE,this.enableLightPushFilterCheck=(nt==null?void 0:nt.enableLightPushFilterCheck)||DEFAULT_LIGHT_PUSH_FILTER_CHECK;const rt=Array.isArray(et)?et:[et];for(const lt of rt)if(lt.pubsubTopic!==this.pubsubTopic)return{failures:[{error:ProtocolError$1.TOPIC_DECODER_MISMATCH}],successes:[]};this.enableLightPushFilterCheck&&rt.push(createDecoder(this.buildLightPushContentTopic(),this.pubsubTopic));const ot=groupByContentTopic(rt),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(et){const tt=this.getPeers().map(async ot=>{const it=await this.protocol.unsubscribe(this.pubsubTopic,ot,et);return et.forEach(st=>{this.subscriptionCallbacks.delete(st)}),it}),nt=await Promise.allSettled(tt),rt=this.handleResult(nt,"unsubscribe");return this.subscriptionCallbacks.size===0&&this.stopSubscriptionsMaintenance(),rt}async ping(et){log$g.info("Sending keep-alive ping");const nt=(et?[et]:this.getPeers().map(ot=>ot.id)).map(ot=>this.pingSpecificPeer(ot)),rt=await Promise.allSettled(nt);return this.handleResult(rt,"ping")}async unsubscribeAll(){const et=this.getPeers().map(async rt=>this.protocol.unsubscribeAll(this.pubsubTopic,rt)),tt=await Promise.allSettled(et);this.subscriptionCallbacks.clear();const nt=this.handleResult(tt,"unsubscribeAll");return this.stopSubscriptionsMaintenance(),nt}async processIncomingMessage(et,tt){if(this.reliabilityMonitor.notifyMessageReceived(tt,et)){log$g.info("Message already received, skipping");return}const{contentTopic:rt}=et,ot=this.subscriptionCallbacks.get(rt);if(!ot){log$g.error("No subscription callback available for ",rt);return}log$g.info("Processing message with content topic ",rt," on pubsub topic ",this.pubsubTopic),await pushMessage(ot,this.pubsubTopic,et)}async subscribeWithPeerVerification(et,tt){const nt=await this.protocol.subscribe(this.pubsubTopic,et,tt);return await this.sendLightPushCheckMessage(et),nt}handleResult(et,tt){const nt={failures:[],successes:[]};for(const rt of et)if(rt.status==="rejected")log$g.error(`Failed to resolve ${tt} promise successfully: `,rt.reason),nt.failures.push({error:ProtocolError$1.GENERIC_FAIL});else{const ot=rt.value;ot.failure?nt.failures.push(ot.failure):nt.successes.push(ot.success)}return nt}async pingSpecificPeer(et){var rt,ot;const tt=this.getPeers().find(it=>it.id.equals(et));if(!tt)return{success:null,failure:{peerId:et,error:ProtocolError$1.NO_PEER_AVAILABLE}};let nt;try{nt=await this.protocol.ping(tt)}catch{nt={success:null,failure:{peerId:et,error:ProtocolError$1.GENERIC_FAIL}}}return log$g.info(`Received result from filter ping peerId:${et.toString()} success:${(rt=nt.success)==null?void 0:rt.toString()} failure:${(ot=nt.failure)==null?void 0:ot.error}`),await this.reliabilityMonitor.handlePingResult(et,nt),nt}startSubscriptionsMaintenance(et){log$g.info("Starting subscriptions maintenance"),this.startKeepAlivePings(et),this.startConnectionListener()}stopSubscriptionsMaintenance(){log$g.info("Stopping subscriptions maintenance"),this.stopKeepAlivePings(),this.stopConnectionListener()}startConnectionListener(){this.connectionManager.addEventListener(EConnectionStateEvents$1.CONNECTION_STATUS,this.connectionListener.bind(this))}stopConnectionListener(){this.connectionManager.removeEventListener(EConnectionStateEvents$1.CONNECTION_STATUS,this.connectionListener.bind(this))}async connectionListener({detail:et}){if(!et){this.stopKeepAlivePings();return}try{await this.ping()}catch(tt){log$g.error(`networkStateListener failed to recover: ${tt}`)}this.startKeepAlivePings(this.keepAliveTimeout)}startKeepAlivePings(et){if(this.keepAliveInterval){log$g.info("Recurring pings already set up.");return}this.keepAliveInterval=setInterval(()=>{this.ping()},et)}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(et){if(this.lightPush&&this.libp2p&&this.reliabilityMonitor.shouldVerifyPeer(et.id)){const tt=createEncoder({contentTopic:this.buildLightPushContentTopic(),pubsubTopic:this.pubsubTopic,ephemeral:!0}),nt={payload:new Uint8Array(1)},rt=await tt.toProtoObj(nt);setTimeout(async()=>{const ot=await this.lightPush.protocol.send(tt,nt,et);if(this.reliabilityMonitor.notifyMessageSent(et.id,rt),ot.failure){log$g.error(`failed to send lightPush ping message to peer:${et.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(o,et,tt){const{decoders:nt,callback:rt}=o,{contentTopic:ot}=tt;if(!ot){log$g.warn("Message has no content topic, skipping");return}try{const it=nt.map(at=>at.fromProtoObj(et,tt).then(ct=>ct||Promise.reject("Decoding failed"))),st=await Promise.any(it);await rt(st)}catch(it){log$g.error("Error decoding message",it)}}const log$f=new Logger$1("sdk:filter");class Filter extends BaseProtocolSDK{constructor(tt,nt,rt,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,nt),tt,{numPeersToUse:ot==null?void 0:ot.numPeersToUse});Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"protocol");Ct(this,"activeSubscriptions",new Map);this.libp2p=nt,this.lightPush=rt,this.protocol=this.core,this.activeSubscriptions=new Map}async subscribe(tt,nt,rt,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,rt);if(ct)return{subscription:null,error:ct,results:null};const{failures:lt,successes:dt}=await at.subscribe(tt,nt,ot);return{subscription:at,error:null,results:{failures:lt,successes:dt}}}async createSubscription(tt,nt){var st;nt={autoRetry:!0,...nt};const rt=typeof tt=="string"?tt:(st=shardInfoToPubsubTopics(tt))==null?void 0:st[0];return ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics),await this.hasPeers(nt)?(log$f.info(`Creating filter subscription with ${this.connectedPeers.length} peers: `,this.connectedPeers.map(at=>at.id.toString())),{error:null,subscription:this.getActiveSubscription(rt)??this.setActiveSubscription(rt,new SubscriptionManager(rt,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,nt,rt=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,nt,rt);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,nt){return this.activeSubscriptions.set(tt,nt),nt}getUniquePubsubTopics(tt){return Array.isArray(tt)?tt.length===0?[]:[...new Set(tt.map(rt=>rt.pubsubTopic))]:[tt.pubsubTopic]}}function wakuFilter(o,et,tt){return nt=>new Filter(o,nt,et,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(et,tt,nt){Ct(this,"libp2p");Ct(this,"numPeersToUse",DEFAULT_NUM_PEERS_TO_USE);Ct(this,"protocol");this.libp2p=tt,this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE,this.protocol=new LightPushCore(et.configuredPubsubTopics,tt)}async send(et,tt,nt=DEFAULT_SEND_OPTIONS){const rt=[],ot=[],{pubsubTopic:it}=et;try{ensurePubsubTopicIsConfigured(it,this.protocol.pubsubTopics)}catch{return log$e.error("Failed to send waku light push: pubsub topic not configured"),{successes:rt,failures:[{error:ProtocolError$1.TOPIC_NOT_CONFIGURED}]}}const st=await this.getConnectedPeers();if(st.length===0)return{successes:rt,failures:[{error:ProtocolError$1.NO_PEER_AVAILABLE}]};const at=await Promise.allSettled(st.map(ct=>this.protocol.send(et,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){rt.push(dt);continue}lt&&(ot.push(lt),nt!=null&&nt.autoRetry&&this.attemptRetries(ht=>this.protocol.send(et,tt,ht),nt.maxAttempts))}return getHealthManager().updateProtocolHealth(this.protocol.multicodec,rt.length),{successes:rt,failures:ot}}async attemptRetries(et,tt){var rt;tt=tt||DEFAULT_MAX_ATTEMPTS;const nt=await this.getConnectedPeers();if(nt.length===0){log$e.warn("Cannot retry with no connected peers.");return}for(let ot=0;ot{try{return await this.libp2p.peerStore.get(nt)}catch{return null}}))).filter(nt=>!!nt).filter(nt=>nt.protocols.includes(LightPushCodec)).slice(0,this.numPeersToUse)}}function wakuLightPush(o,et={}){return tt=>new LightPush(o,tt,et)}const DEFAULT_NUM_PEERS=1,log$d=new Logger$1("waku:store:sdk");class Store extends BaseProtocolSDK{constructor(tt,nt,rt){super(new StoreCore(tt.configuredPubsubTopics,nt),tt,{numPeersToUse:DEFAULT_NUM_PEERS});Ct(this,"peerIdStrToUse");Ct(this,"protocol");this.peerIdStrToUse=rt,this.protocol=this.core}async*queryGenerator(tt,nt){const{pubsubTopic:rt,contentTopics:ot,decodersAsMap:it}=this.validateDecodersAndPubsubTopic(tt),st={pubsubTopic:rt,contentTopics:ot,includeData:!0,paginationForward:!0,...nt},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(nt)}`);const ct=this.protocol.queryPerPage(st,it,at);for await(const lt of ct)yield lt}async queryWithOrderedCallback(tt,nt,rt){log$d.info("Querying store with ordered callback");for await(const ot of this.queryGenerator(tt,rt))if(await this.processMessages(ot,nt))break}async queryWithPromiseCallback(tt,nt,rt){log$d.info("Querying store with promise callback");let ot=!1;for await(const it of this.queryGenerator(tt,rt)){const st=it.map(async at=>{ot||(ot=!!await nt(at))});if(await Promise.all(st),ot)break}}async processMessages(tt,nt){let rt=!1;const it=(await Promise.all(tt)).filter(isDefined);return await Promise.all(it.map(async st=>{st&&!rt&&(rt=!!await nt(st))})),rt}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 nt=Array.from(new Set(tt.map(st=>st.pubsubTopic)));if(nt.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 rt=nt[0];ensurePubsubTopicIsConfigured(rt,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===rt).map(st=>st.contentTopic);if(it.length===0)throw log$d.error(`No decoders found for topic ${rt}`),new Error("No decoders found for topic "+rt);return{pubsubTopic:rt,contentTopics:it,decodersAsMap:ot}}}function wakuStore(o,et){return tt=>new Store(o,tt,et)}const log$c=new Logger$1("wait-for-remote-peer");async function waitForRemotePeer(o,et,tt){et=et!=null&&et.length?et:getEnabledProtocols(o);const nt=o.libp2p.getConnections();if(!o.isStarted())throw Error("Waku node is not started");for(const ot of et)switch(ot){case Protocols$1.Relay:if(!o.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");break;case Protocols$1.LightPush:if(!o.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");break;case Protocols$1.Store:if(!o.store)throw Error("Cannot wait for Store peer: protocol not mounted");break;case Protocols$1.Filter:if(!o.filter)throw Error("Cannot wait for Filter peer: protocol not mounted");break}const rt=[waitForProtocols(o,et)];nt.length>0&&!et.includes(Protocols$1.Relay)&&rt.push(waitForMetadata(o,et)),tt?await rejectOnTimeout(Promise.any(rt),tt,"Timed out waiting for a remote peer."):await Promise.any(rt)}async function waitForProtocols(o,et){const tt=[];return o.relay&&et.includes(Protocols$1.Relay)&&tt.push(o.relay.waitForPeers()),o.store&&et.includes(Protocols$1.Store)&&tt.push(waitForConnectedPeer(StoreCodec,o.libp2p)),o.lightPush&&et.includes(Protocols$1.LightPush)&&tt.push(waitForConnectedPeer(LightPushCodec,o.libp2p)),o.filter&&et.includes(Protocols$1.Filter)&&tt.push(waitForConnectedPeer(FilterCodecs.SUBSCRIBE,o.libp2p)),Promise.all(tt)}async function waitForConnectedPeer(o,et){log$c.info(`Waiting for ${o} peer.`),await new Promise(tt=>{const nt=async rt=>{var ot,it;if((it=(ot=rt.detail)==null?void 0:ot.protocols)!=null&&it.includes(o)){const st=et.services.metadata;if(!st){et.removeEventListener("peer:identify",nt),tt();return}try{await st.confirmOrAttemptHandshake(rt.detail.peerId),et.removeEventListener("peer:identify",nt),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}`)}}};et.addEventListener("peer:identify",nt)})}async function waitForMetadata(o,et){const tt=o.libp2p.getPeers(),nt=o.libp2p.services.metadata,rt=mapProtocolsToCodecs(et);if(!tt.length||!nt){log$c.info(`Skipping waitForMetadata due to missing connections:${tt.length} or metadataService:${!!nt}`);return}for(const ot of tt)try{const it=await o.libp2p.peerStore.get(ot);if(it.protocols.some(at=>rt.has(at))&&!(await nt.confirmOrAttemptHandshake(ot)).error&&(it.protocols.forEach(lt=>{rt.has(lt)&&rt.set(lt,!0)}),Array.from(rt.values()).every(lt=>lt)))return}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}}const awaitTimeout=(o,et)=>new Promise((tt,nt)=>setTimeout(()=>nt(Error(et)),o));async function rejectOnTimeout(o,et,tt){await Promise.race([o,awaitTimeout(et,tt)])}function getEnabledProtocols(o){const et=[];return o.relay&&et.push(Protocols$1.Relay),o.filter&&et.push(Protocols$1.Filter),o.store&&et.push(Protocols$1.Store),o.lightPush&&et.push(Protocols$1.LightPush),et}function mapProtocolsToCodecs(o){const et=new Map,tt={[Protocols$1.Filter]:FilterCodecs.SUBSCRIBE,[Protocols$1.LightPush]:LightPushCodec,[Protocols$1.Store]:StoreCodec};for(const nt of o)tt[nt]&&et.set(tt[nt],!1);return et}const DefaultPingKeepAliveValueSecs=5*60,DefaultRelayKeepAliveValueSecs=5*60,DefaultUserAgent="js-waku",DefaultPingMaxInboundStreams=10,log$b=new Logger$1("waku");class WakuNode{constructor(et,tt,nt,rt,ot){Ct(this,"pubsubTopics");Ct(this,"libp2p");Ct(this,"relay");Ct(this,"store");Ct(this,"filter");Ct(this,"lightPush");Ct(this,"connectionManager");Ct(this,"health");var ct;this.pubsubTopics=et,this.relay=ot,this.libp2p=nt,rt={filter:!1,lightpush:!1,store:!1,...rt};const it=tt.pingKeepAlive||DefaultPingKeepAliveValueSecs,st=this.relay?tt.relayKeepAlive||DefaultRelayKeepAliveValueSecs:0,at=this.libp2p.peerId.toString();if(this.connectionManager=ConnectionManager.create(at,nt,{pingKeepAlive:it,relayKeepAlive:st},this.pubsubTopics,this.relay),this.health=getHealthManager(),rt.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(nt)}if(rt.lightpush){const lt=wakuLightPush(this.connectionManager,tt);this.lightPush=lt(nt)}if(rt.filter){const lt=wakuFilter(this.connectionManager,this.lightPush,tt);this.filter=lt(nt)}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(et,tt){const nt=tt??[],rt=this.mapToPeerIdOrMultiaddr(et);typeof tt>"u"&&(this.relay&&nt.push(Protocols$1.Relay),this.store&&nt.push(Protocols$1.Store),this.filter&&nt.push(Protocols$1.Filter),this.lightPush&&nt.push(Protocols$1.LightPush));const ot=[];return nt.includes(Protocols$1.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")),nt.includes(Protocols$1.Store)&&(this.store?ot.push(this.store.protocol.multicodec):log$b.error("Store codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols$1.LightPush)&&(this.lightPush?ot.push(this.lightPush.protocol.multicodec):log$b.error("Light Push codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols$1.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 ${rt.toString()} with protocols ${nt}`),this.libp2p.dialProtocol(rt,ot)}async start(){await this.libp2p.start()}async stop(){ReliabilityMonitorManager.stopAll(),this.connectionManager.stop(),await this.libp2p.stop()}async waitForPeers(et,tt){return waitForRemotePeer(this,et,tt)}isStarted(){return this.libp2p.status=="started"}isConnected(){return this.connectionManager.isConnected()}async dialMultiaddr(et,tt){const nt=multiaddr(et);if(!nt.getPeerId())throw new Error("Failed to dial multiaddr: missing peer ID");return await this.libp2p.dialProtocol(nt,[tt]),nt.getPeerId()}mapToPeerIdOrMultiaddr(et){return isPeerId$2(et)?et:multiaddr(et)}}var us;let InvalidParametersError$3=(us=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(us,"name","InvalidParametersError"),us);class InvalidPublicKeyError extends Error{constructor(et="Invalid public key"){super(et),this.name="InvalidPublicKeyError"}}Ct(InvalidPublicKeyError,"name","InvalidPublicKeyError");var ds;let UnsupportedKeyTypeError$1=(ds=class extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}},Ct(ds,"name","UnsupportedKeyTypeError"),ds);/*! 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(o){const et=validateBasic(o);return validateObject(o,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...et})}function twistedEdwards(o){const et=validateOpts$1(o),{Fp:tt,n:nt,prehash:rt,hash:ot,randomBytes:it,nByteLength:st,h:at}=et,ct=_2n$2<{try{return{isValid:!0,value:tt.sqrt(Yt*tt.inv(Ht))}}catch{return{isValid:!1,value:_0n$2}}}),ft=et.adjustScalarBytes||(Yt=>Yt),mt=et.domain||((Yt,Ht,Ut)=>{if(abool("phflag",Ut),Ht.length||Ut)throw new Error("Contexts/pre-hash are not supported");return Yt});function pt(Yt,Ht){aInRange("coordinate "+Yt,Ht,_0n$2,ct)}function yt(Yt){if(!(Yt instanceof vt))throw new Error("ExtendedPoint expected")}const gt=memoized((Yt,Ht)=>{const{ex:Ut,ey:qt,ez:Pt}=Yt,Zt=Yt.is0();Ht==null&&(Ht=Zt?_8n$2:tt.inv(Pt));const Qt=lt(Ut*Ht),Lt=lt(qt*Ht),Gt=lt(Pt*Ht);if(Zt)return{x:_0n$2,y:_1n$3};if(Gt!==_1n$3)throw new Error("invZ was invalid");return{x:Qt,y:Lt}}),xt=memoized(Yt=>{const{a:Ht,d:Ut}=et;if(Yt.is0())throw new Error("bad point: ZERO");const{ex:qt,ey:Pt,ez:Zt,et:Qt}=Yt,Lt=lt(qt*qt),Gt=lt(Pt*Pt),nn=lt(Zt*Zt),Wt=lt(nn*nn),hn=lt(Lt*Ht),Xt=lt(nn*lt(hn+Gt)),Jt=lt(Wt+lt(Ut*lt(Lt*Gt)));if(Xt!==Jt)throw new Error("bad point: equation left != right (1)");const tn=lt(qt*Pt),Tt=lt(Zt*Qt);if(tn!==Tt)throw new Error("bad point: equation left != right (2)");return!0});class vt{constructor(Ht,Ut,qt,Pt){this.ex=Ht,this.ey=Ut,this.ez=qt,this.et=Pt,pt("x",Ht),pt("y",Ut),pt("z",qt),pt("t",Pt),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Ht){if(Ht instanceof vt)throw new Error("extended point not allowed");const{x:Ut,y:qt}=Ht||{};return pt("x",Ut),pt("y",qt),new vt(Ut,qt,_1n$3,lt(Ut*qt))}static normalizeZ(Ht){const Ut=tt.invertBatch(Ht.map(qt=>qt.ez));return Ht.map((qt,Pt)=>qt.toAffine(Ut[Pt])).map(vt.fromAffine)}static msm(Ht,Ut){return pippenger(vt,dt,Ht,Ut)}_setWindowSize(Ht){wt.setWindowSize(this,Ht)}assertValidity(){xt(this)}equals(Ht){yt(Ht);const{ex:Ut,ey:qt,ez:Pt}=this,{ex:Zt,ey:Qt,ez:Lt}=Ht,Gt=lt(Ut*Lt),nn=lt(Zt*Pt),Wt=lt(qt*Lt),hn=lt(Qt*Pt);return Gt===nn&&Wt===hn}is0(){return this.equals(vt.ZERO)}negate(){return new vt(lt(-this.ex),this.ey,this.ez,lt(-this.et))}double(){const{a:Ht}=et,{ex:Ut,ey:qt,ez:Pt}=this,Zt=lt(Ut*Ut),Qt=lt(qt*qt),Lt=lt(_2n$2*lt(Pt*Pt)),Gt=lt(Ht*Zt),nn=Ut+qt,Wt=lt(lt(nn*nn)-Zt-Qt),hn=Gt+Qt,Xt=hn-Lt,Jt=Gt-Qt,tn=lt(Wt*Xt),Tt=lt(hn*Jt),Dt=lt(Wt*Jt),Vt=lt(Xt*hn);return new vt(tn,Tt,Vt,Dt)}add(Ht){yt(Ht);const{a:Ut,d:qt}=et,{ex:Pt,ey:Zt,ez:Qt,et:Lt}=this,{ex:Gt,ey:nn,ez:Wt,et:hn}=Ht;if(Ut===BigInt(-1)){const mn=lt((Zt-Pt)*(nn+Gt)),wn=lt((Zt+Pt)*(nn-Gt)),_n=lt(wn-mn);if(_n===_0n$2)return this.double();const $n=lt(Qt*_2n$2*hn),yn=lt(Lt*_2n$2*Wt),En=yn+$n,on=wn+mn,_t=yn-$n,St=lt(En*_n),At=lt(on*_t),Ot=lt(En*_t),Kt=lt(_n*on);return new vt(St,At,Kt,Ot)}const Xt=lt(Pt*Gt),Jt=lt(Zt*nn),tn=lt(Lt*qt*hn),Tt=lt(Qt*Wt),Dt=lt((Pt+Zt)*(Gt+nn)-Xt-Jt),Vt=Tt-tn,en=Tt+tn,an=lt(Jt-Ut*Xt),dn=lt(Dt*Vt),ln=lt(en*an),fn=lt(Dt*an),kn=lt(Vt*en);return new vt(dn,ln,kn,fn)}subtract(Ht){return this.add(Ht.negate())}wNAF(Ht){return wt.wNAFCached(this,Ht,vt.normalizeZ)}multiply(Ht){const Ut=Ht;aInRange("scalar",Ut,_1n$3,nt);const{p:qt,f:Pt}=this.wNAF(Ut);return vt.normalizeZ([qt,Pt])[0]}multiplyUnsafe(Ht){const Ut=Ht;return aInRange("scalar",Ut,_0n$2,nt),Ut===_0n$2?Et:this.equals(Et)||Ut===_1n$3?this:this.equals(bt)?this.wNAF(Ut).p:wt.unsafeLadder(this,Ut)}isSmallOrder(){return this.multiplyUnsafe(at).is0()}isTorsionFree(){return wt.unsafeLadder(this,nt).is0()}toAffine(Ht){return gt(this,Ht)}clearCofactor(){const{h:Ht}=et;return Ht===_1n$3?this:this.multiplyUnsafe(Ht)}static fromHex(Ht,Ut=!1){const{d:qt,a:Pt}=et,Zt=tt.BYTES;Ht=ensureBytes$1("pointHex",Ht,Zt),abool("zip215",Ut);const Qt=Ht.slice(),Lt=Ht[Zt-1];Qt[Zt-1]=Lt&-129;const Gt=bytesToNumberLE(Qt),nn=Ut?ct:tt.ORDER;aInRange("pointHex.y",Gt,_0n$2,nn);const Wt=lt(Gt*Gt),hn=lt(Wt-_1n$3),Xt=lt(qt*Wt-Pt);let{isValid:Jt,value:tn}=ht(hn,Xt);if(!Jt)throw new Error("Point.fromHex: invalid y coordinate");const Tt=(tn&_1n$3)===_1n$3,Dt=(Lt&128)!==0;if(!Ut&&tn===_0n$2&&Dt)throw new Error("Point.fromHex: x=0 and x_0=1");return Dt!==Tt&&(tn=lt(-tn)),vt.fromAffine({x:tn,y:Gt})}static fromPrivateKey(Ht){return Rt(Ht).point}toRawBytes(){const{x:Ht,y:Ut}=this.toAffine(),qt=numberToBytesLE(Ut,tt.BYTES);return qt[qt.length-1]|=Ht&_1n$3?128:0,qt}toHex(){return bytesToHex$2(this.toRawBytes())}}vt.BASE=new vt(et.Gx,et.Gy,_1n$3,lt(et.Gx*et.Gy)),vt.ZERO=new vt(_0n$2,_1n$3,_1n$3,_0n$2);const{BASE:bt,ZERO:Et}=vt,wt=wNAF(vt,st*8);function kt(Yt){return mod$1(Yt,nt)}function It(Yt){return kt(bytesToNumberLE(Yt))}function Rt(Yt){const Ht=st;Yt=ensureBytes$1("private key",Yt,Ht);const Ut=ensureBytes$1("hashed private key",ot(Yt),2*Ht),qt=ft(Ut.slice(0,Ht)),Pt=Ut.slice(Ht,2*Ht),Zt=It(qt),Qt=bt.multiply(Zt),Lt=Qt.toRawBytes();return{head:qt,prefix:Pt,scalar:Zt,point:Qt,pointBytes:Lt}}function $t(Yt){return Rt(Yt).pointBytes}function Nt(Yt=new Uint8Array,...Ht){const Ut=concatBytes$1(...Ht);return It(ot(mt(Ut,ensureBytes$1("context",Yt),!!rt)))}function Mt(Yt,Ht,Ut={}){Yt=ensureBytes$1("message",Yt),rt&&(Yt=rt(Yt));const{prefix:qt,scalar:Pt,pointBytes:Zt}=Rt(Ht),Qt=Nt(Ut.context,qt,Yt),Lt=bt.multiply(Qt).toRawBytes(),Gt=Nt(Ut.context,Lt,Zt,Yt),nn=kt(Qt+Gt*Pt);aInRange("signature.s",nn,_0n$2,nt);const Wt=concatBytes$1(Lt,numberToBytesLE(nn,tt.BYTES));return ensureBytes$1("result",Wt,st*2)}const Bt=VERIFY_DEFAULT;function zt(Yt,Ht,Ut,qt=Bt){const{context:Pt,zip215:Zt}=qt,Qt=tt.BYTES;Yt=ensureBytes$1("signature",Yt,2*Qt),Ht=ensureBytes$1("message",Ht),Zt!==void 0&&abool("zip215",Zt),rt&&(Ht=rt(Ht));const Lt=bytesToNumberLE(Yt.slice(Qt,2*Qt));let Gt,nn,Wt;try{Gt=vt.fromHex(Ut,Zt),nn=vt.fromHex(Yt.slice(0,Qt),Zt),Wt=bt.multiplyUnsafe(Lt)}catch{return!1}if(!Zt&&Gt.isSmallOrder())return!1;const hn=Nt(Pt,nn.toRawBytes(),Gt.toRawBytes(),Ht);return nn.add(Gt.multiplyUnsafe(hn)).subtract(Wt).clearCofactor().equals(vt.ZERO)}return bt._setWindowSize(8),{CURVE:et,getPublicKey:$t,sign:Mt,verify:zt,ExtendedPoint:vt,utils:{getExtendedPublicKey:Rt,randomPrivateKey:()=>it(tt.BYTES),precompute(Yt=8,Ht=vt.BASE){return Ht._setWindowSize(Yt),Ht.multiply(BigInt(3)),Ht}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function validateOpts(o){return validateObject(o,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...o})}function montgomery(o){const et=validateOpts(o),{P:tt}=et,nt=xt=>mod$1(xt,tt),rt=et.montgomeryBits,ot=Math.ceil(rt/8),it=et.nByteLength,st=et.adjustScalarBytes||(xt=>xt),at=et.powPminus2||(xt=>pow(xt,tt-BigInt(2),tt));function ct(xt,vt,bt){const Et=nt(xt*(vt-bt));return vt=nt(vt-Et),bt=nt(bt+Et),[vt,bt]}const lt=(et.a-BigInt(2))/BigInt(4);function dt(xt,vt){aInRange("u",xt,_0n$1,tt),aInRange("scalar",vt,_0n$1,tt);const bt=vt,Et=xt;let wt=_1n$2,kt=_0n$1,It=xt,Rt=_1n$2,$t=_0n$1,Nt;for(let Bt=BigInt(rt-1);Bt>=_0n$1;Bt--){const zt=bt>>Bt&_1n$2;$t^=zt,Nt=ct($t,wt,It),wt=Nt[0],It=Nt[1],Nt=ct($t,kt,Rt),kt=Nt[0],Rt=Nt[1],$t=zt;const Ft=wt+kt,Yt=nt(Ft*Ft),Ht=wt-kt,Ut=nt(Ht*Ht),qt=Yt-Ut,Pt=It+Rt,Zt=It-Rt,Qt=nt(Zt*Ft),Lt=nt(Pt*Ht),Gt=Qt+Lt,nn=Qt-Lt;It=nt(Gt*Gt),Rt=nt(Et*nt(nn*nn)),wt=nt(Yt*Ut),kt=nt(qt*(Yt+nt(lt*qt)))}Nt=ct($t,wt,It),wt=Nt[0],It=Nt[1],Nt=ct($t,kt,Rt),kt=Nt[0],Rt=Nt[1];const Mt=at(kt);return nt(wt*Mt)}function ht(xt){return numberToBytesLE(nt(xt),ot)}function ft(xt){const vt=ensureBytes$1("u coordinate",xt,ot);return it===32&&(vt[31]&=127),bytesToNumberLE(vt)}function mt(xt){const vt=ensureBytes$1("scalar",xt),bt=vt.length;if(bt!==ot&&bt!==it)throw new Error(`Expected ${ot} or ${it} bytes, got ${bt}`);return bytesToNumberLE(st(vt))}function pt(xt,vt){const bt=ft(vt),Et=mt(xt),wt=dt(bt,Et);if(wt===_0n$1)throw new Error("Invalid private or public key received");return ht(wt)}const yt=ht(et.Gu);function gt(xt){return pt(xt,yt)}return{scalarMult:pt,scalarMultBase:gt,getSharedSecret:(xt,vt)=>pt(xt,vt),getPublicKey:xt=>gt(xt),utils:{randomPrivateKey:()=>et.randomBytes(et.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(o){const et=BigInt(10),tt=BigInt(20),nt=BigInt(40),rt=BigInt(80),ot=ED25519_P,st=o*o%ot*o%ot,at=pow2$1(st,_2n$1,ot)*st%ot,ct=pow2$1(at,_1n$1,ot)*o%ot,lt=pow2$1(ct,_5n,ot)*ct%ot,dt=pow2$1(lt,et,ot)*lt%ot,ht=pow2$1(dt,tt,ot)*dt%ot,ft=pow2$1(ht,nt,ot)*ht%ot,mt=pow2$1(ft,rt,ot)*ft%ot,pt=pow2$1(mt,rt,ot)*ft%ot,yt=pow2$1(pt,et,ot)*lt%ot;return{pow_p_5_8:pow2$1(yt,_2n$1,ot)*o%ot,b2:st}}function adjustScalarBytes(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function uvRatio(o,et){const tt=ED25519_P,nt=mod$1(et*et*et,tt),rt=mod$1(nt*nt*et,tt),ot=ed25519_pow_2_252_3(o*rt).pow_p_5_8;let it=mod$1(o*nt*ot,tt);const st=mod$1(et*it*it,tt),at=it,ct=mod$1(it*ED25519_SQRT_M1,tt),lt=st===o,dt=st===mod$1(-o,tt),ht=st===mod$1(-o*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:o=>{const et=ED25519_P,{pow_p_5_8:tt,b2:nt}=ed25519_pow_2_252_3(o);return mod$1(pow2$1(tt,_3n$1,et)*nt,et)},adjustScalarBytes,randomBytes:randomBytes$1}),PUBLIC_KEY_BYTE_LENGTH=32,PRIVATE_KEY_BYTE_LENGTH=64,KEYS_BYTE_LENGTH=32;function generateKey(){const o=ed25519.utils.randomPrivateKey(),et=ed25519.getPublicKey(o);return{privateKey:concatKeys(o,et),publicKey:et}}function hashAndSign(o,et){const tt=o.subarray(0,KEYS_BYTE_LENGTH);return ed25519.sign(et instanceof Uint8Array?et:et.subarray(),tt)}function hashAndVerify$2(o,et,tt){return ed25519.verify(et,tt instanceof Uint8Array?tt:tt.subarray(),o)}function concatKeys(o,et){const tt=new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);for(let nt=0;ntenumeration(__KeyTypeValues)})(KeyType||(KeyType={}));var PublicKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PublicKey||(PublicKey={}));var PrivateKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PrivateKey||(PrivateKey={}));/*! * MIT License * * Copyright (c) 2017-2022 Peculiar Ventures, LLC @@ -3930,31 +3930,31 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - */function assertBigInt(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function concat(o){let et=0,tt=0;for(let rt=0;rt=ot.length)return this.error="End of input reached before message was fully decoded",-1;if(at===lt){lt+=255;const ht=new Uint8Array(lt);for(let pt=0;pt8)return this.error="Too big integer",-1;if(it+1>ot.length)return this.error="End of input reached before message was fully decoded",-1;const st=tt+1,at=rt.subarray(st,st+it);return at[it-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=utilFromBase(at,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=it+1,tt+this.blockLength}toBER(et=!1){let tt,nt;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return tt=new ArrayBuffer(1),et===!1&&(nt=new Uint8Array(tt),nt[0]=128),tt;if(this.longFormUsed){const rt=utilToBase(this.length,8);if(rt.byteLength>127)return this.error="Too big length",EMPTY_BUFFER$1;if(tt=new ArrayBuffer(rt.byteLength+1),et)return tt;const ot=new Uint8Array(rt);nt=new Uint8Array(tt),nt[0]=rt.byteLength|128;for(let it=0;it=37&&rt.idBlock.isHexOnly===!1)return rt.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:rt};switch(rt.idBlock.tagNumber){case 0:if(rt.idBlock.isConstructed&&rt.lenBlock.length>0)return rt.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:rt};at=typeStore.EndOfContent;break;case 1:at=typeStore.Boolean;break;case 2:at=typeStore.Integer;break;case 3:at=typeStore.BitString;break;case 4:at=typeStore.OctetString;break;case 5:at=typeStore.Null;break;case 6:at=typeStore.ObjectIdentifier;break;case 10:at=typeStore.Enumerated;break;case 12:at=typeStore.Utf8String;break;case 13:at=typeStore.RelativeObjectIdentifier;break;case 14:at=typeStore.TIME;break;case 15:return rt.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:rt};case 16:at=typeStore.Sequence;break;case 17:at=typeStore.Set;break;case 18:at=typeStore.NumericString;break;case 19:at=typeStore.PrintableString;break;case 20:at=typeStore.TeletexString;break;case 21:at=typeStore.VideotexString;break;case 22:at=typeStore.IA5String;break;case 23:at=typeStore.UTCTime;break;case 24:at=typeStore.GeneralizedTime;break;case 25:at=typeStore.GraphicString;break;case 26:at=typeStore.VisibleString;break;case 27:at=typeStore.GeneralString;break;case 28:at=typeStore.UniversalString;break;case 29:at=typeStore.CharacterString;break;case 30:at=typeStore.BmpString;break;case 31:at=typeStore.DATE;break;case 32:at=typeStore.TimeOfDay;break;case 33:at=typeStore.DateTime;break;case 34:at=typeStore.Duration;break;default:{const ct=rt.idBlock.isConstructed?new typeStore.Constructed:new typeStore.Primitive;ct.idBlock=rt.idBlock,ct.lenBlock=rt.lenBlock,ct.warnings=rt.warnings,rt=ct}}break;case 2:case 3:case 4:default:at=rt.idBlock.isConstructed?typeStore.Constructed:typeStore.Primitive}return rt=localChangeType(rt,at),st=rt.fromBER(o,et,rt.lenBlock.isIndefiniteForm?tt:rt.lenBlock.length),rt.valueBeforeDecodeView=o.subarray(nt,nt+rt.blockLength),{offset:st,result:rt}}function fromBER(o){if(!o.byteLength){const et=new BaseBlock({},ValueBlock);return et.error="Input buffer has zero length",{offset:-1,result:et}}return localFromBER(BufferSourceConverter.toUint8Array(o).slice(),0,o.byteLength)}function checkLen(o,et){return o?1:et}class LocalConstructedValueBlock extends ValueBlock{constructor({value:et=[],isIndefiniteForm:tt=!1,...nt}={}){super(nt),this.value=et,this.isIndefiniteForm=tt}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,rt,tt,nt))return-1;if(this.valueBeforeDecodeView=rt.subarray(tt,tt+nt),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),tt;let ot=tt;for(;checkLen(this.isIndefiniteForm,nt)>0;){const it=localFromBER(rt,ot,nt);if(it.offset===-1)return this.error=it.result.error,this.warnings.concat(it.result.warnings),-1;if(ot=it.offset,this.blockLength+=it.result.blockLength,nt-=it.result.blockLength,this.value.push(it.result),this.isIndefiniteForm&&it.result.constructor.NAME===END_OF_CONTENT_NAME)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===END_OF_CONTENT_NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),ot}toBER(et,tt){const nt=tt||new ViewWriter;for(let rt=0;rt"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function concat(o){let et=0,tt=0;for(let rt=0;rt=ot.length)return this.error="End of input reached before message was fully decoded",-1;if(at===lt){lt+=255;const ht=new Uint8Array(lt);for(let ft=0;ft8)return this.error="Too big integer",-1;if(it+1>ot.length)return this.error="End of input reached before message was fully decoded",-1;const st=tt+1,at=rt.subarray(st,st+it);return at[it-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=utilFromBase(at,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=it+1,tt+this.blockLength}toBER(et=!1){let tt,nt;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return tt=new ArrayBuffer(1),et===!1&&(nt=new Uint8Array(tt),nt[0]=128),tt;if(this.longFormUsed){const rt=utilToBase(this.length,8);if(rt.byteLength>127)return this.error="Too big length",EMPTY_BUFFER$1;if(tt=new ArrayBuffer(rt.byteLength+1),et)return tt;const ot=new Uint8Array(rt);nt=new Uint8Array(tt),nt[0]=rt.byteLength|128;for(let it=0;it=37&&rt.idBlock.isHexOnly===!1)return rt.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:rt};switch(rt.idBlock.tagNumber){case 0:if(rt.idBlock.isConstructed&&rt.lenBlock.length>0)return rt.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:rt};at=typeStore.EndOfContent;break;case 1:at=typeStore.Boolean;break;case 2:at=typeStore.Integer;break;case 3:at=typeStore.BitString;break;case 4:at=typeStore.OctetString;break;case 5:at=typeStore.Null;break;case 6:at=typeStore.ObjectIdentifier;break;case 10:at=typeStore.Enumerated;break;case 12:at=typeStore.Utf8String;break;case 13:at=typeStore.RelativeObjectIdentifier;break;case 14:at=typeStore.TIME;break;case 15:return rt.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:rt};case 16:at=typeStore.Sequence;break;case 17:at=typeStore.Set;break;case 18:at=typeStore.NumericString;break;case 19:at=typeStore.PrintableString;break;case 20:at=typeStore.TeletexString;break;case 21:at=typeStore.VideotexString;break;case 22:at=typeStore.IA5String;break;case 23:at=typeStore.UTCTime;break;case 24:at=typeStore.GeneralizedTime;break;case 25:at=typeStore.GraphicString;break;case 26:at=typeStore.VisibleString;break;case 27:at=typeStore.GeneralString;break;case 28:at=typeStore.UniversalString;break;case 29:at=typeStore.CharacterString;break;case 30:at=typeStore.BmpString;break;case 31:at=typeStore.DATE;break;case 32:at=typeStore.TimeOfDay;break;case 33:at=typeStore.DateTime;break;case 34:at=typeStore.Duration;break;default:{const ct=rt.idBlock.isConstructed?new typeStore.Constructed:new typeStore.Primitive;ct.idBlock=rt.idBlock,ct.lenBlock=rt.lenBlock,ct.warnings=rt.warnings,rt=ct}}break;case 2:case 3:case 4:default:at=rt.idBlock.isConstructed?typeStore.Constructed:typeStore.Primitive}return rt=localChangeType(rt,at),st=rt.fromBER(o,et,rt.lenBlock.isIndefiniteForm?tt:rt.lenBlock.length),rt.valueBeforeDecodeView=o.subarray(nt,nt+rt.blockLength),{offset:st,result:rt}}function fromBER(o){if(!o.byteLength){const et=new BaseBlock({},ValueBlock);return et.error="Input buffer has zero length",{offset:-1,result:et}}return localFromBER(BufferSourceConverter.toUint8Array(o).slice(),0,o.byteLength)}function checkLen(o,et){return o?1:et}class LocalConstructedValueBlock extends ValueBlock{constructor({value:et=[],isIndefiniteForm:tt=!1,...nt}={}){super(nt),this.value=et,this.isIndefiniteForm=tt}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,rt,tt,nt))return-1;if(this.valueBeforeDecodeView=rt.subarray(tt,tt+nt),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),tt;let ot=tt;for(;checkLen(this.isIndefiniteForm,nt)>0;){const it=localFromBER(rt,ot,nt);if(it.offset===-1)return this.error=it.result.error,this.warnings.concat(it.result.warnings),-1;if(ot=it.offset,this.blockLength+=it.result.blockLength,nt-=it.result.blockLength,this.value.push(it.result),this.isIndefiniteForm&&it.result.constructor.NAME===END_OF_CONTENT_NAME)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===END_OF_CONTENT_NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),ot}toBER(et,tt){const nt=tt||new ViewWriter;for(let rt=0;rt` ${rt}`).join(` `));const tt=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return et.length?`${tt} : ${et.join(` -`)}`:`${tt} :`}}_a$v=Constructed;typeStore.Constructed=_a$v;Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(et,tt,nt){return tt}toBER(et){return EMPTY_BUFFER$1}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";var _a$u;class EndOfContent extends BaseBlock{constructor(et={}){super(et,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent;typeStore.EndOfContent=_a$u;EndOfContent.NAME=END_OF_CONTENT_NAME;var _a$t;class Null extends BaseBlock{constructor(et={}){super(et,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(et,tt,nt){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=nt,tt+nt>et.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):tt+nt}toBER(et,tt){const nt=new ArrayBuffer(2);if(!et){const rt=new Uint8Array(nt);rt[0]=5,rt[1]=0}return tt&&tt.write(nt),nt}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null;typeStore.Null=_a$t;Null.NAME="NULL";class LocalBooleanValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),tt.valueHex?this.valueHexView=BufferSourceConverter.toUint8Array(tt.valueHex):this.valueHexView=new Uint8Array(1),et&&(this.value=et)}get value(){for(const et of this.valueHexView)if(et>0)return!0;return!1}set value(et){this.valueHexView[0]=et?255:0}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);return checkBufferParams(this,rt,tt,nt)?(this.valueHexView=rt.subarray(tt,tt+nt),nt>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=nt,tt+nt):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";var _a$s;let Boolean$1=class extends BaseBlock{constructor(et={}){super(et,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(et){this.valueBlock.value=et}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1;typeStore.Boolean=_a$s;Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock){constructor({isConstructed:et=!1,...tt}={}){super(tt),this.isConstructed=et}fromBER(et,tt,nt){let rt=0;if(this.isConstructed){if(this.isHexOnly=!1,rt=LocalConstructedValueBlock.prototype.fromBER.call(this,et,tt,nt),rt===-1)return rt;for(let ot=0;ot0&&ct.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=ct.unusedBits}return rt}const ot=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,ot,tt,nt))return-1;const it=ot.subarray(tt,tt+nt);if(this.unusedBits=it[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const st=it.subarray(1);try{if(st.byteLength){const at=localFromBER(st,0,st.byteLength);at.offset!==-1&&at.offset===nt-1&&(this.value=[at.result])}}catch{}}return this.valueHexView=it.subarray(1),this.blockLength=it.length,tt+nt}toBER(et,tt){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,et,tt);if(et)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER$1;const nt=new Uint8Array(this.valueHexView.length+1);return nt[0]=this.unusedBits,nt.set(this.valueHexView,1),nt.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";var _a$q;class BitString extends BaseBlock{constructor({idBlock:et={},lenBlock:tt={},...nt}={}){var rt,ot;(rt=nt.isConstructed)!==null&&rt!==void 0||(nt.isConstructed=!!(!((ot=nt.value)===null||ot===void 0)&&ot.length)),super({idBlock:{isConstructed:nt.isConstructed,...et},lenBlock:{...tt,isIndefiniteForm:!!nt.isIndefiniteForm},...nt},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(et,tt,nt){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(et,tt,nt)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const et=[],tt=this.valueBlock.valueHexView;for(const rt of tt)et.push(rt.toString(2).padStart(8,"0"));const nt=et.join("");return`${this.constructor.NAME} : ${nt.substring(0,nt.length-this.valueBlock.unusedBits)}`}}}_a$q=BitString;typeStore.BitString=_a$q;BitString.NAME=BIT_STRING_NAME;var _a$p;function viewAdd(o,et){const tt=new Uint8Array([0]),nt=new Uint8Array(o),rt=new Uint8Array(et);let ot=nt.slice(0);const it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct=0;const lt=at=0;ht--,dt++){switch(!0){case dt=ot.length:ot=utilConcatView(new Uint8Array([ct%10]),ot);break;default:ot[it-dt]=ct%10}}return tt[0]>0&&(ot=utilConcatView(tt,ot)),ot}function power2(o){if(o>=powers2.length)for(let et=powers2.length;et<=o;et++){const tt=new Uint8Array([0]);let nt=powers2[et-1].slice(0);for(let rt=nt.length-1;rt>=0;rt--){const ot=new Uint8Array([(nt[rt]<<1)+tt[0]]);tt[0]=ot[0]/10,nt[rt]=ot[0]%10}tt[0]>0&&(nt=utilConcatView(tt,nt)),powers2.push(nt)}return powers2[o]}function viewSub(o,et){let tt=0;const nt=new Uint8Array(o),rt=new Uint8Array(et),ot=nt.slice(0),it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct,lt=0;for(let dt=at;dt>=0;dt--,lt++)switch(ct=ot[it-lt]-st[at-lt]-tt,!0){case ct<0:tt=1,ot[it-lt]=ct+10;break;default:tt=0,ot[it-lt]=ct}if(tt>0)for(let dt=it-at+1;dt>=0;dt--,lt++)if(ct=ot[it-lt]-tt,ct<0)tt=1,ot[it-lt]=ct+10;else{tt=0,ot[it-lt]=ct;break}return ot.slice()}class LocalIntegerValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),this._valueDec=0,tt.valueHex&&this.setValueHex(),et!==void 0&&(this.valueDec=et)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}set valueDec(et){this._valueDec=et,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(et))}get valueDec(){return this._valueDec}fromDER(et,tt,nt,rt=0){const ot=this.fromBER(et,tt,nt);if(ot===-1)return ot;const it=this.valueHexView;return it[0]===0&&it[1]&128?this.valueHexView=it.subarray(1):rt!==0&&it.length1&&(rt=it.length+1),this.valueHexView=it.subarray(rt-it.length)),ot}toDER(et=!1){const tt=this.valueHexView;switch(!0){case(tt[0]&128)!==0:{const nt=new Uint8Array(this.valueHexView.length+1);nt[0]=0,nt.set(tt,1),this.valueHexView=nt}break;case(tt[0]===0&&(tt[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(et)}fromBER(et,tt,nt){const rt=super.fromBER(et,tt,nt);return rt===-1||this.setValueHex(),rt}toBER(et){return et?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const et=this.valueHexView.length*8-1;let tt=new Uint8Array(this.valueHexView.length*8/3),nt=0,rt;const ot=this.valueHexView;let it="",st=!1;for(let at=ot.byteLength-1;at>=0;at--){rt=ot[at];for(let ct=0;ct<8;ct++){if((rt&1)===1)switch(nt){case et:tt=viewSub(power2(nt),tt),it="-";break;default:tt=viewAdd(tt,power2(nt))}nt++,rt>>=1}}for(let at=0;at0;){const ot=new LocalSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.value.length===0&&(ot.isFirstSid=!0),this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et){const tt=[];for(let nt=0;ntNumber.MAX_SAFE_INTEGER){assertBigInt();const st=BigInt(rt);it.valueBigInt=st}else if(it.valueDec=parseInt(rt,10),isNaN(it.valueDec))return;this.value.length||(it.isFirstSid=!0,ot=!0),this.value.push(it)}while(nt!==-1)}toString(){let et="",tt=!1;for(let nt=0;nt0;){const ot=new LocalRelativeSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et,tt){const nt=[];for(let rt=0;rt4)continue;const st=4-it.length;for(let at=it.length-1;at>=0;at--)nt[rt*4+at+st]=it[at]}this.valueBlock.value=et}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";var _a$g;class UniversalString extends LocalUniversalStringValueBlock{constructor({...et}={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString;typeStore.UniversalString=_a$g;UniversalString.NAME="UniversalString";var _a$f;class NumericString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString;typeStore.NumericString=_a$f;NumericString.NAME="NumericString";var _a$e;class PrintableString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString;typeStore.PrintableString=_a$e;PrintableString.NAME="PrintableString";var _a$d;class TeletexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString;typeStore.TeletexString=_a$d;TeletexString.NAME="TeletexString";var _a$c;class VideotexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString;typeStore.VideotexString=_a$c;VideotexString.NAME="VideotexString";var _a$b;class IA5String extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String;typeStore.IA5String=_a$b;IA5String.NAME="IA5String";var _a$a;class GraphicString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString;typeStore.GraphicString=_a$a;GraphicString.NAME="GraphicString";var _a$9;class VisibleString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString;typeStore.VisibleString=_a$9;VisibleString.NAME="VisibleString";var _a$8;class GeneralString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString;typeStore.GeneralString=_a$8;GeneralString.NAME="GeneralString";var _a$7;class CharacterString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString;typeStore.CharacterString=_a$7;CharacterString.NAME="CharacterString";var _a$6;class UTCTime extends VisibleString{constructor({value:et,valueDate:tt,...nt}={}){if(super(nt),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,et){this.fromString(et),this.valueBlock.valueHexView=new Uint8Array(et.length);for(let rt=0;rt=50?this.year=1900+rt:this.year=2e3+rt,this.month=parseInt(nt[2],10),this.day=parseInt(nt[3],10),this.hour=parseInt(nt[4],10),this.minute=parseInt(nt[5],10),this.second=parseInt(nt[6],10)}toString(et="iso"){if(et==="iso"){const tt=new Array(7);return tt[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),tt[1]=padNumber(this.month,2),tt[2]=padNumber(this.day,2),tt[3]=padNumber(this.hour,2),tt[4]=padNumber(this.minute,2),tt[5]=padNumber(this.second,2),tt[6]="Z",tt.join("")}return super.toString(et)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime;typeStore.UTCTime=_a$6;UTCTime.NAME="UTCTime";var _a$5;class GeneralizedTime extends UTCTime{constructor(et={}){var tt;super(et),(tt=this.millisecond)!==null&&tt!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(et){super.fromDate(et),this.millisecond=et.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(et){let tt=!1,nt="",rt="",ot=0,it,st=0,at=0;if(et[et.length-1]==="Z")nt=et.substring(0,et.length-1),tt=!0;else{const dt=new Number(et[et.length-1]);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");nt=et}if(tt){if(nt.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(nt.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let dt=1,ht=nt.indexOf("+"),pt="";if(ht===-1&&(ht=nt.indexOf("-"),dt=-1),ht!==-1){if(pt=nt.substring(ht+1),nt=nt.substring(0,ht),pt.length!==2&&pt.length!==4)throw new Error("Wrong input string for conversion");let mt=parseInt(pt.substring(0,2),10);if(isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");if(st=dt*mt,pt.length===4){if(mt=parseInt(pt.substring(2,4),10),isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");at=dt*mt}}}let ct=nt.indexOf(".");if(ct===-1&&(ct=nt.indexOf(",")),ct!==-1){const dt=new Number(`0${nt.substring(ct)}`);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");ot=dt.valueOf(),rt=nt.substring(0,ct)}else rt=nt;switch(!0){case rt.length===8:if(it=/(\d{4})(\d{2})(\d{2})/ig,ct!==-1)throw new Error("Wrong input string for conversion");break;case rt.length===10:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.minute=Math.floor(dt),dt=60*(dt-this.minute),this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===12:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===14:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){const dt=1e3*ot;this.millisecond=Math.floor(dt)}break;default:throw new Error("Wrong input string for conversion")}const lt=it.exec(rt);if(lt===null)throw new Error("Wrong input string for conversion");for(let dt=1;dt0&&(nt=`0${nt}`),et.push(nt)}),BigInt("0x"+et.join(""))}function pkixToRSAPublicKey(o){const et=pkixToJwk(o);if(rsaKeySize(et)>MAX_RSA_KEY_SIZE)throw new InvalidPublicKeyError("Key size is too large");const tt=sha256$2(PublicKey.encode({Type:KeyType.RSA,Data:o})),nt=create$3(SHA2_256_CODE,tt);return new RSAPublicKey(et,nt)}function isPromise$3(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function hashAndVerify(o,et,tt){const nt=sha256.digest(tt instanceof Uint8Array?tt:tt.subarray());if(isPromise$3(nt))return nt.then(({digest:rt})=>secp256k1.verify(et,rt,o)).catch(rt=>{throw new VerificationError(String(rt))});try{return secp256k1.verify(et,nt.digest,o)}catch(rt){throw new VerificationError(String(rt))}}class Secp256k1PublicKey{constructor(et){Ct(this,"type","secp256k1");Ct(this,"raw");Ct(this,"_key");this._key=validateSecp256k1PublicKey(et),this.raw=compressSecp256k1PublicKey(this._key)}toMultihash(){return identity.digest(publicKeyToProtobuf(this))}toCID(){return CID.createV1(114,this.toMultihash())}toString(){return base58btc.encode(this.toMultihash().bytes).substring(1)}equals(et){return et==null||!(et.raw instanceof Uint8Array)?!1:equals(this.raw,et.raw)}verify(et,tt){return hashAndVerify(this._key,tt,et)}}function unmarshalSecp256k1PublicKey(o){return new Secp256k1PublicKey(o)}function compressSecp256k1PublicKey(o){return secp256k1.ProjectivePoint.fromHex(o).toRawBytes(!0)}function validateSecp256k1PublicKey(o){try{return secp256k1.ProjectivePoint.fromHex(o),o}catch(et){throw new InvalidPublicKeyError(String(et))}}async function generateKeyPair(o,et){return generateEd25519KeyPair()}function publicKeyFromProtobuf(o){const{Type:et,Data:tt}=PublicKey.decode(o),nt=tt??new Uint8Array;switch(et){case KeyType.RSA:return pkixToRSAPublicKey(nt);case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyFromRaw(o){return o.byteLength===32?unmarshalEd25519PublicKey(o):o.byteLength===33?unmarshalSecp256k1PublicKey(o):pkixToRSAPublicKey(o)}function publicKeyFromMultihash(o){const{Type:et,Data:tt}=PublicKey.decode(o.digest),nt=tt??new Uint8Array;switch(et){case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyToProtobuf(o){return PublicKey.encode({Type:KeyType[o.type],Data:o.raw})}const peerIdSymbol$2=Symbol.for("@libp2p/peer-id");var ds;let InvalidParametersError$2=(ds=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ds,"name","InvalidParametersError"),ds);class InvalidCIDError extends Error{constructor(et="Invalid CID"){super(et),this.name="InvalidCIDError"}}Ct(InvalidCIDError,"name","InvalidCIDError");class InvalidMultihashError extends Error{constructor(et="Invalid Multihash"){super(et),this.name="InvalidMultihashError"}}Ct(InvalidMultihashError,"name","InvalidMultihashError");class UnsupportedKeyTypeError extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}}Ct(UnsupportedKeyTypeError,"name","UnsupportedKeyTypeError");const inspect=Symbol.for("nodejs.util.inspect.custom"),LIBP2P_KEY_CODE$1=114;var Js;class PeerIdImpl{constructor(et){Ct(this,"type");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"string");Ct(this,Js,!0);this.type=et.type,this.multihash=et.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}toString(){return this.string==null&&(this.string=base58btc.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return CID.createV1(LIBP2P_KEY_CODE$1,this.multihash)}toJSON(){return this.toString()}equals(et){var tt;if(et==null)return!1;if(et instanceof Uint8Array)return equals(this.multihash.bytes,et);if(typeof et=="string")return this.toString()===et;if(((tt=et==null?void 0:et.toMultihash())==null?void 0:tt.bytes)!=null)return equals(this.multihash.bytes,et.toMultihash().bytes);throw new Error("not valid Id")}[(Js=peerIdSymbol$2,inspect)](){return`PeerId(${this.toString()})`}}class RSAPeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"RSA"});Ct(this,"type","RSA");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Ed25519PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"Ed25519"});Ct(this,"type","Ed25519");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Secp256k1PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"secp256k1"});Ct(this,"type","secp256k1");Ct(this,"publicKey");this.publicKey=tt.publicKey}}const TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1=2336;var na,ga;class URLPeerId{constructor(et){Ct(this,"type","url");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"url");Ct(this,na,!0);this.url=et.toString(),this.multihash=identity.digest(fromString(this.url))}[(ga=inspect,na=peerIdSymbol$2,ga)](){return`PeerId(${this.url})`}toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return CID.createV1(TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1,this.toMultihash())}toJSON(){return this.toString()}equals(et){return et==null?!1:(et instanceof Uint8Array&&(et=toString$8(et)),et.toString()===this.toString())}}const LIBP2P_KEY_CODE=114,TRANSPORT_IPFS_GATEWAY_HTTP_CODE=2336;function peerIdFromString$1(o,et){let tt;if(o.charAt(0)==="1"||o.charAt(0)==="Q")tt=decode$6(base58btc.decode(`z${o}`));else throw new InvalidParametersError$2('Please pass a multibase decoder for strings that do not start with "1" or "Q"');return peerIdFromMultihash(tt)}function peerIdFromPublicKey(o){if(o.type==="Ed25519")return new Ed25519PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="secp256k1")return new Secp256k1PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="RSA")return new RSAPeerId({multihash:o.toCID().multihash,publicKey:o});throw new UnsupportedKeyTypeError}function peerIdFromPrivateKey(o){return peerIdFromPublicKey(o.publicKey)}function peerIdFromMultihash(o){if(isSha256Multihash(o))return new RSAPeerId({multihash:o});if(isIdentityMultihash(o))try{const et=publicKeyFromMultihash(o);if(et.type==="Ed25519")return new Ed25519PeerId({multihash:o,publicKey:et});if(et.type==="secp256k1")return new Secp256k1PeerId({multihash:o,publicKey:et})}catch{const tt=toString$8(o.digest);return new URLPeerId(new URL(tt))}throw new InvalidMultihashError("Supplied PeerID Multihash is invalid")}function peerIdFromCID(o){if((o==null?void 0:o.multihash)==null||o.version==null||o.version===1&&o.code!==LIBP2P_KEY_CODE&&o.code!==TRANSPORT_IPFS_GATEWAY_HTTP_CODE)throw new InvalidCIDError("Supplied PeerID CID is invalid");if(o.code===TRANSPORT_IPFS_GATEWAY_HTTP_CODE){const et=toString$8(o.multihash.digest);return new URLPeerId(new URL(et))}return peerIdFromMultihash(o.multihash)}function isIdentityMultihash(o){return o.code===identity.code}function isSha256Multihash(o){return o.code===sha256.code}let AbortError$8=class extends Error{constructor(tt,nt,rt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.name=rt??"AbortError",this.code=nt??"ABORT_ERR"}};async function raceSignal(o,et,tt){if(et==null)return o;if(et.aborted)return Promise.reject(new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName));let nt;const rt=new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName);try{return await Promise.race([o,new Promise((ot,it)=>{nt=()=>{it(rt)},et.addEventListener("abort",nt)})])}finally{nt!=null&&et.removeEventListener("abort",nt)}}class QueuelessPushable{constructor(){Ct(this,"readNext");Ct(this,"haveNext");Ct(this,"ended");Ct(this,"nextResult");this.ended=!1,this.readNext=pDefer(),this.haveNext=pDefer()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");const et=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=pDefer(),et}async throw(et){return this.ended=!0,et!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(et)),{done:!0,value:void 0}}async return(){const et={done:!0,value:void 0};return await this._push(void 0),et}async push(et,tt){await this._push(et,tt)}async end(et,tt){et!=null?await this.throw(et):await this._push(void 0,tt)}async _push(et,tt){if(et!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;et!=null?this.nextResult={done:!1,value:et}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=pDefer(),await raceSignal(this.readNext.promise,tt==null?void 0:tt.signal,tt)}}function queuelessPushable(){return new QueuelessPushable}class UnexpectedEOFError extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}}class CodeError extends Error{constructor(tt,nt){super(tt);Ct(this,"code");this.code=nt}}let AbortError$7=class extends CodeError{constructor(tt){super(tt,"ABORT_ERR");Ct(this,"type");this.type="aborted",this.name="AbortError"}};function byteStream(o,et){const tt=queuelessPushable();o.sink(tt).catch(async it=>{await tt.end(it)}),o.sink=async it=>{for await(const st of it)await tt.push(st);await tt.end()};let nt=o.source;o.source[Symbol.iterator]!=null?nt=o.source[Symbol.iterator]():o.source[Symbol.asyncIterator]!=null&&(nt=o.source[Symbol.asyncIterator]());const rt=new Uint8ArrayList;return{read:async(it,st)=>{var lt,dt;(lt=st==null?void 0:st.signal)==null||lt.throwIfAborted();let at;const ct=new Promise((ht,pt)=>{var mt;at=()=>{pt(new AbortError$7("Read aborted"))},(mt=st==null?void 0:st.signal)==null||mt.addEventListener("abort",at)});try{if(it==null){const{done:pt,value:mt}=await Promise.race([nt.next(),ct]);return pt===!0?new Uint8ArrayList:mt}for(;rt.byteLength{var at;(at=st==null?void 0:st.signal)==null||at.throwIfAborted(),it instanceof Uint8Array?await tt.push(it,st):await tt.push(it.subarray(),st)},unwrap:()=>{if(rt.byteLength>0){const it=o.source;o.source=async function*(){(et==null?void 0:et.yieldBytes)===!1?yield rt:yield*rt,yield*it}()}return o}}}class InvalidMessageLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}}class InvalidDataLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}}class InvalidDataLengthLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}}function lpStream(o,et={}){const tt=byteStream(o,et);et.maxDataLength!=null&&et.maxLengthLength==null&&(et.maxLengthLength=encodingLength$3(et.maxDataLength));const nt=(et==null?void 0:et.lengthDecoder)??decode$b,rt=(et==null?void 0:et.lengthEncoder)??encode$a;return{read:async it=>{let st=-1;const at=new Uint8ArrayList;for(;;){at.append(await tt.read(1,it));try{st=nt(at)}catch(ct){if(ct instanceof RangeError)continue;throw ct}if(st<0)throw new InvalidMessageLengthError("Invalid message length");if((et==null?void 0:et.maxLengthLength)!=null&&at.byteLength>et.maxLengthLength)throw new InvalidDataLengthLengthError("message length length too long");if(st>-1)break}if((et==null?void 0:et.maxDataLength)!=null&&st>et.maxDataLength)throw new InvalidDataLengthError("message length too long");return tt.read(st,it)},write:async(it,st)=>{await tt.write(new Uint8ArrayList(rt(it.byteLength),it),st)},writeV:async(it,st)=>{const at=new Uint8ArrayList(...it.flatMap(ct=>[rt(ct.byteLength),ct]));await tt.write(at,st)},unwrap:()=>tt.unwrap()}}function pair(){const o=pDefer();let et=!1;return{sink:async tt=>{if(et)throw new Error("already piped");et=!0,o.resolve(tt)},source:async function*(){yield*await o.promise}()}}function duplexPair(){const o=pair(),et=pair();return[{source:o.source,sink:et.sink},{source:et.source,sink:o.sink}]}var define_globalThis_process_env_default$2={};const NOISE_MSG_MAX_LENGTH_BYTES=65535,NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=NOISE_MSG_MAX_LENGTH_BYTES-16,DUMP_SESSION_KEYS=!!(define_globalThis_process_env_default$2!=null&&define_globalThis_process_env_default$2.DUMP_SESSION_KEYS);function number$2(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function bool(o){if(typeof o!="boolean")throw new Error(`boolean expected, not ${o}`)}function isBytes$1(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes(o,...et){if(!isBytes$1(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function exists(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output(o,et){bytes(o);const tt=et.outputLen;if(o.lengthnew Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(o){if(typeof o!="string")throw new Error(`string expected, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}function toBytes(o){if(typeof o=="string")o=utf8ToBytes(o);else if(isBytes$1(o))o=copyBytes(o);else throw new Error(`Uint8Array expected, got ${typeof o}`);return o}function checkOpts(o,et){if(et==null||typeof et!="object")throw new Error("options must be defined");return Object.assign(o,et)}function equalBytes(o,et){if(o.length!==et.length)return!1;let tt=0;for(let nt=0;nt(Object.assign(et,o),et);function setBigUint64(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=4,ct=0;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}function copyBytes(o){return Uint8Array.from(o)}function clean(...o){for(let et=0;etUint8Array.from(o.split("").map(et=>et.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(o,et){return o<>>32-et}function isAligned32(o){return o.byteOffset%4===0}const BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(o,et,tt,nt,rt,ot,it,st){const at=rt.length,ct=new Uint8Array(BLOCK_LEN),lt=u32(ct),dt=isAligned32(rt)&&isAligned32(ot),ht=dt?u32(rt):U32_EMPTY,pt=dt?u32(ot):U32_EMPTY;for(let mt=0;mt=MAX_COUNTER)throw new Error("arx: counter overflow");const ft=Math.min(BLOCK_LEN,at-mt);if(dt&&ft===BLOCK_LEN){const yt=mt/4;if(mt%4!==0)throw new Error("arx: invalid block position");for(let gt=0,xt;gt{bytes(st),bytes(at),bytes(ct);const ht=ct.length;if(lt===void 0&&(lt=new Uint8Array(ht)),bytes(lt),number$2(dt),dt<0||dt>=MAX_COUNTER)throw new Error("arx: counter overflow");if(lt.lengtho[et++]&255|(o[et++]&255)<<8;class Poly1305{constructor(et){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,et=toBytes(et),bytes(et,32);const tt=u8to16(et,0),nt=u8to16(et,2),rt=u8to16(et,4),ot=u8to16(et,6),it=u8to16(et,8),st=u8to16(et,10),at=u8to16(et,12),ct=u8to16(et,14);this.r[0]=tt&8191,this.r[1]=(tt>>>13|nt<<3)&8191,this.r[2]=(nt>>>10|rt<<6)&7939,this.r[3]=(rt>>>7|ot<<9)&8191,this.r[4]=(ot>>>4|it<<12)&255,this.r[5]=it>>>1&8190,this.r[6]=(it>>>14|st<<2)&8191,this.r[7]=(st>>>11|at<<5)&8065,this.r[8]=(at>>>8|ct<<8)&8191,this.r[9]=ct>>>5&127;for(let lt=0;lt<8;lt++)this.pad[lt]=u8to16(et,16+2*lt)}process(et,tt,nt=!1){const rt=nt?0:2048,{h:ot,r:it}=this,st=it[0],at=it[1],ct=it[2],lt=it[3],dt=it[4],ht=it[5],pt=it[6],mt=it[7],ft=it[8],yt=it[9],gt=u8to16(et,tt+0),xt=u8to16(et,tt+2),vt=u8to16(et,tt+4),bt=u8to16(et,tt+6),Et=u8to16(et,tt+8),wt=u8to16(et,tt+10),kt=u8to16(et,tt+12),It=u8to16(et,tt+14);let Rt=ot[0]+(gt&8191),Pt=ot[1]+((gt>>>13|xt<<3)&8191),jt=ot[2]+((xt>>>10|vt<<6)&8191),Ot=ot[3]+((vt>>>7|bt<<9)&8191),Bt=ot[4]+((bt>>>4|Et<<12)&8191),zt=ot[5]+(Et>>>1&8191),Ft=ot[6]+((Et>>>14|wt<<2)&8191),Yt=ot[7]+((wt>>>11|kt<<5)&8191),Ht=ot[8]+((kt>>>8|It<<8)&8191),Ut=ot[9]+(It>>>5|rt),qt=0,Lt=qt+Rt*st+Pt*(5*yt)+jt*(5*ft)+Ot*(5*mt)+Bt*(5*pt);qt=Lt>>>13,Lt&=8191,Lt+=zt*(5*ht)+Ft*(5*dt)+Yt*(5*lt)+Ht*(5*ct)+Ut*(5*at),qt+=Lt>>>13,Lt&=8191;let Zt=qt+Rt*at+Pt*st+jt*(5*yt)+Ot*(5*ft)+Bt*(5*mt);qt=Zt>>>13,Zt&=8191,Zt+=zt*(5*pt)+Ft*(5*ht)+Yt*(5*dt)+Ht*(5*lt)+Ut*(5*ct),qt+=Zt>>>13,Zt&=8191;let Qt=qt+Rt*ct+Pt*at+jt*st+Ot*(5*yt)+Bt*(5*ft);qt=Qt>>>13,Qt&=8191,Qt+=zt*(5*mt)+Ft*(5*pt)+Yt*(5*ht)+Ht*(5*dt)+Ut*(5*lt),qt+=Qt>>>13,Qt&=8191;let Nt=qt+Rt*lt+Pt*ct+jt*at+Ot*st+Bt*(5*yt);qt=Nt>>>13,Nt&=8191,Nt+=zt*(5*ft)+Ft*(5*mt)+Yt*(5*pt)+Ht*(5*ht)+Ut*(5*dt),qt+=Nt>>>13,Nt&=8191;let Gt=qt+Rt*dt+Pt*lt+jt*ct+Ot*at+Bt*st;qt=Gt>>>13,Gt&=8191,Gt+=zt*(5*yt)+Ft*(5*ft)+Yt*(5*mt)+Ht*(5*pt)+Ut*(5*ht),qt+=Gt>>>13,Gt&=8191;let nn=qt+Rt*ht+Pt*dt+jt*lt+Ot*ct+Bt*at;qt=nn>>>13,nn&=8191,nn+=zt*st+Ft*(5*yt)+Yt*(5*ft)+Ht*(5*mt)+Ut*(5*pt),qt+=nn>>>13,nn&=8191;let Wt=qt+Rt*pt+Pt*ht+jt*dt+Ot*lt+Bt*ct;qt=Wt>>>13,Wt&=8191,Wt+=zt*at+Ft*st+Yt*(5*yt)+Ht*(5*ft)+Ut*(5*mt),qt+=Wt>>>13,Wt&=8191;let hn=qt+Rt*mt+Pt*pt+jt*ht+Ot*dt+Bt*lt;qt=hn>>>13,hn&=8191,hn+=zt*ct+Ft*at+Yt*st+Ht*(5*yt)+Ut*(5*ft),qt+=hn>>>13,hn&=8191;let Xt=qt+Rt*ft+Pt*mt+jt*pt+Ot*ht+Bt*dt;qt=Xt>>>13,Xt&=8191,Xt+=zt*lt+Ft*ct+Yt*at+Ht*st+Ut*(5*yt),qt+=Xt>>>13,Xt&=8191;let Jt=qt+Rt*yt+Pt*ft+jt*mt+Ot*pt+Bt*ht;qt=Jt>>>13,Jt&=8191,Jt+=zt*dt+Ft*lt+Yt*ct+Ht*at+Ut*st,qt+=Jt>>>13,Jt&=8191,qt=(qt<<2)+qt|0,qt=qt+Lt|0,Lt=qt&8191,qt=qt>>>13,Zt+=qt,ot[0]=Lt,ot[1]=Zt,ot[2]=Qt,ot[3]=Nt,ot[4]=Gt,ot[5]=nn,ot[6]=Wt,ot[7]=hn,ot[8]=Xt,ot[9]=Jt}finalize(){const{h:et,pad:tt}=this,nt=new Uint16Array(10);let rt=et[1]>>>13;et[1]&=8191;for(let st=2;st<10;st++)et[st]+=rt,rt=et[st]>>>13,et[st]&=8191;et[0]+=rt*5,rt=et[0]>>>13,et[0]&=8191,et[1]+=rt,rt=et[1]>>>13,et[1]&=8191,et[2]+=rt,nt[0]=et[0]+5,rt=nt[0]>>>13,nt[0]&=8191;for(let st=1;st<10;st++)nt[st]=et[st]+rt,rt=nt[st]>>>13,nt[st]&=8191;nt[9]-=8192;let ot=(rt^1)-1;for(let st=0;st<10;st++)nt[st]&=ot;ot=~ot;for(let st=0;st<10;st++)et[st]=et[st]&ot|nt[st];et[0]=(et[0]|et[1]<<13)&65535,et[1]=(et[1]>>>3|et[2]<<10)&65535,et[2]=(et[2]>>>6|et[3]<<7)&65535,et[3]=(et[3]>>>9|et[4]<<4)&65535,et[4]=(et[4]>>>12|et[5]<<1|et[6]<<14)&65535,et[5]=(et[6]>>>2|et[7]<<11)&65535,et[6]=(et[7]>>>5|et[8]<<8)&65535,et[7]=(et[8]>>>8|et[9]<<5)&65535;let it=et[0]+tt[0];et[0]=it&65535;for(let st=1;st<8;st++)it=(et[st]+tt[st]|0)+(it>>>16)|0,et[st]=it&65535;clean(nt)}update(et){exists(this);const{buffer:tt,blockLen:nt}=this;et=toBytes(et);const rt=et.length;for(let ot=0;ot>>0,et[ot++]=nt[it]>>>8;return et}digest(){const{buffer:et,outputLen:tt}=this;this.digestInto(et);const nt=et.slice(0,tt);return this.destroy(),nt}}function wrapConstructorWithKey(o){const et=(nt,rt)=>o(rt).update(toBytes(nt)).digest(),tt=o(new Uint8Array(32));return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}const poly1305=wrapConstructorWithKey(o=>new Poly1305(o));function chachaCore(o,et,tt,nt,rt,ot=20){let it=o[0],st=o[1],at=o[2],ct=o[3],lt=et[0],dt=et[1],ht=et[2],pt=et[3],mt=et[4],ft=et[5],yt=et[6],gt=et[7],xt=rt,vt=tt[0],bt=tt[1],Et=tt[2],wt=it,kt=st,It=at,Rt=ct,Pt=lt,jt=dt,Ot=ht,Bt=pt,zt=mt,Ft=ft,Yt=yt,Ht=gt,Ut=xt,qt=vt,Lt=bt,Zt=Et;for(let Nt=0;Nt{o.update(et);const tt=et.length%16;tt&&o.update(ZEROS16.subarray(tt))},ZEROS32=new Uint8Array(32);function computeTag(o,et,tt,nt,rt){const ot=o(et,tt,ZEROS32),it=poly1305.create(ot);rt&&updatePadded(it,rt),updatePadded(it,nt);const st=new Uint8Array(16),at=createView(st);setBigUint64(at,0,BigInt(rt?rt.length:0),!0),setBigUint64(at,8,BigInt(nt.length),!0),it.update(st);const ct=it.digest();return clean(ot,st),ct}const _poly1305_aead=o=>(et,tt,nt)=>(bytes(et,32),bytes(tt),{encrypt(ot,it){const st=ot.length,at=st+16;it?bytes(it,at):it=new Uint8Array(at),o(et,tt,ot,it,1);const ct=computeTag(o,et,tt,it.subarray(0,-16),nt);return it.set(ct,st),clean(ct),it},decrypt(ot,it){const st=ot.length,at=st-16;if(st<16)throw new Error("encrypted data must be at least 16 bytes");it?bytes(it,at):it=new Uint8Array(at);const ct=ot.subarray(0,-16),lt=ot.subarray(-16),dt=computeTag(o,et,tt,ct,nt);if(!equalBytes(lt,dt))throw new Error("invalid tag");return o(et,tt,ct,it,1),clean(dt),it}}),chacha20poly1305=wrapCipher({blockSize:64,nonceLength:12,tagLength:16},_poly1305_aead(chacha20));function extract(o,et,tt){return hash$1(o),tt===void 0&&(tt=new Uint8Array(o.outputLen)),hmac(o,toBytes$2(tt),toBytes$2(et))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(o,et,tt,nt=32){if(hash$1(o),number$4(nt),nt>255*o.outputLen)throw new Error("Length should be <= 255*HashLen");const rt=Math.ceil(nt/o.outputLen);tt===void 0&&(tt=EMPTY_BUFFER);const ot=new Uint8Array(rt*o.outputLen),it=hmac.create(o,et),st=it._cloneInto(),at=new Uint8Array(it.outputLen);for(let ct=0;cto.generateX25519SharedKey(et.privateKey,tt).subarray(0,32),encrypt:o.chaCha20Poly1305Encrypt,decrypt:o.chaCha20Poly1305Decrypt,hash:o.hashSHA256,hkdf:o.getHKDF}}const uint16BEEncode=o=>{const et=allocUnsafe(2);return et[0]=o>>8,et[1]=o,et};uint16BEEncode.bytes=2;const uint16BEDecode=o=>{if(o.length<2)throw RangeError("Could not decode int16BE");if(o instanceof Uint8Array){let et=0;return et+=o[0]<<8,et+=o[1],et}return o.getUint16(0)};uint16BEDecode.bytes=2;function registerMetrics(o){return{xxHandshakeSuccesses:o.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:o.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:o.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:o.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:o.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}function logLocalStaticKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_STATIC_PUBLIC_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_STATIC_PRIVATE_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local static keys."))}function logLocalEphemeralKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_PUBLIC_EPHEMERAL_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_PRIVATE_EPHEMERAL_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local ephemeral keys."))}function logRemoteStaticKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_STATIC_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote static public key.")}function logRemoteEphemeralKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_EPHEMERAL_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote ephemeral keys.")}function logCipherState(o,et,tt){!tt.enabled||!DUMP_SESSION_KEYS||(tt(`CIPHER_STATE_1 ${o.n.getUint64()} ${o.k&&toString$8(o.k,"hex")}`),tt(`CIPHER_STATE_2 ${et.n.getUint64()} ${et.k&&toString$8(et.k,"hex")}`))}const rs=class rs extends Error{constructor(tt="Invalid crypto exchange"){super(tt);Ct(this,"code");this.code=rs.code}};Ct(rs,"code","ERR_INVALID_CRYPTO_EXCHANGE");let InvalidCryptoExchangeError=rs;const MIN_NONCE=0,MAX_NONCE=4294967295,ERR_MAX_NONCE="Cipherstate has reached maximum n, a new handshake must be performed";class Nonce{constructor(et=MIN_NONCE){Ct(this,"n");Ct(this,"bytes");Ct(this,"view");this.n=et,this.bytes=alloc$2(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,et,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>MAX_NONCE)throw new Error(ERR_MAX_NONCE)}}const ZEROLEN=alloc$2(0);class CipherState{constructor(et,tt=void 0,nt=0){Ct(this,"k");Ct(this,"n");Ct(this,"crypto");this.crypto=et,this.k=tt,this.n=new Nonce(nt)}hasKey(){return!!this.k}encryptWithAd(et,tt){if(!this.hasKey())return tt;this.n.assertValue();const nt=this.crypto.encrypt(tt,this.n.getBytes(),et,this.k);return this.n.increment(),nt}decryptWithAd(et,tt,nt){if(!this.hasKey())return tt;this.n.assertValue();const rt=this.crypto.decrypt(tt,this.n.getBytes(),et,this.k,nt);return this.n.increment(),rt}}class SymmetricState{constructor(et,tt){Ct(this,"cs");Ct(this,"ck");Ct(this,"h");Ct(this,"crypto");this.crypto=et;const nt=fromString(tt,"utf-8");this.h=hashProtocolName(et,nt),this.ck=this.h,this.cs=new CipherState(et)}mixKey(et){const[tt,nt]=this.crypto.hkdf(this.ck,et);this.ck=tt,this.cs=new CipherState(this.crypto,nt)}mixHash(et){this.h=this.crypto.hash(new Uint8ArrayList(this.h,et))}encryptAndHash(et){const tt=this.cs.encryptWithAd(this.h,et);return this.mixHash(tt),tt}decryptAndHash(et){const tt=this.cs.decryptWithAd(this.h,et);return this.mixHash(et),tt}split(){const[et,tt]=this.crypto.hkdf(this.ck,ZEROLEN);return[new CipherState(this.crypto,et),new CipherState(this.crypto,tt)]}}class AbstractHandshakeState{constructor(et){Ct(this,"ss");Ct(this,"s");Ct(this,"e");Ct(this,"rs");Ct(this,"re");Ct(this,"initiator");Ct(this,"crypto");const{crypto:tt,protocolName:nt,prologue:rt,initiator:ot,s:it,e:st,rs:at,re:ct}=et;this.crypto=tt,this.ss=new SymmetricState(tt,nt),this.ss.mixHash(rt),this.initiator=ot,this.s=it,this.e=st,this.rs=at,this.re=ct}writeE(){if(this.e)throw new Error("ephemeral keypair is already set");const et=this.crypto.generateKeypair();return this.ss.mixHash(et.publicKey),this.e=et,et.publicKey}writeS(){if(!this.s)throw new Error("static keypair is not set");return this.ss.encryptAndHash(this.s.publicKey)}writeEE(){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.re))}writeES(){if(this.initiator){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}else{if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}}writeSE(){if(this.initiator){if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}else{if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}}readE(et,tt=0){if(this.re)throw new Error("remote ephemeral public key is already set");if(et.byteLength(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.webtransportCerthashes!=null)for(const ot of tt.webtransportCerthashes)nt.uint32(10),nt.bytes(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={webtransportCerthashes:[]},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.webtransportCerthashes.push(tt.bytes());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseExtensions||(NoiseExtensions={}));var NoiseHandshakePayload;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.identityKey!=null&&tt.identityKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.identityKey)),tt.identitySig!=null&&tt.identitySig.byteLength>0&&(nt.uint32(18),nt.bytes(tt.identitySig)),tt.extensions!=null&&(nt.uint32(34),NoiseExtensions.codec().encode(tt.extensions,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={identityKey:alloc$2(0),identitySig:alloc$2(0)},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.identityKey=tt.bytes();break}case 2:{rt.identitySig=tt.bytes();break}case 4:{rt.extensions=NoiseExtensions.codec().decode(tt,tt.uint32());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseHandshakePayload||(NoiseHandshakePayload={}));async function createHandshakePayload(o,et,tt){const nt=await o.sign(getSignaturePayload(et));return NoiseHandshakePayload.encode({identityKey:publicKeyToProtobuf(o.publicKey),identitySig:nt,extensions:tt})}async function decodeHandshakePayload(o,et,tt){try{const nt=NoiseHandshakePayload.decode(o),rt=publicKeyFromProtobuf(nt.identityKey);if((tt==null?void 0:tt.equals(rt))===!1)throw new Error(`Payload identity key ${rt} does not match expected remote identity key ${tt}`);if(!et)throw new Error("Remote static does not exist");const ot=getSignaturePayload(et);if(!await rt.verify(ot,nt.identitySig))throw new Error("Invalid payload signature");return nt}catch(nt){throw new UnexpectedPeerError(nt.message)}}function getSignaturePayload(o){const et=fromString("noise-libp2p-static-key:");return o instanceof Uint8Array?concat$1([et,o],et.length+o.length):(o.prepend(et),o)}async function performHandshakeInitiator(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!0,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Initiator starting to send first message."),await nt.write(dt.writeMessageA(ZEROLEN),et),tt.trace("Stage 0 - Initiator finished sending first message."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 1 - Initiator waiting to receive first message from responder...");const ht=dt.readMessageB(await nt.read(et));tt.trace("Stage 1 - Initiator received the message."),logRemoteEphemeralKey(dt.re,tt),logRemoteStaticKey(dt.rs,tt),tt.trace("Initiator going to check remote's signature...");const pt=await decodeHandshakePayload(ht,dt.rs,at);tt.trace("All good with the signature!"),tt.trace("Stage 2 - Initiator sending third handshake message."),await nt.write(dt.writeMessageC(lt),et),tt.trace("Stage 2 - Initiator sent message with signed payload.");const[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>mt.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>ft.decryptWithAd(ZEROLEN,yt,gt)}}async function performHandshakeResponder(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!1,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Responder waiting to receive first message."),dt.readMessageA(await nt.read(et)),tt.trace("Stage 0 - Responder received first message."),logRemoteEphemeralKey(dt.re,tt),tt.trace("Stage 1 - Responder sending out first message with signed payload and static key."),await nt.write(dt.writeMessageB(lt),et),tt.trace("Stage 1 - Responder sent the second handshake message with signed payload."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 2 - Responder waiting for third handshake message...");const ht=dt.readMessageC(await nt.read(et));tt.trace("Stage 2 - Responder received the message, finished handshake.");const pt=await decodeHandshakePayload(ht,dt.rs,at),[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>ft.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>mt.decryptWithAd(ZEROLEN,yt,gt)}}const CHACHA_TAG_LENGTH=16;function encryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length);let it;nt instanceof Uint8Array?it=o.encrypt(nt.subarray(rt,ot)):it=o.encrypt(nt.sublist(rt,ot)),et==null||et.encryptedPackets.increment(),yield new Uint8ArrayList(uint16BEEncode(it.byteLength),it)}}}function decryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length),ot-CHACHA_TAG_LENGTHdecode$5(it,{lengthDecoder:uint16BEDecode}),decryptStream(tt,this.metrics),nt),rt}}function noise(o={}){return et=>new Noise(et,o)}const peerDiscoverySymbol$1=Symbol.for("@libp2p/peer-discovery");function setMaxListeners$7(){}const setMaxListeners$6=(o,...et)=>{try{[...et]}catch{}};var Yn,$a;let TypedEventEmitter$2=($a=class extends EventTarget{constructor(){super();fn(this,Yn,new Map);setMaxListeners$6(1/0,this)}listenerCount(tt){const nt=Mt(this,Yn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Yn).get(tt);ot==null&&(ot=[],Mt(this,Yn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Yn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Yn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Yn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Yn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Yn=new WeakMap,$a);const serviceCapabilities$4=Symbol.for("@libp2p/service-capabilities"),DNS4=base("dns4"),DNS6=base("dns6"),DNSADDR=base("dnsaddr"),DNS$1=or$1(base("dns"),DNSADDR,DNS4,DNS6),IP=or$1(base("ip4"),base("ip6")),TCP$1=or$1(and$1(IP,base("tcp")),and$1(DNS$1,base("tcp"))),UDP=and$1(IP,base("udp")),UTP=and$1(UDP,base("utp")),QUIC=and$1(UDP,base("quic")),QUICV1=and$1(UDP,base("quic-v1")),_WebSockets$1=or$1(and$1(TCP$1,base("ws")),and$1(DNS$1,base("ws"))),WebSockets$2=or$1(and$1(_WebSockets$1,base("p2p")),_WebSockets$1),_WebSocketsSecure$1=or$1(and$1(TCP$1,base("wss")),and$1(DNS$1,base("wss")),and$1(TCP$1,base("tls"),base("ws")),and$1(DNS$1,base("tls"),base("ws"))),WebSocketsSecure$1=or$1(and$1(_WebSocketsSecure$1,base("p2p")),_WebSocketsSecure$1),HTTP=or$1(and$1(TCP$1,base("http")),and$1(IP,base("http")),and$1(DNS$1,base("http"))),HTTPS=or$1(and$1(TCP$1,base("https")),and$1(IP,base("https")),and$1(DNS$1,base("https"))),_WebRTCDirect$1=and$1(UDP,base("webrtc-direct"),base("certhash")),WebRTCDirect$1=or$1(and$1(_WebRTCDirect$1,base("p2p")),_WebRTCDirect$1),_WebTransport$1=and$1(QUICV1,base("webtransport"),base("certhash"),base("certhash")),WebTransport$1=or$1(and$1(_WebTransport$1,base("p2p")),_WebTransport$1),P2PWebRTCStar=or$1(and$1(WebSockets$2,base("p2p-webrtc-star"),base("p2p")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"),base("p2p")),and$1(WebSockets$2,base("p2p-webrtc-star")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"))),P2PWebRTCDirect=or$1(and$1(HTTP,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTPS,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTP,base("p2p-webrtc-direct")),and$1(HTTPS,base("p2p-webrtc-direct"))),Reliable=or$1(_WebSockets$1,_WebSocketsSecure$1,HTTP,HTTPS,P2PWebRTCStar,P2PWebRTCDirect,TCP$1,UTP,QUIC,DNS$1,WebRTCDirect$1,WebTransport$1),_P2P$1=or$1(and$1(Reliable,base("p2p")),P2PWebRTCStar,P2PWebRTCDirect,WebRTCDirect$1,WebTransport$1,base("p2p")),_Circuit$1=or$1(and$1(_P2P$1,base("p2p-circuit"),_P2P$1),and$1(_P2P$1,base("p2p-circuit")),and$1(base("p2p-circuit"),_P2P$1),and$1(Reliable,base("p2p-circuit")),and$1(base("p2p-circuit"),Reliable),base("p2p-circuit")),CircuitRecursive=()=>or$1(and$1(_Circuit$1,CircuitRecursive),_Circuit$1),Circuit$1=CircuitRecursive(),P2P=or$1(and$1(Circuit$1,_P2P$1,Circuit$1),and$1(_P2P$1,Circuit$1),and$1(Circuit$1,_P2P$1),Circuit$1,_P2P$1);function makeMatchesFunction(o){function et(tt){let nt;try{nt=multiaddr(tt)}catch{return!1}const rt=o(nt.protoNames());return rt===null?!1:rt===!0||rt===!1?rt:rt.length===0}return et}function and$1(...o){function et(tt){if(tt.length(nt=typeof rt=="function"?rt().partialMatch(tt):rt.partialMatch(tt),Array.isArray(nt)&&(tt=nt),nt===null)),nt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function or$1(...o){function et(nt){let rt=null;return o.some(ot=>{const it=typeof ot=="function"?ot().partialMatch(nt):ot.partialMatch(nt);return it!=null?(rt=it,!0):!1}),rt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function base(o){const et=o;function tt(rt){let ot;try{ot=multiaddr(rt)}catch{return!1}const it=ot.protoNames();return it.length===1&&it[0]===et}function nt(rt){return rt.length===0?null:rt[0]===et?rt.slice(1):null}return{toString:function(){return et},matches:tt,partialMatch:nt}}const DEFAULT_BOOTSTRAP_TAG_NAME$1="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE$1=50,DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT=1e3;var _c,yl,xl,El;class Bootstrap extends(El=TypedEventEmitter$2,xl=peerDiscoverySymbol$1,yl=Symbol.toStringTag,_c=serviceCapabilities$4,El){constructor(tt,nt={list:[]}){if(nt.list==null||nt.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super();Ct(this,"log");Ct(this,"timer");Ct(this,"list");Ct(this,"timeout");Ct(this,"components");Ct(this,"_init");Ct(this,xl,this);Ct(this,yl,"@libp2p/bootstrap");Ct(this,_c,["@libp2p/peer-discovery"]);this.components=tt,this.log=tt.logger.forComponent("libp2p:bootstrap"),this.timeout=nt.timeout??DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT,this.list=[];for(const rt of nt.list){if(!P2P.matches(rt)){this.log.error("Invalid multiaddr");continue}const ot=multiaddr(rt),it=ot.getPeerId();if(it==null){this.log.error("Invalid bootstrap multiaddr without peer id");continue}const st={id:peerIdFromString$1(it),multiaddrs:[ot]};this.list.push(st)}this._init=nt}isStarted(){return!!this.timer}start(){this.isStarted()||(this.log("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(tt=>{this.log.error(tt)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(const tt of this.list){if(await this.components.peerStore.merge(tt.id,{tags:{[this._init.tagName??DEFAULT_BOOTSTRAP_TAG_NAME$1]:{value:this._init.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE$1,ttl:this._init.tagTTL}},multiaddrs:tt.multiaddrs}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:tt}),this.components.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error("could not dial bootstrap peer %p",tt.id,nt)})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}}Ct(Bootstrap,"tag","bootstrap");function bootstrap(o){return et=>new Bootstrap(et,o)}var hs;let UnsupportedProtocolError$1=(hs=class extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}},Ct(hs,"name","UnsupportedProtocolError"),hs);var ps;let InvalidMessageError$2=(ps=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(ps,"name","InvalidMessageError"),ps);function setMaxListeners$5(){}const setMaxListeners$4=(o,...et)=>{try{[...et]}catch{}},serviceCapabilities$3=Symbol.for("@libp2p/service-capabilities");var Envelope;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.publicKey!=null&&tt.publicKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.payloadType!=null&&tt.payloadType.byteLength>0&&(nt.uint32(18),nt.bytes(tt.payloadType)),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(26),nt.bytes(tt.payload)),tt.signature!=null&&tt.signature.byteLength>0&&(nt.uint32(42),nt.bytes(tt.signature)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={publicKey:alloc$2(0),payloadType:alloc$2(0),payload:alloc$2(0),signature:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.publicKey=tt.bytes();break}case 2:{ot.payloadType=tt.bytes();break}case 3:{ot.payload=tt.bytes();break}case 5:{ot.signature=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Envelope||(Envelope={}));class InvalidSignatureError extends Error{constructor(et="Invalid signature"){super(et),this.name="InvalidSignatureError"}}const cr=class cr{constructor(et){Ct(this,"publicKey");Ct(this,"payloadType");Ct(this,"payload");Ct(this,"signature");Ct(this,"marshaled");const{publicKey:tt,payloadType:nt,payload:rt,signature:ot}=et;this.publicKey=tt,this.payloadType=nt,this.payload=rt,this.signature=ot}marshal(){return this.marshaled==null&&(this.marshaled=Envelope.encode({publicKey:publicKeyToProtobuf(this.publicKey),payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(et){return equals(this.marshal(),et.marshal())}async validate(et){const tt=formatSignaturePayload(et,this.payloadType,this.payload);return this.publicKey.verify(tt.subarray(),this.signature)}};Ct(cr,"createFromProtobuf",async et=>{const tt=Envelope.decode(et),nt=publicKeyFromProtobuf(tt.publicKey);return new cr({publicKey:nt,payloadType:tt.payloadType,payload:tt.payload,signature:tt.signature})}),Ct(cr,"seal",async(et,tt)=>{if(tt==null)throw new Error("Missing private key");const nt=et.domain,rt=et.codec,ot=et.marshal(),it=formatSignaturePayload(nt,rt,ot),st=await tt.sign(it.subarray());return new cr({publicKey:tt.publicKey,payloadType:rt,payload:ot,signature:st})}),Ct(cr,"openAndCertify",async(et,tt)=>{const nt=await cr.createFromProtobuf(et);if(!await nt.validate(tt))throw new InvalidSignatureError("Envelope signature is not valid for the given domain");return nt});let RecordEnvelope=cr;const formatSignaturePayload=(o,et,tt)=>{const nt=fromString(o),rt=encode$a(nt.byteLength),ot=encode$a(et.length),it=encode$a(tt.length);return new Uint8ArrayList(rt,nt,ot,et,it,tt)};function arrayEquals(o,et){const tt=(nt,rt)=>nt.toString().localeCompare(rt.toString());return o.length!==et.length?!1:(et.sort(tt),o.sort(tt).every((nt,rt)=>et[rt].equals(nt)))}const ENVELOPE_DOMAIN_PEER_RECORD="libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD=Uint8Array.from([3,1]);var PeerRecord$1;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.multiaddr!=null&&rt.multiaddr.byteLength>0&&(ot.uint32(10),ot.bytes(rt.multiaddr)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={multiaddr:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.multiaddr=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.AddressInfo||(o.AddressInfo={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerId!=null&&tt.peerId.byteLength>0&&(nt.uint32(10),nt.bytes(tt.peerId)),tt.seq!=null&&tt.seq!==0n&&(nt.uint32(16),nt.uint64(tt.seq)),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(26),o.AddressInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerId:alloc$2(0),seq:0n,addresses:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.peerId=tt.bytes();break}case 2:{ot.seq=tt.uint64();break}case 3:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(o.AddressInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerRecord$1||(PeerRecord$1={}));const nr=class nr{constructor(et){Ct(this,"peerId");Ct(this,"multiaddrs");Ct(this,"seqNumber");Ct(this,"domain",nr.DOMAIN);Ct(this,"codec",nr.CODEC);Ct(this,"marshaled");const{peerId:tt,multiaddrs:nt,seqNumber:rt}=et;this.peerId=tt,this.multiaddrs=nt??[],this.seqNumber=rt??BigInt(Date.now())}marshal(){return this.marshaled==null&&(this.marshaled=PeerRecord$1.encode({peerId:this.peerId.toMultihash().bytes,seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(et=>({multiaddr:et.bytes}))})),this.marshaled}equals(et){return!(!(et instanceof nr)||!this.peerId.equals(et.peerId)||this.seqNumber!==et.seqNumber||!arrayEquals(this.multiaddrs,et.multiaddrs))}};Ct(nr,"createFromProtobuf",et=>{const tt=PeerRecord$1.decode(et),nt=peerIdFromMultihash(decode$6(tt.peerId)),rt=(tt.addresses??[]).map(it=>multiaddr(it.multiaddr)),ot=tt.seq;return new nr({peerId:nt,multiaddrs:rt,seqNumber:ot})}),Ct(nr,"DOMAIN",ENVELOPE_DOMAIN_PEER_RECORD),Ct(nr,"CODEC",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD);let PeerRecord=nr;function isAsyncIterable$4(o){return o[Symbol.asyncIterator]!=null}function drain(o){if(isAsyncIterable$4(o))return(async()=>{for await(const et of o);})();for(const et of o);}const CustomEvent$1=globalThis.CustomEvent??Event;async function*parallel(o,et={}){let tt=et.concurrency??1/0;tt<1&&(tt=1/0);const nt=et.ordered==null?!1:et.ordered,rt=new EventTarget,ot=[];let it=pDefer(),st=pDefer(),at=!1,ct,lt=!1;rt.addEventListener("task-complete",()=>{st.resolve()}),Promise.resolve().then(async()=>{try{for await(const mt of o){if(ot.length===tt&&(it=pDefer(),await it.promise),lt)break;const ft={done:!1};ot.push(ft),mt().then(yt=>{ft.done=!0,ft.ok=!0,ft.value=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))},yt=>{ft.done=!0,ft.err=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))})}at=!0,rt.dispatchEvent(new CustomEvent$1("task-complete"))}catch(mt){ct=mt,rt.dispatchEvent(new CustomEvent$1("task-complete"))}});function dt(){var mt;return nt?(mt=ot[0])==null?void 0:mt.done:!!ot.find(ft=>ft.done)}function*ht(){for(;ot.length>0&&ot[0].done;){const mt=ot[0];if(ot.shift(),mt.ok)yield mt.value;else throw lt=!0,it.resolve(),mt.err;it.resolve()}}function*pt(){for(;dt();)for(let mt=0;mt{const it=await tt.read(ot);return rt.decode(it)},write:async(rt,ot,it)=>{await tt.write(ot.encode(rt),it)},writeV:async(rt,ot,it)=>{await tt.writeV(rt.map(st=>ot.encode(st)),it)},pb:rt=>({read:async ot=>nt.read(rt,ot),write:async(ot,it)=>nt.write(ot,rt,it),writeV:async(ot,it)=>nt.writeV(ot,rt,it),unwrap:()=>nt}),unwrap:()=>tt.unwrap()};return nt}const IDENTIFY_PROTOCOL_VERSION="0.1.0",MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",MAX_IDENTIFY_MESSAGE_SIZE=1024*8,MAX_PUSH_CONCURRENCY=32;var Identify$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.protocolVersion!=null&&(nt.uint32(42),nt.string(tt.protocolVersion)),tt.agentVersion!=null&&(nt.uint32(50),nt.string(tt.agentVersion)),tt.publicKey!=null&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.listenAddrs!=null)for(const ot of tt.listenAddrs)nt.uint32(18),nt.bytes(ot);if(tt.observedAddr!=null&&(nt.uint32(34),nt.bytes(tt.observedAddr)),tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(26),nt.string(ot);tt.signedPeerRecord!=null&&(nt.uint32(66),nt.bytes(tt.signedPeerRecord)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={listenAddrs:[],protocols:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 5:{ot.protocolVersion=tt.string();break}case 6:{ot.agentVersion=tt.string();break}case 1:{ot.publicKey=tt.bytes();break}case 2:{if(((st=rt.limits)==null?void 0:st.listenAddrs)!=null&&ot.listenAddrs.length===rt.limits.listenAddrs)throw new MaxLengthError('Decode error - map field "listenAddrs" had too many elements');ot.listenAddrs.push(tt.bytes());break}case 4:{ot.observedAddr=tt.bytes();break}case 3:{if(((at=rt.limits)==null?void 0:at.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 8:{ot.signedPeerRecord=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Identify$1||(Identify$1={}));var define_process_default={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof define_process_default<"u"&&typeof define_process_default.versions=="object"&&define_process_default.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1;const detectElectron=getDefaultExportFromCjs(isElectron_1),isEnvWithDom=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,isElectron=detectElectron(),isBrowser=isEnvWithDom&&!isElectron,isElectronMain=isElectron&&!isEnvWithDom,isElectronRenderer=isElectron&&isEnvWithDom,isNode=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&globalThis.process.release.name==="node"&&!isElectron,isWebWorker=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",defaultValues={protocolPrefix:"ipfs",timeout:5e3,maxInboundStreams:1,maxOutboundStreams:1,maxObservedAddresses:10,maxMessageSize:MAX_IDENTIFY_MESSAGE_SIZE,runOnConnectionOpen:!0,runOnSelfUpdate:!0,runOnLimitedConnection:!0,concurrency:MAX_PUSH_CONCURRENCY};function getCleanMultiaddr(o){if(o!=null&&o.length>0)try{return multiaddr(o)}catch{}}function getAgentVersion(o,et){return et!=null||(et=`${o.name}/${o.version}`,isNode||isElectronMain?et+=` UserAgent=${globalThis.process.version}`:(isBrowser||isWebWorker||isElectronRenderer||isReactNative)&&(et+=` UserAgent=${globalThis.navigator.userAgent}`)),et}async function consumeIdentifyMessage(o,et,tt,nt,rt){if(tt("received identify from %p",nt.remotePeer),rt==null)throw new InvalidMessageError$2("message was null or undefined");const ot={};if(rt.listenAddrs.length>0&&(ot.addresses=rt.listenAddrs.map(at=>({isCertified:!1,multiaddr:multiaddr(at)}))),rt.protocols.length>0&&(ot.protocols=rt.protocols),rt.publicKey!=null){const at=publicKeyFromProtobuf(rt.publicKey);if(!peerIdFromPublicKey(at).equals(nt.remotePeer))throw new InvalidMessageError$2("public key did not match remote PeerId");ot.publicKey=at}let it;if(rt.signedPeerRecord!=null){tt.trace("received signedPeerRecord from %p",nt.remotePeer);let at=rt.signedPeerRecord;const ct=await RecordEnvelope.openAndCertify(at,PeerRecord.DOMAIN);let lt=PeerRecord.createFromProtobuf(ct.payload);const dt=peerIdFromCID(ct.publicKey.toCID());if(!lt.peerId.equals(dt))throw new InvalidMessageError$2("signing key does not match PeerId in the PeerRecord");if(!nt.remotePeer.equals(lt.peerId))throw new InvalidMessageError$2("signing key does not match remote PeerId");let ht;try{ht=await o.get(lt.peerId)}catch(pt){if(pt.name!=="NotFoundError")throw pt}if(ht!=null&&(ot.metadata=ht.metadata,ht.peerRecordEnvelope!=null)){const pt=await RecordEnvelope.createFromProtobuf(ht.peerRecordEnvelope),mt=PeerRecord.createFromProtobuf(pt.payload);mt.seqNumber>=lt.seqNumber&&(tt("sequence number was lower or equal to existing sequence number - stored: %d received: %d",mt.seqNumber,lt.seqNumber),lt=mt,at=ht.peerRecordEnvelope)}ot.peerRecordEnvelope=at,ot.addresses=lt.multiaddrs.map(pt=>({isCertified:!0,multiaddr:pt})),it={seq:lt.seqNumber,addresses:lt.multiaddrs}}else tt("%p did not send a signed peer record",nt.remotePeer);if(tt.trace("patching %p with",nt.remotePeer,ot),await o.patch(nt.remotePeer,ot),rt.agentVersion!=null||rt.protocolVersion!=null){const at={};rt.agentVersion!=null&&(at.AgentVersion=fromString(rt.agentVersion)),rt.protocolVersion!=null&&(at.ProtocolVersion=fromString(rt.protocolVersion)),tt.trace("merging %p metadata",nt.remotePeer,at),await o.merge(nt.remotePeer,{metadata:at})}const st={peerId:nt.remotePeer,protocolVersion:rt.protocolVersion,agentVersion:rt.agentVersion,publicKey:rt.publicKey,listenAddrs:rt.listenAddrs.map(at=>multiaddr(at)),observedAddr:rt.observedAddr==null?void 0:multiaddr(rt.observedAddr),protocols:rt.protocols,signedPeerRecord:it,connection:nt};return et.safeDispatchEvent("peer:identify",{detail:st}),st}class AbstractIdentify{constructor(et,tt){Ct(this,"host");Ct(this,"protocol");Ct(this,"started");Ct(this,"timeout");Ct(this,"peerId");Ct(this,"privateKey");Ct(this,"peerStore");Ct(this,"registrar");Ct(this,"addressManager");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"maxMessageSize");Ct(this,"maxObservedAddresses");Ct(this,"events");Ct(this,"runOnLimitedConnection");Ct(this,"log");this.protocol=tt.protocol,this.started=!1,this.peerId=et.peerId,this.privateKey=et.privateKey,this.peerStore=et.peerStore,this.registrar=et.registrar,this.addressManager=et.addressManager,this.events=et.events,this.log=tt.log,this.timeout=tt.timeout??defaultValues.timeout,this.maxInboundStreams=tt.maxInboundStreams??defaultValues.maxInboundStreams,this.maxOutboundStreams=tt.maxOutboundStreams??defaultValues.maxOutboundStreams,this.maxMessageSize=tt.maxMessageSize??defaultValues.maxMessageSize,this.maxObservedAddresses=tt.maxObservedAddresses??defaultValues.maxObservedAddresses,this.runOnLimitedConnection=tt.runOnLimitedConnection??defaultValues.runOnLimitedConnection,this.host={protocolVersion:`${tt.protocolPrefix??defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,agentVersion:getAgentVersion(et.nodeInfo,tt.agentVersion)}}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:fromString(this.host.agentVersion),ProtocolVersion:fromString(this.host.protocolVersion)}}),await this.registrar.handle(this.protocol,et=>{this.handleProtocol(et).catch(tt=>{this.log.error(tt)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0)}async stop(){await this.registrar.unhandle(this.protocol),this.started=!1}}var Netmask_1;(function(){var o,et,tt,nt,rt,ot,it,st;st=function(at){var ct,lt,dt,ht;return ct=(at&255<<24)>>>24,lt=(at&255<<16)>>>16,dt=(at&65280)>>>8,ht=at&255,[ct,lt,dt,ht].join(".")},it=function(at){var ct,lt,dt,ht,pt,mt;for(ct=[],dt=ht=0;ht<=3&&at.length!==0;dt=++ht){if(dt>0){if(at[0]!==".")throw new Error("Invalid IP");at=at.substring(1)}mt=et(at),pt=mt[0],lt=mt[1],at=at.substring(lt),ct.push(pt)}if(at.length!==0)throw new Error("Invalid IP");switch(ct.length){case 1:if(ct[0]>4294967295)throw new Error("Invalid IP");return ct[0]>>>0;case 2:if(ct[0]>255||ct[1]>16777215)throw new Error("Invalid IP");return(ct[0]<<24|ct[1])>>>0;case 3:if(ct[0]>255||ct[1]>255||ct[2]>65535)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2])>>>0;case 4:if(ct[0]>255||ct[1]>255||ct[2]>255||ct[3]>255)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2]<<8|ct[3])>>>0;default:throw new Error("Invalid IP")}},tt=function(at){return at.charCodeAt(0)},nt=tt("0"),ot=tt("a"),rt=tt("A"),et=function(at){var ct,lt,dt,ht,pt;for(ht=0,ct=10,lt="9",dt=0,at.length>1&&at[dt]==="0"&&(at[dt+1]==="x"||at[dt+1]==="X"?(dt+=2,ct=16):"0"<=at[dt+1]&&at[dt+1]<="9"&&(dt++,ct=8,lt="7")),pt=dt;dt>>0;else if(ct===16)if("a"<=at[dt]&&at[dt]<="f")ht=ht*ct+(10+tt(at[dt])-ot)>>>0;else if("A"<=at[dt]&&at[dt]<="F")ht=ht*ct+(10+tt(at[dt])-rt)>>>0;else break;else break;if(ht>4294967295)throw new Error("too large");dt++}if(dt===pt)throw new Error("empty octet");return[ht,dt]},o=function(){function at(ct,lt){var dt,ht,pt;if(typeof ct!="string")throw new Error("Missing `net' parameter");if(lt||(pt=ct.split("/",2),ct=pt[0],lt=pt[1]),lt||(lt=32),typeof lt=="string"&<.indexOf(".")>-1){try{this.maskLong=it(lt)}catch{throw new Error("Invalid mask: "+lt)}for(dt=ht=32;ht>=0;dt=--ht)if(this.maskLong===4294967295<<32-dt>>>0){this.bitmask=dt;break}}else if(lt||lt===0)this.bitmask=parseInt(lt,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(it(ct)&this.maskLong)>>>0}catch{throw new Error("Invalid net address: "+ct)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+lt);this.size=Math.pow(2,32-this.bitmask),this.base=st(this.netLong),this.mask=st(this.maskLong),this.hostmask=st(~this.maskLong),this.first=this.bitmask<=30?st(this.netLong+1):this.base,this.last=this.bitmask<=30?st(this.netLong+this.size-2):st(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?st(this.netLong+this.size-1):void 0}return at.prototype.contains=function(ct){return typeof ct=="string"&&(ct.indexOf("/")>0||ct.split(".").length!==4)&&(ct=new at(ct)),ct instanceof at?this.contains(ct.base)&&this.contains(ct.broadcast||ct.last):(it(ct)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},at.prototype.next=function(ct){return ct==null&&(ct=1),new at(st(this.netLong+this.size*ct),this.mask)},at.prototype.forEach=function(ct){var lt,dt,ht;for(ht=it(this.first),dt=it(this.last),lt=0;ht<=dt;)ct(st(ht),ht,lt),lt++,ht++},at.prototype.toString=function(){return this.base+"/"+this.bitmask},at}(),Netmask_1=o}).call(commonjsGlobal);const PRIVATE_IP_RANGES=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],NETMASK_RANGES=PRIVATE_IP_RANGES.map(o=>new Netmask_1(o));function ipv4Check(o){for(const et of NETMASK_RANGES)if(et.contains(o))return!0;return!1}function isIpv4MappedIpv6(o){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(o)}function ipv4MappedIpv6Check(o){const et=o.split(":");if(et.length<2)return!1;const tt=et[et.length-1].padStart(4,"0"),nt=et[et.length-2].padStart(4,"0"),rt=`${parseInt(nt.substring(0,2),16)}.${parseInt(nt.substring(2),16)}.${parseInt(tt.substring(0,2),16)}.${parseInt(tt.substring(2),16)}`;return ipv4Check(rt)}function isIpv4EmbeddedIpv6(o){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)}function ipv4EmbeddedIpv6Check(o){const et=o.split(":"),tt=et[et.length-1];return ipv4Check(tt)}function ipv6Check(o){return/^::$/.test(o)||/^::1$/.test(o)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(o)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(o)||/^ff([0-9a-fA-F]{2,2}):/i.test(o)}function isPrivateIp(o){return isIPv4(o)?ipv4Check(o):isIpv4MappedIpv6(o)?ipv4MappedIpv6Check(o):isIpv4EmbeddedIpv6(o)?ipv4EmbeddedIpv6Check(o):isIPv6(o)?ipv6Check(o):void 0}const toParts=o=>o.toString().split("/").slice(1),func=o=>({match:et=>et.length<1?!1:o(et[0])?et.slice(1):!1,pattern:"fn"}),literal=o=>({match:et=>func(tt=>tt===o).match(et),pattern:o}),string$3=()=>({match:o=>func(et=>typeof et=="string").match(o),pattern:"{string}"}),number$1=()=>({match:o=>func(et=>!isNaN(parseInt(et))).match(o),pattern:"{number}"}),peerId=()=>({match:o=>{if(o.length<2||o[0]!=="p2p"&&o[0]!=="ipfs")return!1;if(o[1].startsWith("Q")||o[1].startsWith("1"))try{base58btc.decode(`z${o[1]}`)}catch{return!1}else return!1;return o.slice(2)},pattern:"/p2p/{peerid}"}),certhash=()=>({match:o=>{if(o.length<2||o[0]!=="certhash")return!1;try{base64url.decode(o[1])}catch{return!1}return o.slice(2)},pattern:"/certhash/{certhash}"}),optional=o=>({match:et=>{const tt=o.match(et);return tt===!1?et:tt},pattern:`optional(${o.pattern})`}),or=(...o)=>({match:et=>{let tt;for(const nt of o){const rt=nt.match(et);rt!==!1&&(tt==null||rt.lengthet.pattern).join(", ")})`}),and=(...o)=>({match:et=>{for(const tt of o){const nt=tt.match(et);if(nt===!1)return!1;et=nt}return et},pattern:`and(${o.map(et=>et.pattern).join(", ")})`});function fmt(...o){function et(rt){let ot=toParts(rt);for(const it of o){const st=it.match(ot);if(st===!1)return!1;ot=st}return ot}function tt(rt){return et(rt)!==!1}function nt(rt){const ot=et(rt);return ot===!1?!1:ot.length===0}return{matchers:o,matches:tt,exactMatch:nt}}const _DNS4=and(literal("dns4"),string$3()),_DNS6=and(literal("dns6"),string$3()),_DNSADDR=and(literal("dnsaddr"),string$3()),_DNS=and(literal("dns"),string$3());fmt(_DNS4,optional(peerId()));fmt(_DNS6,optional(peerId()));fmt(_DNSADDR,optional(peerId()));fmt(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId()));const _IP4=and(literal("ip4"),func(isIPv4)),_IP6=and(literal("ip6"),func(isIPv6)),_IP=or(_IP4,_IP6),_IP_OR_DOMAIN=or(_IP,_DNS,_DNS4,_DNS6,_DNSADDR),IP_OR_DOMAIN=fmt(or(_IP,and(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId())))),_TCP=and(_IP_OR_DOMAIN,literal("tcp"),number$1()),_UDP=and(_IP_OR_DOMAIN,literal("udp"),number$1()),TCP=fmt(and(_TCP,optional(peerId()))),_QUIC=and(_UDP,literal("quic")),_QUICV1=and(_UDP,literal("quic-v1")),QUIC_V0_OR_V1=or(_QUIC,_QUICV1),_WEB=or(_IP_OR_DOMAIN,_TCP,_UDP,_QUIC,_QUICV1),_WebSockets=or(and(_WEB,literal("ws"),optional(peerId()))),WebSockets$1=fmt(_WebSockets),_WebSocketsSecure=or(and(_WEB,literal("wss"),optional(peerId())),and(_WEB,literal("tls"),optional(and(literal("sni"),string$3())),literal("ws"),optional(peerId()))),WebSocketsSecure=fmt(_WebSocketsSecure),_WebRTCDirect=and(_UDP,literal("webrtc-direct"),optional(certhash()),optional(certhash()),optional(peerId())),WebRTCDirect=fmt(_WebRTCDirect),_WebTransport=and(_QUICV1,literal("webtransport"),optional(certhash()),optional(certhash()),optional(peerId())),WebTransport=fmt(_WebTransport),_P2P=or(_WebSockets,_WebSocketsSecure,and(_TCP,optional(peerId())),and(QUIC_V0_OR_V1,optional(peerId())),and(_IP_OR_DOMAIN,optional(peerId())),_WebRTCDirect,_WebTransport,peerId()),_Circuit=and(_P2P,literal("p2p-circuit"),peerId()),Circuit=fmt(_Circuit),_WebRTC=or(and(_P2P,literal("p2p-circuit"),literal("webrtc"),optional(peerId())),and(_P2P,literal("webrtc"),optional(peerId())),and(literal("webrtc"),optional(peerId()))),WebRTC=fmt(_WebRTC);or(and(_IP_OR_DOMAIN,literal("tcp"),number$1(),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("http"),optional(peerId())));or(and(_IP_OR_DOMAIN,literal("tcp"),or(and(literal("443"),literal("http")),and(number$1(),literal("https"))),optional(peerId())),and(_IP_OR_DOMAIN,literal("tls"),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("https"),optional(peerId())));or(and(literal("memory"),string$3(),optional(peerId())));var wl,Cl;class Identify extends(Cl=AbstractIdentify,wl=serviceCapabilities$3,Cl){constructor(tt,nt={}){super(tt,{...nt,protocol:`/${nt.protocolPrefix??defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`,log:tt.logger.forComponent("libp2p:identify")});Ct(this,wl,["@libp2p/identify"]);(nt.runOnConnectionOpen??defaultValues.runOnConnectionOpen)&&tt.events.addEventListener("connection:open",rt=>{const ot=rt.detail;this.identify(ot).catch(it=>{it.name!==UnsupportedProtocolError$1.name&&this.log.error("error during identify trigged by connection:open",it)})})}async _identify(tt,nt={}){let rt;if(nt.signal==null){const ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot),nt={...nt,signal:ot}}try{rt=await tt.newStream(this.protocol,{...nt,runOnLimitedConnection:this.runOnLimitedConnection});const it=await pbStream(rt,{maxDataLength:this.maxMessageSize}).pb(Identify$1).read(nt);return await rt.close(nt),it}catch(ot){throw rt==null||rt.abort(ot),ot}}async identify(tt,nt={}){const rt=await this._identify(tt,nt),{publicKey:ot,protocols:it,observedAddr:st}=rt;if(ot==null)throw new InvalidMessageError$2("public key was missing from identify message");const at=publicKeyFromProtobuf(ot),ct=peerIdFromCID(at.toCID());if(!tt.remotePeer.equals(ct))throw new InvalidMessageError$2("identified peer does not match the expected peer");if(this.peerId.equals(ct))throw new InvalidMessageError$2("identified peer is our own peer id?");const lt=getCleanMultiaddr(st);return this.log("identify completed for peer %p and protocols %o",ct,it),lt!=null&&(this.log("our observed address was %a",lt),isPrivateIp(lt==null?void 0:lt.nodeAddress().address)===!0?this.log("our observed address was private"):this.addressManager.getObservedAddrs().length<(this.maxObservedAddresses??1/0)&&(this.log("storing our observed address"),this.addressManager.addObservedAddr(lt))),consumeIdentifyMessage(this.peerStore,this.events,this.log,tt,rt)}async handleProtocol(tt){const{connection:nt,stream:rt}=tt,ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot);try{const it=await this.peerStore.get(this.peerId),st=this.addressManager.getAddresses().map(dt=>dt.decapsulateCode(getProtocol("p2p").code));let at=it.peerRecordEnvelope;if(st.length>0&&at==null){const dt=new PeerRecord({peerId:this.peerId,multiaddrs:st});at=(await RecordEnvelope.seal(dt,this.privateKey)).marshal().subarray()}let ct=nt.remoteAddr.bytes;IP_OR_DOMAIN.matches(nt.remoteAddr)||(ct=void 0),await pbStream(rt).pb(Identify$1).write({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:publicKeyToProtobuf(this.privateKey.publicKey),listenAddrs:st.map(dt=>dt.bytes),signedPeerRecord:at,observedAddr:ct,protocols:it.protocols},{signal:ot}),await rt.close({signal:ot})}catch(it){this.log.error("could not respond to identify request",it),rt.abort(it)}}}function identify(o={}){return et=>new Identify(et,o)}class MuxerClosedError extends Error{constructor(et="The muxer is closed"){super(et),this.name="MuxerClosedError"}}Ct(MuxerClosedError,"name","MuxerClosedError");var gs;let InvalidMessageError$1=(gs=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(gs,"name","InvalidMessageError"),gs);var ys;let TooManyOutboundProtocolStreamsError$1=(ys=class extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}},Ct(ys,"name","TooManyOutboundProtocolStreamsError"),ys);const serviceCapabilities$2=Symbol.for("@libp2p/service-capabilities");function getIterator(o){if(o!=null){if(typeof o[Symbol.iterator]=="function")return o[Symbol.iterator]();if(typeof o[Symbol.asyncIterator]=="function")return o[Symbol.asyncIterator]();if(typeof o.next=="function")return o}throw new Error("argument is not an iterator or iterable")}function isPromise$2(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function closeSource(o,et){var nt,rt;const tt=(rt=(nt=getIterator(o)).return)==null?void 0:rt.call(nt);isPromise$2(tt)&&tt.catch(ot=>{et.error("could not cause iterator to return",ot)})}const createAbortError=()=>{const o=new Error("Delay aborted");return o.name="AbortError",o},clearMethods=new WeakMap;function createDelay({clearTimeout:o,setTimeout:et}={}){return(tt,{value:nt,signal:rt}={})=>{if(rt!=null&&rt.aborted)return Promise.reject(createAbortError());let ot,it,st;const at=o??clearTimeout,ct=()=>{at(ot),st(createAbortError())},lt=()=>{rt&&rt.removeEventListener("abort",ct)},dt=new Promise((ht,pt)=>{it=()=>{lt(),ht(nt)},st=pt,ot=(et??setTimeout)(it,tt)});return rt&&rt.addEventListener("abort",ct,{once:!0}),clearMethods.set(dt,()=>{at(ot),ot=null,it()}),dt}}const delay=createDelay();class RateLimitError extends Error{constructor(tt="Rate limit exceeded",nt){super(tt);Ct(this,"remainingPoints");Ct(this,"msBeforeNext");Ct(this,"consumedPoints");Ct(this,"isFirstInDuration");this.name="RateLimitError",this.remainingPoints=nt.remainingPoints,this.msBeforeNext=nt.msBeforeNext,this.consumedPoints=nt.consumedPoints,this.isFirstInDuration=nt.isFirstInDuration}}class QueueFullError extends Error{constructor(et="The queue was full"){super(et),this.name="QueueFullError"}}Ct(QueueFullError,"name","QueueFullError");class RateLimiter{constructor(et={}){Ct(this,"memoryStorage");Ct(this,"points");Ct(this,"duration");Ct(this,"blockDuration");Ct(this,"execEvenly");Ct(this,"execEvenlyMinDelayMs");Ct(this,"keyPrefix");this.points=et.points??4,this.duration=et.duration??1,this.blockDuration=et.blockDuration??0,this.execEvenly=et.execEvenly??!1,this.execEvenlyMinDelayMs=et.execEvenlyMinDelayMs??this.duration*1e3/this.points,this.keyPrefix=et.keyPrefix??"rlflx",this.memoryStorage=new MemoryStorage}async consume(et,tt=1,nt={}){const rt=this.getKey(et),ot=this._getKeySecDuration(nt);let it=this.memoryStorage.incrby(rt,tt,ot);if(it.remainingPoints=Math.max(this.points-it.consumedPoints,0),it.consumedPoints>this.points)throw this.blockDuration>0&&it.consumedPoints<=this.points+tt&&(it=this.memoryStorage.set(rt,it.consumedPoints,this.blockDuration)),new RateLimitError("Rate limit exceeded",it);if(this.execEvenly&&it.msBeforeNext>0&&!it.isFirstInDuration){let st=Math.ceil(it.msBeforeNext/(it.remainingPoints+2));st=0?nt:this.duration)*1e3;return this.memoryStorage.set(this.getKey(et),tt,nt),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:tt,isFirstInDuration:!1}}get(et){const tt=this.memoryStorage.get(this.getKey(et));return tt!=null&&(tt.remainingPoints=Math.max(this.points-tt.consumedPoints,0)),tt}delete(et){this.memoryStorage.delete(this.getKey(et))}_getKeySecDuration(et){return(et==null?void 0:et.customDuration)!=null&&et.customDuration>=0?et.customDuration:this.duration}getKey(et){return this.keyPrefix.length>0?`${this.keyPrefix}:${et}`:et}parseKey(et){return et.substring(this.keyPrefix.length)}}class MemoryStorage{constructor(){Ct(this,"storage");this.storage=new Map}incrby(et,tt,nt){const rt=this.storage.get(et);if(rt!=null){const ot=rt.expiresAt!=null?rt.expiresAt.getTime()-new Date().getTime():-1;return rt.expiresAt==null||ot>0?(rt.value+=tt,{remainingPoints:0,msBeforeNext:ot,consumedPoints:rt.value,isFirstInDuration:!1}):this.set(et,tt,nt)}return this.set(et,tt,nt)}set(et,tt,nt){const rt=nt*1e3,ot=this.storage.get(et);ot!=null&&clearTimeout(ot.timeoutId);const it={value:tt,expiresAt:rt>0?new Date(Date.now()+rt):void 0};return this.storage.set(et,it),rt>0&&(it.timeoutId=setTimeout(()=>{this.storage.delete(et)},rt),it.timeoutId.unref!=null&&it.timeoutId.unref()),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:it.value,isFirstInDuration:!0}}get(et){const tt=this.storage.get(et);if(tt!=null)return{remainingPoints:0,msBeforeNext:tt.expiresAt!=null?tt.expiresAt.getTime()-new Date().getTime():-1,consumedPoints:tt.value,isFirstInDuration:!1}}delete(et){const tt=this.storage.get(et);return tt!=null?(tt.timeoutId!=null&&clearTimeout(tt.timeoutId),this.storage.delete(et),!0):!1}}var MessageTypes;(function(o){o[o.NEW_STREAM=0]="NEW_STREAM",o[o.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",o[o.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",o[o.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",o[o.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",o[o.RESET_RECEIVER=5]="RESET_RECEIVER",o[o.RESET_INITIATOR=6]="RESET_INITIATOR"})(MessageTypes||(MessageTypes={}));const MessageTypeNames=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),InitiatorMessageTypes=Object.freeze({NEW_STREAM:MessageTypes.NEW_STREAM,MESSAGE:MessageTypes.MESSAGE_INITIATOR,CLOSE:MessageTypes.CLOSE_INITIATOR,RESET:MessageTypes.RESET_INITIATOR}),ReceiverMessageTypes=Object.freeze({MESSAGE:MessageTypes.MESSAGE_RECEIVER,CLOSE:MessageTypes.CLOSE_RECEIVER,RESET:MessageTypes.RESET_RECEIVER}),MAX_MSG_SIZE=1<<20,MAX_MSG_QUEUE_SIZE=4<<20;class Decoder{constructor(et=MAX_MSG_SIZE,tt=MAX_MSG_QUEUE_SIZE){Ct(this,"_buffer");Ct(this,"_headerInfo");Ct(this,"_maxMessageSize");Ct(this,"_maxUnprocessedMessageQueueSize");this._buffer=new Uint8ArrayList,this._headerInfo=null,this._maxMessageSize=et,this._maxUnprocessedMessageQueueSize=tt}write(et){if(et==null||et.length===0)return[];if(this._buffer.append(et),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw new InvalidMessageError$1("Unprocessed message queue size too large!");const tt=[];for(;this._buffer.length!==0;){if(this._headerInfo==null)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(ct){if(ct.name==="InvalidMessageError")throw ct;break}const{id:nt,type:rt,length:ot,offset:it}=this._headerInfo;if(this._buffer.length-itthis._maxMessageSize)throw new InvalidMessageError$1("Message size too large");return{id:tt>>3,type:it,offset:nt+ot,length:rt}}}const MSB=128,REST=127;function readVarInt(o,et=0){let tt=0,nt=0,rt=et,ot;const it=o.length;do{if(rt>=it||nt>49)throw et=0,new RangeError("Could not decode varint");ot=o.get(rt++),tt+=nt<28?(ot&REST)<=MSB);return et=rt-et,{value:tt,offset:et}}const POOL_SIZE=10*1024;class Encoder{constructor(){Ct(this,"_pool");Ct(this,"_poolOffset");this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0}write(et,tt){const nt=this._pool;let rt=this._poolOffset;encode$a(et.id<<3|et.type,nt,rt),rt+=encodingLength$3(et.id<<3|et.type),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null?(encode$a(et.data.length,nt,rt),rt+=encodingLength$3(et.data.length)):(encode$a(0,nt,rt),rt+=encodingLength$3(0));const ot=nt.subarray(this._poolOffset,rt);POOL_SIZE-rt<100?(this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0):this._poolOffset=rt,tt.append(ot),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null&&tt.append(et.data)}}const encoder$1=new Encoder;async function*encode$4(o){for await(const et of o){const tt=new Uint8ArrayList;encoder$1.write(et,tt),yield tt}}class StreamInputBufferError extends Error{constructor(et="Stream input buffer error"){super(et),this.name="StreamInputBufferError"}}var xs;let AbortError$6=(xs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(xs,"name","AbortError"),xs);class StreamResetError extends Error{constructor(et="The stream has been reset"){super(et),this.name="StreamResetError"}}Ct(StreamResetError,"name","StreamResetError");class StreamStateError extends Error{constructor(et="The stream is in an invalid state"){super(et),this.name="StreamStateError"}}Ct(StreamStateError,"name","StreamStateError");function setMaxListeners$3(){}const setMaxListeners$2=(o,...et)=>{try{[...et]}catch{}};var Zn,Sl;let TypedEventEmitter$1=(Sl=class extends EventTarget{constructor(){super();fn(this,Zn,new Map);setMaxListeners$2(1/0,this)}listenerCount(tt){const nt=Mt(this,Zn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Zn).get(tt);ot==null&&(ot=[],Mt(this,Zn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Zn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Zn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Zn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Zn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Zn=new WeakMap,Sl);const DEFAULT_SEND_CLOSE_WRITE_TIMEOUT=5e3;function isPromise$1(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}class AbstractStream{constructor(et){Ct(this,"id");Ct(this,"direction");Ct(this,"timeline");Ct(this,"protocol");Ct(this,"metadata");Ct(this,"source");Ct(this,"status");Ct(this,"readStatus");Ct(this,"writeStatus");Ct(this,"log");Ct(this,"sinkController");Ct(this,"sinkEnd");Ct(this,"closed");Ct(this,"endErr");Ct(this,"streamSource");Ct(this,"onEnd");Ct(this,"onCloseRead");Ct(this,"onCloseWrite");Ct(this,"onReset");Ct(this,"onAbort");Ct(this,"sendCloseWriteTimeout");Ct(this,"sendingData");this.sinkController=new AbortController,this.sinkEnd=pDefer(),this.closed=pDefer(),this.log=et.log,this.status="open",this.readStatus="ready",this.writeStatus="ready",this.id=et.id,this.metadata=et.metadata??{},this.direction=et.direction,this.timeline={open:Date.now()},this.sendCloseWriteTimeout=et.sendCloseWriteTimeout??DEFAULT_SEND_CLOSE_WRITE_TIMEOUT,this.onEnd=et.onEnd,this.onCloseRead=et==null?void 0:et.onCloseRead,this.onCloseWrite=et==null?void 0:et.onCloseWrite,this.onReset=et==null?void 0:et.onReset,this.onAbort=et==null?void 0:et.onAbort,this.source=this.streamSource=pushable({onEnd:tt=>{tt!=null?this.log.trace("source ended with error",tt):this.log.trace("source ended"),this.onSourceEnd(tt)}}),this.sink=this.sink.bind(this)}async sink(et){if(this.writeStatus!=="ready")throw new StreamStateError(`writable end state is "${this.writeStatus}" not "ready"`);try{this.writeStatus="writing";const tt={signal:this.sinkController.signal};if(this.direction==="outbound"){const rt=this.sendNewStream(tt);isPromise$1(rt)&&await rt}const nt=()=>{closeSource(et,this.log)};try{this.sinkController.signal.addEventListener("abort",nt),this.log.trace("sink reading from source");for await(let rt of et){rt=rt instanceof Uint8Array?new Uint8ArrayList(rt):rt;const ot=this.sendData(rt,tt);isPromise$1(ot)&&(this.sendingData=pDefer(),await ot,this.sendingData.resolve(),this.sendingData=void 0)}}finally{this.sinkController.signal.removeEventListener("abort",nt)}this.log.trace('sink finished reading from source, write status is "%s"',this.writeStatus),this.writeStatus==="writing"&&(this.writeStatus="closing",this.log.trace("send close write to remote"),await this.sendCloseWrite({signal:AbortSignal.timeout(this.sendCloseWriteTimeout)}),this.writeStatus="closed"),this.onSinkEnd()}catch(tt){throw this.log.trace("sink ended with error, calling abort with error",tt),this.abort(tt),tt}finally{this.log.trace("resolve sink end"),this.sinkEnd.resolve()}}onSourceEnd(et){var tt;this.timeline.closeRead==null&&(this.timeline.closeRead=Date.now(),this.readStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseRead)==null||tt.call(this),this.timeline.closeWrite!=null?(this.log.trace("source and sink ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("source ended, waiting for sink to end"))}onSinkEnd(et){var tt;this.timeline.closeWrite==null&&(this.timeline.closeWrite=Date.now(),this.writeStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseWrite)==null||tt.call(this),this.timeline.closeRead!=null?(this.log.trace("sink and source ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("sink ended, waiting for source to end"))}async close(et){this.log.trace("closing gracefully"),this.status="closing",await raceSignal(Promise.all([this.closeWrite(et),this.closeRead(et),this.closed.promise]),et==null?void 0:et.signal),this.status="closed",this.log.trace("closed gracefully")}async closeRead(et={}){if(this.readStatus==="closing"||this.readStatus==="closed")return;this.log.trace('closing readable end of stream with starting read status "%s"',this.readStatus);const tt=this.readStatus;this.readStatus="closing",this.status!=="reset"&&this.status!=="aborted"&&this.timeline.closeRead==null&&(this.log.trace("send close read to remote"),await this.sendCloseRead(et)),tt==="ready"&&(this.log.trace("ending internal source queue with %d queued bytes",this.streamSource.readableLength),this.streamSource.end()),this.log.trace("closed readable end of stream")}async closeWrite(et={}){this.writeStatus==="closing"||this.writeStatus==="closed"||(this.log.trace('closing writable end of stream with starting write status "%s"',this.writeStatus),this.writeStatus==="ready"&&(this.log.trace("sink was never sunk, sink an empty array"),await raceSignal(this.sink([]),et.signal)),this.writeStatus==="writing"&&(this.sendingData!=null&&await raceSignal(this.sendingData.promise,et.signal),this.log.trace("aborting source passed to .sink"),this.sinkController.abort(),await raceSignal(this.sinkEnd.promise,et.signal)),this.writeStatus="closed",this.log.trace("closed writable end of stream"))}abort(et){var nt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;this.log("abort with error",et),this.log("try to send reset to remote");const tt=this.sendReset();isPromise$1(tt)&&tt.catch(rt=>{this.log.error("error sending reset message",rt)}),this.status="aborted",this.timeline.abort=Date.now(),this._closeSinkAndSource(et),(nt=this.onAbort)==null||nt.call(this,et)}reset(){var tt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;const et=new StreamResetError("stream reset");this.status="reset",this.timeline.reset=Date.now(),this._closeSinkAndSource(et),(tt=this.onReset)==null||tt.call(this)}_closeSinkAndSource(et){this._closeSink(et),this._closeSource(et)}_closeSink(et){this.writeStatus==="writing"&&(this.log.trace("end sink source"),this.sinkController.abort()),this.onSinkEnd(et)}_closeSource(et){this.readStatus!=="closing"&&this.readStatus!=="closed"&&(this.log.trace("ending source with %d bytes to be read by consumer",this.streamSource.readableLength),this.readStatus="closing",this.streamSource.end(et))}remoteCloseWrite(){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("received remote close write but local source is already closed");return}this.log.trace("remote close write"),this._closeSource()}remoteCloseRead(){if(this.writeStatus==="closing"||this.writeStatus==="closed"){this.log("received remote close read but local sink is already closed");return}this.log.trace("remote close read"),this._closeSink()}destroy(){if(this.status==="closed"||this.status==="aborted"||this.status==="reset"){this.log("received destroy but we are already closed");return}this.log.trace("stream destroyed"),this._closeSinkAndSource()}sourcePush(et){this.streamSource.push(et)}sourceReadableLength(){return this.streamSource.readableLength}}class MplexStream extends AbstractStream{constructor(tt){super(tt);Ct(this,"name");Ct(this,"streamId");Ct(this,"send");Ct(this,"types");Ct(this,"maxDataSize");this.types=tt.direction==="outbound"?InitiatorMessageTypes:ReceiverMessageTypes,this.send=tt.send,this.name=tt.name,this.streamId=tt.streamId,this.maxDataSize=tt.maxDataSize}async sendNewStream(){await this.send({id:this.streamId,type:InitiatorMessageTypes.NEW_STREAM,data:new Uint8ArrayList(fromString(this.name))})}async sendData(tt){for(tt=tt.sublist();tt.byteLength>0;){const nt=Math.min(tt.byteLength,this.maxDataSize);await this.send({id:this.streamId,type:this.types.MESSAGE,data:tt.sublist(0,nt)}),tt.consume(nt)}}async sendReset(){await this.send({id:this.streamId,type:this.types.RESET})}async sendCloseWrite(){await this.send({id:this.streamId,type:this.types.CLOSE})}async sendCloseRead(){}}function createStream(o){const{id:et,name:tt,send:nt,onEnd:rt,type:ot="initiator",maxMsgSize:it=MAX_MSG_SIZE}=o;return new MplexStream({id:ot==="initiator"?`i${et}`:`r${et}`,streamId:et,name:`${tt??et}`,direction:ot==="initiator"?"outbound":"inbound",maxDataSize:it,onEnd:rt,send:nt,log:o.logger.forComponent(`libp2p:mplex:stream:${ot}:${et}`)})}const MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAM_BUFFER_SIZE=1024*1024*4,DISCONNECT_THRESHOLD=5,CLOSE_TIMEOUT$2=500;function printMessage(o){const et={...o,type:`${MessageTypeNames[o.type]} (${o.type})`};return o.type===MessageTypes.NEW_STREAM&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray())),(o.type===MessageTypes.MESSAGE_INITIATOR||o.type===MessageTypes.MESSAGE_RECEIVER)&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray(),"base16")),et}class MplexStreamMuxer{constructor(et,tt){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"sink");Ct(this,"source");Ct(this,"log");Ct(this,"_streamId");Ct(this,"_streams");Ct(this,"_init");Ct(this,"_source");Ct(this,"closeController");Ct(this,"rateLimiter");Ct(this,"closeTimeout");Ct(this,"logger");tt=tt??{},this.log=et.logger.forComponent("libp2p:mplex"),this.logger=et.logger,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=tt,this.closeTimeout=tt.closeTimeout??CLOSE_TIMEOUT$2,this.sink=this._createSink(),this._source=pushable({objectMode:!0,onEnd:()=>{for(const nt of this._streams.initiators.values())nt.destroy();for(const nt of this._streams.receivers.values())nt.destroy()}}),this.source=pipe(this._source,nt=>encode$4(nt)),this.closeController=new AbortController,this.rateLimiter=new RateLimiter({points:tt.disconnectThreshold??DISCONNECT_THRESHOLD,duration:1})}get streams(){const et=[];for(const tt of this._streams.initiators.values())et.push(tt);for(const tt of this._streams.receivers.values())et.push(tt);return et}newStream(et){if(this.closeController.signal.aborted)throw new MuxerClosedError("Muxer already closed");const tt=this._streamId++;et=et==null?tt.toString():et.toString();const nt=this._streams.initiators;return this._newStream({id:tt,name:et,type:"initiator",registry:nt})}async close(et){if(this.closeController.signal.aborted)return;const tt=(et==null?void 0:et.signal)??AbortSignal.timeout(this.closeTimeout);try{await Promise.all(this.streams.map(async nt=>nt.close({signal:tt}))),this._source.end(),await this._source.onEmpty({signal:tt}),this.closeController.abort()}catch(nt){this.abort(nt)}}abort(et){this.closeController.signal.aborted||(this.streams.forEach(tt=>{tt.abort(et)}),this.closeController.abort(et))}_newReceiverStream(et){const{id:tt,name:nt}=et,rt=this._streams.receivers;return this._newStream({id:tt,name:nt,type:"receiver",registry:rt})}_newStream(et){const{id:tt,name:nt,type:rt,registry:ot}=et;if(this.log("new %s stream %s",rt,tt),rt==="initiator"&&this._streams.initiators.size===(this._init.maxOutboundStreams??MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION))throw new TooManyOutboundProtocolStreamsError$1("Too many outbound streams open");if(ot.has(tt))throw new Error(`${rt} stream ${tt} already exists!`);const at=createStream({id:tt,name:nt,send:async ct=>{this.log.enabled&&this.log.trace("%s stream %s send",rt,tt,printMessage(ct)),this._source.push(ct)},type:rt,onEnd:()=>{this.log("%s stream with id %s and protocol %s ended",rt,tt,at.protocol),ot.delete(tt),this._init.onStreamEnd!=null&&this._init.onStreamEnd(at)},maxMsgSize:this._init.maxMsgSize,logger:this.logger});return ot.set(tt,at),at}_createSink(){return async tt=>{const nt=()=>{closeSource(tt,this.log)};this.closeController.signal.addEventListener("abort",nt);try{const rt=new Decoder(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const ot of tt)for(const it of rt.write(ot))await this._handleIncoming(it);this._source.end()}catch(rt){this.log("error in sink",rt),this._source.end(rt)}finally{this.closeController.signal.removeEventListener("abort",nt)}}}async _handleIncoming(et){const{id:tt,type:nt}=et;if(this.log.enabled&&this.log.trace("incoming message",printMessage(et)),et.type===MessageTypes.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)){this.log("too many inbound streams open"),this._source.push({id:tt,type:MessageTypes.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{this.log("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),this.abort(new Error("Too many open streams"));return}return}const st=this._newReceiverStream({id:tt,name:toString$8(et.data instanceof Uint8Array?et.data:et.data.subarray())});this._init.onIncomingStream!=null&&this._init.onIncomingStream(st);return}const ot=((nt&1)===1?this._streams.initiators:this._streams.receivers).get(tt);if(ot==null){this.log("missing stream %s for message type %s",tt,MessageTypeNames[nt]);try{await this.rateLimiter.consume("missing-stream",1)}catch{this.log("rate limit hit when receiving messages for streams that do not exist - closing remote connection"),this.abort(new Error("Too many messages for missing streams"));return}return}const it=this._init.maxStreamBufferSize??MAX_STREAM_BUFFER_SIZE;try{switch(nt){case MessageTypes.MESSAGE_INITIATOR:case MessageTypes.MESSAGE_RECEIVER:if(ot.sourceReadableLength()>it)throw this._source.push({id:et.id,type:nt===MessageTypes.MESSAGE_INITIATOR?MessageTypes.RESET_RECEIVER:MessageTypes.RESET_INITIATOR}),new StreamInputBufferError("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers");ot.sourcePush(et.data);break;case MessageTypes.CLOSE_INITIATOR:case MessageTypes.CLOSE_RECEIVER:ot.remoteCloseWrite();break;case MessageTypes.RESET_INITIATOR:case MessageTypes.RESET_RECEIVER:ot.reset();break;default:this.log("unknown message type %s",nt)}}catch(st){this.log.error("error while processing message",st),ot.abort(st)}}}var Al,Rl;Rl=Symbol.toStringTag,Al=serviceCapabilities$2;class Mplex{constructor(et,tt={}){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"_init");Ct(this,"components");Ct(this,Rl,"@libp2p/mplex");Ct(this,Al,["@libp2p/stream-multiplexing"]);this.components=et,this._init=tt}createStreamMuxer(et={}){return new MplexStreamMuxer(this.components,{...et,...this._init})}}function mplex(o={}){return et=>new Mplex(et,o)}function isAsyncIterable$3(o){return o[Symbol.asyncIterator]!=null}function first(o){if(isAsyncIterable$3(o))return(async()=>{for await(const et of o)return et})();for(const et of o)return et}const PING_LENGTH$1=32,PROTOCOL_VERSION$1="1.0.0",PROTOCOL_NAME$1="ping",PROTOCOL_PREFIX$1="ipfs",TIMEOUT=1e4,MAX_INBOUND_STREAMS=2,MAX_OUTBOUND_STREAMS=1;var _l;_l=Symbol.toStringTag;class PingService{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"started");Ct(this,"timeout");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"runOnLimitedConnection");Ct(this,"log");Ct(this,_l,"@libp2p/ping");this.components=et,this.log=et.logger.forComponent("libp2p:ping"),this.started=!1,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX$1}/${PROTOCOL_NAME$1}/${PROTOCOL_VERSION$1}`,this.timeout=tt.timeout??TIMEOUT,this.maxInboundStreams=tt.maxInboundStreams??MAX_INBOUND_STREAMS,this.maxOutboundStreams=tt.maxOutboundStreams??MAX_OUTBOUND_STREAMS,this.runOnLimitedConnection=tt.runOnLimitedConnection??!0,this.handleMessage=this.handleMessage.bind(this)}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(et){this.log("incoming ping from %p",et.connection.remotePeer);const{stream:tt}=et,nt=Date.now();AbortSignal.timeout(this.timeout).addEventListener("abort",()=>{tt==null||tt.abort(new TimeoutError$3("ping timeout"))}),pipe(tt,async function*(ot){let it=0;for await(const st of ot){if(it+=st.byteLength,it>PING_LENGTH$1){tt==null||tt.abort(new InvalidMessageError$3("Too much data received"));return}yield st}},tt).catch(ot=>{this.log.error("incoming ping from %p failed with error",et.connection.remotePeer,ot),tt==null||tt.abort(ot)}).finally(()=>{const ot=Date.now()-nt;this.log("incoming ping from %p complete in %dms",et.connection.remotePeer,ot)})}async ping(et,tt={}){var at,ct;this.log("pinging %p",et);const nt=Date.now(),rt=randomBytes(PING_LENGTH$1),ot=await this.components.connectionManager.openConnection(et,tt);let it,st=()=>{};if(tt.signal==null){const lt=AbortSignal.timeout(this.timeout);tt={...tt,signal:lt}}try{it=await ot.newStream(this.protocol,{...tt,runOnLimitedConnection:this.runOnLimitedConnection}),st=()=>{it==null||it.abort(new AbortError$9)},(at=tt.signal)==null||at.addEventListener("abort",st,{once:!0});const lt=await pipe([rt],it,async ht=>first(ht)),dt=Date.now()-nt;if(lt==null)throw new ProtocolError(`Did not receive a ping ack after ${dt}ms`);if(!equals(rt,lt.subarray()))throw new ProtocolError(`Received wrong ping ack after ${dt}ms`);return this.log("ping %p complete in %dms",ot.remotePeer,dt),dt}catch(lt){throw this.log.error("error while pinging %p",ot.remotePeer,lt),it==null||it.abort(lt),lt}finally{(ct=tt.signal)==null||ct.removeEventListener("abort",st),it!=null&&await it.close()}}}function ping(o={}){return et=>new PingService(et,o)}const transportSymbol=Symbol.for("@libp2p/transport");var FaultTolerance$1;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance$1||(FaultTolerance$1={}));var vs;let AbortError$5=(vs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(vs,"name","AbortError"),vs);class ConnectionFailedError extends Error{constructor(et="Connection failed"){super(et),this.name="ConnectionFailedError"}}Ct(ConnectionFailedError,"name","ConnectionFailedError");const serviceCapabilities$1=Symbol.for("@libp2p/service-capabilities"),ASSUME_HTTP_CODES=[getProtocol("tcp").code,getProtocol("dns").code,getProtocol("dnsaddr").code,getProtocol("dns4").code,getProtocol("dns6").code];function extractSNI(o){var et;return(et=extractTuple("sni",o))==null?void 0:et[1]}function extractPort(o){var tt;const et=(tt=extractTuple("tcp",o))==null?void 0:tt[1];return et==null?"":`:${et}`}function extractTuple(o,et){let tt;try{tt=getProtocol(o).code}catch{return}for(const[nt,rt]of et)if(nt===tt&&rt!=null)return[nt,rt]}function hasTLS(o){return o.some(([et,tt])=>et===getProtocol("tls").code)}function interpretNext(o,et,tt){const nt=interpreters[getProtocol(o).name];if(nt==null)throw new Error(`Can't interpret protocol ${getProtocol(o).name}`);const rt=nt(et,tt);return o===getProtocol("ip6").code?`[${rt}]`:rt}const interpreters={ip4:(o,et)=>o,ip6:(o,et)=>et.length===0?o:`[${o}]`,tcp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`tcp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},udp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`udp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},dnsaddr:(o,et)=>o,dns4:(o,et)=>o,dns6:(o,et)=>o,dns:(o,et)=>o,ipfs:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/ipfs/${o}`},p2p:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p/${o}`},http:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`https://${nt}${rt}`;const ot=tt?"https://":"http://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},"http-path":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");const nt=interpretNext(tt[0],tt[1]??"",et),rt=decodeURIComponent(o);return`${nt}/${rt}`},tls:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},sni:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},https:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`https://${nt}`},ws:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`wss://${nt}${rt}`;const ot=tt?"wss://":"ws://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},wss:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`wss://${nt}`},"p2p-websocket-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-websocket-star`},"p2p-webrtc-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-star`},"p2p-webrtc-direct":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-direct`}};function multiaddrToUri(o,et){const nt=multiaddr(o).stringTuples(),rt=nt.pop();if(rt==null)throw new Error("Unexpected end of multiaddr");const ot=getProtocol(rt[0]),it=interpreters[ot.name];if(it==null)throw new Error(`No interpreter found for ${ot.name}`);let st=it(rt[1]??"",nt);return ASSUME_HTTP_CODES.includes(rt[0])&&(st=st.replace(/^.*:\/\//,""),rt[1]==="443"?st=`https://${st}`:st=`http://${st}`),(st.startsWith("http://")||st.startsWith("https://")||st.startsWith("ws://")||st.startsWith("wss://"))&&(st=new URL(st).toString(),st.endsWith("/")&&(st=st.substring(0,st.length-1))),st}const ready=async o=>{if(o.readyState>=2)throw new Error("socket closed");o.readyState!==1&&await new Promise((et,tt)=>{function nt(){o.removeEventListener("open",rt),o.removeEventListener("error",ot)}function rt(){nt(),et()}function ot(it){nt(),tt(it.error??new Error(`connect ECONNREFUSED ${o.url}`))}o.addEventListener("open",rt),o.addEventListener("error",ot)})},sink=(o,et)=>(et=et??{},et.closeOnEnd=et.closeOnEnd!==!1,async nt=>{for await(const rt of nt){try{await ready(o)}catch(ot){if(ot.message==="socket closed")break;throw ot}if(o.readyState===o.CLOSING||o.readyState===o.CLOSED)break;o.send(rt)}et.closeOnEnd!=null&&o.readyState<=1&&await new Promise((rt,ot)=>{o.addEventListener("close",it=>{if(it.wasClean||it.code===1006)rt();else{const st=Object.assign(new Error("ws error"),{event:it});ot(st)}}),setTimeout(()=>{o.close()})})});var dom={},eventIterator={};Object.defineProperty(eventIterator,"__esModule",{value:!0});class EventQueue{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(et){if(this.isStopped)return;const tt={value:et,done:!1};if(this.pullQueue.length){const nt=this.pullQueue.shift();nt&&nt.resolve(tt)}else this.pushQueue.push(Promise.resolve(tt)),this.highWaterMark!==void 0&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const et of this.pullQueue)et.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(et){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const tt of this.pullQueue)tt.reject(et);this.pullQueue.length=0}else{const tt=Promise.reject(et);tt.catch(()=>{}),this.pushQueue.push(tt)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:et=>{const tt=this.pushQueue.shift();return tt?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),tt):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((nt,rt)=>{this.pullQueue.push({resolve:nt,reject:rt})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}let EventIterator$1=class{constructor(et,{highWaterMark:tt=100,lowWaterMark:nt=1}={}){const rt=new EventQueue;rt.highWaterMark=tt,rt.lowWaterMark=nt,rt.removeCallback=et({push:ot=>rt.push(ot),stop:()=>rt.stop(),fail:ot=>rt.fail(ot),on:(ot,it)=>{rt.eventHandlers[ot]=it}})||(()=>{}),this[Symbol.asyncIterator]=()=>rt[Symbol.asyncIterator](),Object.freeze(this)}};eventIterator.EventIterator=EventIterator$1;eventIterator.default=EventIterator$1;Object.defineProperty(dom,"__esModule",{value:!0});const event_iterator_1=eventIterator;var EventIterator=dom.EventIterator=event_iterator_1.EventIterator;function subscribe(o,et,tt){return new event_iterator_1.EventIterator(({push:nt})=>(this.addEventListener(o,nt,et),()=>this.removeEventListener(o,nt,et)),tt)}dom.subscribe=subscribe;dom.default=event_iterator_1.EventIterator;function isArrayBuffer(o){var et;return o instanceof ArrayBuffer||((et=o==null?void 0:o.constructor)==null?void 0:et.name)==="ArrayBuffer"&&typeof(o==null?void 0:o.byteLength)=="number"}const source=o=>{o.binaryType="arraybuffer";const et=async()=>{await new Promise((ot,it)=>{if(nt){ot();return}if(rt!=null){it(rt);return}const st=lt=>{o.removeEventListener("open",at),o.removeEventListener("error",ct),lt()},at=()=>{st(ot)},ct=lt=>{st(()=>{it(lt.error??new Error(`connect ECONNREFUSED ${o.url}`))})};o.addEventListener("open",at),o.addEventListener("error",ct)})},tt=async function*(){const ot=new EventIterator(({push:it,stop:st,fail:at})=>{const ct=dt=>{let ht=null;typeof dt.data=="string"&&(ht=fromString(dt.data)),isArrayBuffer(dt.data)&&(ht=new Uint8Array(dt.data)),dt.data instanceof Uint8Array&&(ht=dt.data),ht!=null&&it(ht)},lt=dt=>{at(dt.error??new Error("Socket error"))};return o.addEventListener("message",ct),o.addEventListener("error",lt),o.addEventListener("close",st),()=>{o.removeEventListener("message",ct),o.removeEventListener("error",lt),o.removeEventListener("close",st)}},{highWaterMark:1/0});await et();for await(const it of ot)yield isArrayBuffer(it)?new Uint8Array(it):it}();let nt=o.readyState===1,rt;return o.addEventListener("open",()=>{nt=!0,rt=null}),o.addEventListener("close",()=>{nt=!1,rt=null}),o.addEventListener("error",ot=>{nt||(rt=ot.error??new Error(`connect ECONNREFUSED ${o.url}`))}),Object.assign(tt,{connected:et})},duplex=(o,et)=>{et=et??{};const tt=source(o);let nt=et.remoteAddress,rt=et.remotePort;if(o.url!=null)try{const it=new URL(o.url);nt=it.hostname,rt=parseInt(it.port,10)}catch{}if(nt==null||rt==null)throw new Error("Remote connection did not have address and/or port");return{sink:sink(o,et),source:tt,connected:async()=>{await tt.connected()},close:async()=>{(o.readyState===o.CONNECTING||o.readyState===o.OPEN)&&await new Promise(it=>{o.addEventListener("close",()=>{it()}),o.close()})},destroy:()=>{o.terminate!=null?o.terminate():o.close()},remoteAddress:nt,remotePort:rt,socket:o}},WebSocket$1=WebSocket,map={"http:":"ws:","https:":"wss:"},defaultProtocol="ws:",wsurl=(o,et)=>{if(o.startsWith("//")&&(o=`${(et==null?void 0:et.protocol)??defaultProtocol}${o}`),o.startsWith("/")&&et!=null){const nt=et.protocol??defaultProtocol,rt=et.host,ot=et.port!=null&&(rt==null?void 0:rt.endsWith(`:${et.port}`))!==!0?`:${et.port}`:"";o=`${nt}//${rt}${ot}${o}`}const tt=new URL(o);for(const[nt,rt]of Object.entries(map))tt.protocol===nt&&(tt.protocol=rt);return tt};function connect(o,et){const tt=typeof window>"u"?void 0:window.location;et=et??{};const nt=wsurl(o,tt),rt=new WebSocket$1(nt.toString(),et.websocket);return duplex(rt,et)}class CustomProgressEvent extends Event{constructor(tt,nt){super(tt);Ct(this,"type");Ct(this,"detail");this.type=tt,this.detail=nt}}function all$1(o){return o.filter(et=>WebSocketsSecure.exactMatch(et)||WebSockets$1.exactMatch(et))}function wss(o){return o.filter(et=>WebSocketsSecure.exactMatch(et))}function createListener(){throw new Error("WebSocket Servers can not be created in the browser!")}const CLOSE_TIMEOUT$1=500;function socketToMaConn(o,et,tt){const nt=tt.logger.forComponent("libp2p:websockets:maconn"),rt=tt.metrics,ot=tt.metricPrefix??"",it={log:nt,async sink(st){try{await o.sink(async function*(){for await(const at of st)at instanceof Uint8Array?yield at:yield at.subarray()}())}catch(at){at.type!=="aborted"&&nt.error(at)}},source:o.source,remoteAddr:et,timeline:{open:Date.now()},async close(st={}){var lt,dt;const at=Date.now();if(st.signal==null){const ht=AbortSignal.timeout(CLOSE_TIMEOUT$1);st={...st,signal:ht}}const ct=()=>{const{host:ht,port:pt}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s after %dms, destroying it manually",ht,pt,Date.now()-at),this.abort(new AbortError$5("Socket close timeout"))};(lt=st.signal)==null||lt.addEventListener("abort",ct);try{await o.close()}catch(ht){nt.error("error closing WebSocket gracefully",ht),this.abort(ht)}finally{(dt=st.signal)==null||dt.removeEventListener("abort",ct),it.timeline.close=Date.now()}},abort(st){const{host:at,port:ct}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s due to error",at,ct,st),o.destroy(),it.timeline.close=Date.now(),rt==null||rt.increment({[`${ot}error`]:!0})}};return o.socket.addEventListener("close",()=>{rt==null||rt.increment({[`${ot}close`]:!0}),it.timeline.close==null&&(it.timeline.close=Date.now())},{once:!0}),it}var Il,Tl,Pl;Pl=transportSymbol,Tl=Symbol.toStringTag,Il=serviceCapabilities$1;class WebSockets{constructor(et,tt){Ct(this,"log");Ct(this,"init");Ct(this,"logger");Ct(this,"metrics");Ct(this,"components");Ct(this,Pl,!0);Ct(this,Tl,"@libp2p/websockets");Ct(this,Il,["@libp2p/transport"]);this.log=et.logger.forComponent("libp2p:websockets"),this.logger=et.logger,this.components=et,this.init=tt,et.metrics!=null&&(this.metrics={dialerEvents:et.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}async dial(et,tt){var it;this.log("dialing %s",et),tt=tt??{};const nt=await this._connect(et,tt),rt=socketToMaConn(nt,et,{logger:this.logger,metrics:(it=this.metrics)==null?void 0:it.dialerEvents});this.log("new outbound connection %s",rt.remoteAddr);const ot=await tt.upgrader.upgradeOutbound(rt,tt);return this.log("outbound connection %s upgraded",rt.remoteAddr),ot}async _connect(et,tt){var it,st,at,ct,lt;(it=tt==null?void 0:tt.signal)==null||it.throwIfAborted();const nt=et.toOptions();this.log("dialing %s:%s",nt.host,nt.port);const rt=pDefer(),ot=connect(multiaddrToUri(et),this.init);ot.socket.addEventListener("error",()=>{var ht;const dt=new ConnectionFailedError(`Could not connect to ${et.toString()}`);this.log.error("connection error:",dt),(ht=this.metrics)==null||ht.dialerEvents.increment({error:!0}),rt.reject(dt)});try{(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("websockets:open-connection")),await raceSignal(Promise.race([ot.connected(),rt.promise]),tt.signal)}catch(dt){throw((at=tt.signal)==null?void 0:at.aborted)===!0&&((ct=this.metrics)==null||ct.dialerEvents.increment({abort:!0})),ot.close().catch(ht=>{this.log.error("error closing raw socket",ht)}),dt}return this.log("connected %s",et),(lt=this.metrics)==null||lt.dialerEvents.increment({connect:!0}),ot}createListener(et){return createListener({logger:this.logger,metrics:this.components.metrics},{...this.init,...et})}listenFilter(et){var tt,nt;return et=Array.isArray(et)?et:[et],((tt=this.init)==null?void 0:tt.filter)!=null?(nt=this.init)==null?void 0:nt.filter(et):isBrowser||isWebWorker?wss(et):all$1(et)}dialFilter(et){return this.listenFilter(et)}}function webSockets(o={}){return et=>new WebSockets(et,o)}const connectionSymbol=Symbol.for("@libp2p/connection"),contentRoutingSymbol=Symbol.for("@libp2p/content-routing"),peerDiscoverySymbol=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$1=Symbol.for("@libp2p/peer-id");function isPeerId$1(o){return!!(o!=null&&o[peerIdSymbol$1])}const peerRoutingSymbol=Symbol.for("@libp2p/peer-routing"),KEEP_ALIVE="keep-alive";var FaultTolerance;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance||(FaultTolerance={}));var bs;let AbortError$4=(bs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(bs,"name","AbortError"),bs);var Es;let InvalidParametersError$1=(Es=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(Es,"name","InvalidParametersError"),Es);class ConnectionClosingError extends Error{constructor(et="The connection is closing"){super(et),this.name="ConnectionClosingError"}}Ct(ConnectionClosingError,"name","ConnectionClosingError");class ConnectionClosedError extends Error{constructor(et="The connection is closed"){super(et),this.name="ConnectionClosedError"}}Ct(ConnectionClosedError,"name","ConnectionClosedError");var ws;let NotFoundError$1=(ws=class extends Error{constructor(et="Not found"){super(et),this.name="NotFoundError"}},Ct(ws,"name","NotFoundError"),ws);class InvalidPeerIdError extends Error{constructor(et="Invalid PeerID"){super(et),this.name="InvalidPeerIdError"}}Ct(InvalidPeerIdError,"name","InvalidPeerIdError");class InvalidMultiaddrError extends Error{constructor(et="Invalid multiaddr"){super(et),this.name="InvalidMultiaddrError"}}Ct(InvalidMultiaddrError,"name","InvalidMultiaddrError");var Cs;let TimeoutError$2=(Cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(Cs,"name","TimeoutError"),Cs);class NotStartedError extends Error{constructor(et="Not started"){super(et),this.name="NotStartedError"}}Ct(NotStartedError,"name","NotStartedError");class DialError extends Error{constructor(et="Dial error"){super(et),this.name="DialError"}}Ct(DialError,"name","DialError");class LimitedConnectionError extends Error{constructor(et="Limited connection"){super(et),this.name="LimitedConnectionError"}}Ct(LimitedConnectionError,"name","LimitedConnectionError");class TooManyInboundProtocolStreamsError extends Error{constructor(et="Too many inbound protocol streams"){super(et),this.name="TooManyInboundProtocolStreamsError"}}Ct(TooManyInboundProtocolStreamsError,"name","TooManyInboundProtocolStreamsError");class TooManyOutboundProtocolStreamsError extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}}Ct(TooManyOutboundProtocolStreamsError,"name","TooManyOutboundProtocolStreamsError");function setMaxListeners$1(){}const setMaxListeners=(o,...et)=>{try{[...et]}catch{}};var Xn;class TypedEventEmitter extends EventTarget{constructor(){super();fn(this,Xn,new Map);setMaxListeners(1/0,this)}listenerCount(tt){const nt=Mt(this,Xn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Xn).get(tt);ot==null&&(ot=[],Mt(this,Xn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Xn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Xn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Xn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Xn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}}Xn=new WeakMap;function isStartable(o){return o!=null&&typeof o.start=="function"&&typeof o.stop=="function"}async function start(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStart!=null&&await tt.beforeStart()})),await Promise.all(et.map(async tt=>{await tt.start()})),await Promise.all(et.map(async tt=>{tt.afterStart!=null&&await tt.afterStart()}))}async function stop(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStop!=null&&await tt.beforeStop()})),await Promise.all(et.map(async tt=>{await tt.stop()})),await Promise.all(et.map(async tt=>{tt.afterStop!=null&&await tt.afterStop()}))}const serviceCapabilities=Symbol.for("@libp2p/service-capabilities"),serviceDependencies=Symbol.for("@libp2p/service-dependencies");let TimeoutError$1=class extends Error{constructor(et){super(et),this.name="TimeoutError"}},AbortError$3=class extends Error{constructor(et){super(),this.name="AbortError",this.message=et}};const getDOMException=o=>globalThis.DOMException===void 0?new AbortError$3(o):new DOMException(o),getAbortedReason=o=>{const et=o.reason===void 0?getDOMException("This operation was aborted."):o.reason;return et instanceof Error?et:getDOMException(et)};function pTimeout(o,et){const{milliseconds:tt,fallback:nt,message:rt,customTimers:ot={setTimeout,clearTimeout}}=et;let it;const at=new Promise((ct,lt)=>{if(typeof tt!="number"||Math.sign(tt)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${tt}\``);if(et.signal){const{signal:ht}=et;ht.aborted&<(getAbortedReason(ht));const pt=()=>{lt(getAbortedReason(ht))};ht.addEventListener("abort",pt,{once:!0}),o.finally(()=>{ht.removeEventListener("abort",pt)})}if(tt===Number.POSITIVE_INFINITY){o.then(ct,lt);return}const dt=new TimeoutError$1;it=ot.setTimeout.call(void 0,()=>{if(nt){try{ct(nt())}catch(ht){lt(ht)}return}typeof o.cancel=="function"&&o.cancel(),rt===!1?ct():rt instanceof Error?lt(rt):(dt.message=rt??`Promise timed out after ${tt} milliseconds`,lt(dt))},tt),(async()=>{try{ct(await o)}catch(ht){lt(ht)}})()}).finally(()=>{at.clear()});return at.clear=()=>{ot.clearTimeout.call(void 0,it),it=void 0},at}function lowerBound(o,et,tt){let nt=0,rt=o.length;for(;rt>0;){const ot=Math.trunc(rt/2);let it=nt+ot;tt(o[it],et)<=0?(nt=++it,rt-=ot+1):rt=ot}return nt}var Jn,Ll;let PriorityQueue$1=(Ll=class{constructor(){fn(this,Jn,[])}enqueue(et,tt){tt={priority:0,...tt};const nt={priority:tt.priority,run:et};if(this.size&&Mt(this,Jn)[this.size-1].priority>=tt.priority){Mt(this,Jn).push(nt);return}const rt=lowerBound(Mt(this,Jn),nt,(ot,it)=>it.priority-ot.priority);Mt(this,Jn).splice(rt,0,nt)}dequeue(){const et=Mt(this,Jn).shift();return et==null?void 0:et.run}filter(et){return Mt(this,Jn).filter(tt=>tt.priority===et.priority).map(tt=>tt.run)}get size(){return Mt(this,Jn).length}},Jn=new WeakMap,Ll);var Qr,Yr,vr,co,Zr,lo,zn,Xr,Dn,uo,Vn,Jr,ir,ho,_n,Yl,Zl,Xl,Jl,eu,Xo,$s,Os,Jo,tu,_i;class PQueue extends EventEmitter$1{constructor(tt){var nt,rt;super();fn(this,_n);fn(this,Qr);fn(this,Yr);fn(this,vr,0);fn(this,co);fn(this,Zr);fn(this,lo,0);fn(this,zn);fn(this,Xr);fn(this,Dn);fn(this,uo);fn(this,Vn,0);fn(this,Jr);fn(this,ir);fn(this,ho);Ct(this,"timeout");if(tt={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:PriorityQueue$1,...tt},!(typeof tt.intervalCap=="number"&&tt.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((nt=tt.intervalCap)==null?void 0:nt.toString())??""}\` (${typeof tt.intervalCap})`);if(tt.interval===void 0||!(Number.isFinite(tt.interval)&&tt.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((rt=tt.interval)==null?void 0:rt.toString())??""}\` (${typeof tt.interval})`);un(this,Qr,tt.carryoverConcurrencyCount),un(this,Yr,tt.intervalCap===Number.POSITIVE_INFINITY||tt.interval===0),un(this,co,tt.intervalCap),un(this,Zr,tt.interval),un(this,Dn,new tt.queueClass),un(this,uo,tt.queueClass),this.concurrency=tt.concurrency,this.timeout=tt.timeout,un(this,ho,tt.throwOnTimeout===!0),un(this,ir,tt.autoStart===!1)}get concurrency(){return Mt(this,Jr)}set concurrency(tt){if(!(typeof tt=="number"&&tt>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${tt}\` (${typeof tt})`);un(this,Jr,tt),gn(this,_n,Jo).call(this)}async add(tt,nt={}){return nt={timeout:this.timeout,throwOnTimeout:Mt(this,ho),...nt},new Promise((rt,ot)=>{Mt(this,Dn).enqueue(async()=>{var it;br(this,Vn)._++,br(this,vr)._++;try{(it=nt.signal)==null||it.throwIfAborted();let st=tt({signal:nt.signal});nt.timeout&&(st=pTimeout(Promise.resolve(st),{milliseconds:nt.timeout})),nt.signal&&(st=Promise.race([st,gn(this,_n,tu).call(this,nt.signal)]));const at=await st;rt(at),this.emit("completed",at)}catch(st){if(st instanceof TimeoutError$1&&!nt.throwOnTimeout){rt();return}ot(st),this.emit("error",st)}finally{gn(this,_n,Xl).call(this)}},nt),this.emit("add"),gn(this,_n,Xo).call(this)})}async addAll(tt,nt){return Promise.all(tt.map(async rt=>this.add(rt,nt)))}start(){return Mt(this,ir)?(un(this,ir,!1),gn(this,_n,Jo).call(this),this):this}pause(){un(this,ir,!0)}clear(){un(this,Dn,new(Mt(this,uo)))}async onEmpty(){Mt(this,Dn).size!==0&&await gn(this,_n,_i).call(this,"empty")}async onSizeLessThan(tt){Mt(this,Dn).sizeMt(this,Dn).size{gn(this,_n,Jl).call(this)},nt)),!0}return!1},Xo=function(){if(Mt(this,Dn).size===0)return Mt(this,zn)&&clearInterval(Mt(this,zn)),un(this,zn,void 0),this.emit("empty"),Mt(this,Vn)===0&&this.emit("idle"),!1;if(!Mt(this,ir)){const tt=!Mt(this,_n,eu);if(Mt(this,_n,Yl)&&Mt(this,_n,Zl)){const nt=Mt(this,Dn).dequeue();return nt?(this.emit("active"),nt(),tt&&gn(this,_n,$s).call(this),!0):!1}}return!1},$s=function(){Mt(this,Yr)||Mt(this,zn)!==void 0||(un(this,zn,setInterval(()=>{gn(this,_n,Os).call(this)},Mt(this,Zr))),un(this,lo,Date.now()+Mt(this,Zr)))},Os=function(){Mt(this,vr)===0&&Mt(this,Vn)===0&&Mt(this,zn)&&(clearInterval(Mt(this,zn)),un(this,zn,void 0)),un(this,vr,Mt(this,Qr)?Mt(this,Vn):0),gn(this,_n,Jo).call(this)},Jo=function(){for(;gn(this,_n,Xo).call(this););},tu=async function(tt){return new Promise((nt,rt)=>{tt.addEventListener("abort",()=>{rt(tt.reason)},{once:!0})})},_i=async function(tt,nt){return new Promise(rt=>{const ot=()=>{nt&&!nt()||(this.off(tt,ot),rt())};this.on(tt,ot)})};function getTypes(o){const et=[RecordType.A];return o==null?et:Array.isArray(o)?o.length===0?et:o:[o]}const DEFAULT_TTL=60;function toDNSResponse(o){return{Status:o.Status??0,TC:o.TC??o.flag_tc??!1,RD:o.RD??o.flag_rd??!1,RA:o.RA??o.flag_ra??!1,AD:o.AD??o.flag_ad??!1,CD:o.CD??o.flag_cd??!1,Question:(o.Question??o.questions??[]).map(et=>({name:et.name,type:RecordType[et.type]})),Answer:(o.Answer??o.answers??[]).map(et=>({name:et.name,type:RecordType[et.type],TTL:et.TTL??et.ttl??DEFAULT_TTL,data:et.data instanceof Uint8Array?toString$8(et.data):et.data}))}}const DEFAULT_QUERY_CONCURRENCY=4;function dnsJsonOverHttps(o,et={}){const tt=new PQueue({concurrency:et.queryConcurrency??DEFAULT_QUERY_CONCURRENCY});return async(nt,rt={})=>{var st;const ot=new URLSearchParams;ot.set("name",nt),getTypes(rt.types).forEach(at=>{ot.append("type",RecordType[at])}),(st=rt.onProgress)==null||st.call(rt,new CustomProgressEvent("dns:query",{detail:nt}));const it=await tt.add(async()=>{var lt;const at=await fetch(`${o}?${ot}`,{headers:{accept:"application/dns-json"},signal:rt==null?void 0:rt.signal});if(at.status!==200)throw new Error(`Unexpected HTTP status: ${at.status} - ${at.statusText}`);const ct=toDNSResponse(await at.json());return(lt=rt.onProgress)==null||lt.call(rt,new CustomProgressEvent("dns:response",{detail:ct})),ct},{signal:rt.signal});if(it==null)throw new Error("No DNS response received");return it}}function defaultResolver(){return[dnsJsonOverHttps("https://cloudflare-dns.com/dns-query"),dnsJsonOverHttps("https://dns.google/resolve")]}var hashlru=function(o){if(!o)throw Error("hashlru must have a max value, of type number, greater than 0");var et=0,tt=Object.create(null),nt=Object.create(null);function rt(ot,it){tt[ot]=it,et++,et>=o&&(et=0,nt=tt,tt=Object.create(null))}return{has:function(ot){return tt[ot]!==void 0||nt[ot]!==void 0},remove:function(ot){tt[ot]!==void 0&&(tt[ot]=void 0),nt[ot]!==void 0&&(nt[ot]=void 0)},get:function(ot){var it=tt[ot];if(it!==void 0)return it;if((it=nt[ot])!==void 0)return rt(ot,it),it},set:function(ot,it){tt[ot]!==void 0?tt[ot]=it:rt(ot,it)},clear:function(){tt=Object.create(null),nt=Object.create(null)}}};const hashlru$1=getDefaultExportFromCjs(hashlru);class CachedAnswers{constructor(et){Ct(this,"lru");this.lru=hashlru$1(et)}get(et,tt){let nt=!0;const rt=[];for(const ot of tt){const it=this.getAnswers(et,ot);if(it.length===0){nt=!1;break}rt.push(...it)}if(nt)return toDNSResponse({answers:rt})}getAnswers(et,tt){const nt=`${et.toLowerCase()}-${tt}`,rt=this.lru.get(nt);if(rt!=null){const ot=rt.filter(it=>it.expires>Date.now()).map(({expires:it,value:st})=>({...st,TTL:Math.round((it-Date.now())/1e3),type:RecordType[st.type]}));return ot.length===0&&this.lru.remove(nt),ot}return[]}add(et,tt){const nt=`${et.toLowerCase()}-${tt.type}`,rt=this.lru.get(nt)??[];rt.push({expires:Date.now()+(tt.TTL??DEFAULT_TTL)*1e3,value:tt}),this.lru.set(nt,rt)}remove(et,tt){const nt=`${et.toLowerCase()}-${tt}`;this.lru.remove(nt)}clear(){this.lru.clear()}}function cache(o){return new CachedAnswers(o)}const DEFAULT_ANSWER_CACHE_SIZE=1e3;class DNS{constructor(et){Ct(this,"resolvers");Ct(this,"cache");this.resolvers={},this.cache=cache(et.cacheSize??DEFAULT_ANSWER_CACHE_SIZE),Object.entries(et.resolvers??{}).forEach(([tt,nt])=>{Array.isArray(nt)||(nt=[nt]),tt.endsWith(".")||(tt=`${tt}.`),this.resolvers[tt]=nt}),this.resolvers["."]==null&&(this.resolvers["."]=defaultResolver())}async query(et,tt={}){var at,ct,lt;const nt=getTypes(tt.types),rt=tt.cached!==!1?this.cache.get(et,nt):void 0;if(rt!=null)return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dns:cache",{detail:rt})),rt;const ot=`${et.split(".").pop()}.`,it=(this.resolvers[ot]??this.resolvers["."]).sort(()=>Math.random()>.5?-1:1),st=[];for(const dt of it){if(((ct=tt.signal)==null?void 0:ct.aborted)===!0)break;try{const ht=await dt(et,{...tt,types:nt});for(const pt of ht.Answer)this.cache.add(et,pt);return ht}catch(ht){st.push(ht),(lt=tt.onProgress)==null||lt.call(tt,new CustomProgressEvent("dns:error",{detail:ht}))}}throw st.length===1?st[0]:new AggregateError(st,`DNS lookup of ${et} ${nt} failed`)}}var RecordType;(function(o){o[o.A=1]="A",o[o.CNAME=5]="CNAME",o[o.TXT=16]="TXT",o[o.AAAA=28]="AAAA"})(RecordType||(RecordType={}));function dns(o={}){return new DNS(o)}const MAX_RECURSIVE_DEPTH=32,{code:dnsaddrCode}=getProtocol("dnsaddr");class RecursionLimitError extends Error{constructor(et="Max recursive depth reached"){super(et),this.name="RecursionLimitError"}}const dnsaddrResolver=async function(et,tt={}){const nt=tt.maxRecursiveDepth??MAX_RECURSIVE_DEPTH;if(nt===0)throw new RecursionLimitError("Max recursive depth reached");const[,rt]=et.stringTuples().find(([ct])=>ct===dnsaddrCode)??[],it=await((tt==null?void 0:tt.dns)??dns()).query(`_dnsaddr.${rt}`,{signal:tt==null?void 0:tt.signal,types:[RecordType.TXT]}),st=et.getPeerId(),at=[];for(const ct of it.Answer){const lt=ct.data.replace(/["']/g,"").trim().split("=")[1];if(lt==null||st!=null&&!lt.includes(st))continue;const dt=multiaddr(lt);if(lt.startsWith("/dnsaddr")){const ht=await dt.resolve({...tt,maxRecursiveDepth:nt-1});at.push(...ht.map(pt=>pt.toString()))}else at.push(dt.toString())}return at};var isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const et=Object.getPrototypeOf(o);return et===null||et===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty:hasOwnProperty$1}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty$1=(o,et,tt)=>Object.defineProperty(o,et,{value:tt,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const et=[];for(const tt in o)hasOwnProperty$1.call(o,tt)&&et.push(tt);if(Object.getOwnPropertySymbols){const tt=Object.getOwnPropertySymbols(o);for(const nt of tt)propertyIsEnumerable.call(o,nt)&&et.push(nt)}return et};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const et=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}function cloneOptionObject(o){const et=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}const mergeKeys=(o,et,tt,nt)=>(tt.forEach(rt=>{typeof et[rt]>"u"&&nt.ignoreUndefined||(rt in o&&o[rt]!==Object.getPrototypeOf(o)?defineProperty$1(o,rt,merge$1(o[rt],et[rt],nt)):defineProperty$1(o,rt,clone(et[rt])))}),o),concatArrays=(o,et,tt)=>{let nt=o.slice(0,0),rt=0;return[o,et].forEach(ot=>{const it=[];for(let st=0;st!it.includes(st)),tt)}),nt};function merge$1(o,et,tt){return tt.concatArrays&&Array.isArray(o)&&Array.isArray(et)?concatArrays(o,et,tt):!isOptionObject(et)||!isOptionObject(o)?clone(et):mergeKeys(o,et,getEnumerableOwnPropertyKeys(et),tt)}var mergeOptions=function(...o){const et=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let tt={_:{}};for(const nt of o)if(nt!==void 0){if(!isOptionObject(nt))throw new TypeError("`"+nt+"` is not an Option Object");tt=merge$1(tt,{_:nt},et)}return tt._};const mergeOptions$1=getDefaultExportFromCjs(mergeOptions);var define_globalThis_process_env_default$1={};const DefaultConfig={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:o=>o},connectionManager:{resolvers:{dnsaddr:dnsaddrResolver}},transportManager:{faultTolerance:FaultTolerance.FATAL_ALL}};async function validateConfig(o){const et=mergeOptions$1(DefaultConfig,o);if(et.connectionProtector===null&&(define_globalThis_process_env_default$1==null?void 0:define_globalThis_process_env_default$1.LIBP2P_FORCE_PNET)!=null)throw new InvalidParametersError$1("Private network is enforced, but no protector was provided");return et}const s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;function ms(o,et){try{if(typeof o=="string"&&o.length>0)return parse$3(o);if(typeof o=="number"&&isFinite(o))return et!=null&&et.long?fmtLong(o):fmtShort(o);throw new Error("Value is not a string or number.")}catch(tt){const nt=isError$1(tt)?`${tt.message}. value=${JSON.stringify(o)}`:"An unknown error has occured.";throw new Error(nt)}}function parse$3(o){if(o=String(o),o.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const et=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!et)return NaN;const tt=parseFloat(et[1]),nt=(et[2]||"ms").toLowerCase();switch(nt){case"years":case"year":case"yrs":case"yr":case"y":return tt*y;case"weeks":case"week":case"w":return tt*w;case"days":case"day":case"d":return tt*d;case"hours":case"hour":case"hrs":case"hr":case"h":return tt*h;case"minutes":case"minute":case"mins":case"min":case"m":return tt*m;case"seconds":case"second":case"secs":case"sec":case"s":return tt*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return tt;default:throw new Error(`The unit ${nt} was matched, but no matching case exists.`)}}function fmtShort(o){const et=Math.abs(o);return et>=d?`${Math.round(o/d)}d`:et>=h?`${Math.round(o/h)}h`:et>=m?`${Math.round(o/m)}m`:et>=s?`${Math.round(o/s)}s`:`${o}ms`}function fmtLong(o){const et=Math.abs(o);return et>=d?plural(o,et,d,"day"):et>=h?plural(o,et,h,"hour"):et>=m?plural(o,et,m,"minute"):et>=s?plural(o,et,s,"second"):`${o} ms`}function plural(o,et,tt,nt){const rt=et>=tt*1.5;return`${Math.round(o/tt)} ${nt}${rt?"s":""}`}function isError$1(o){return typeof o=="object"&&o!==null&&"message"in o}function setup(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=ms,tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=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=31||typeof navigator<"u"&&((rt=navigator.userAgent)==null?void 0:rt.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+ms(this.diff),!this.useColors)return;const et="color: "+this.color;o.splice(1,0,et,"color: inherit");let tt=0,nt=0;o[0].replace(/%[a-zA-Z%]/g,rt=>{rt!=="%%"&&(tt++,rt==="%c"&&(nt=tt))}),o.splice(nt,0,et)}const log$a=console.debug??console.log??(()=>{});function save(o){try{o?storage==null||storage.setItem("debug",o):storage==null||storage.removeItem("debug")}catch{}}function load$1(){let o;try{o=storage==null?void 0:storage.getItem("debug")}catch{}return!o&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(o=define_globalThis_process_env_default.DEBUG),o}function localstorage(){try{return localStorage}catch{}}function setupFormatters(o){o.j=function(et){try{return JSON.stringify(et)}catch(tt){return"[UnexpectedJSONParseError]: "+tt.message}}}const weald=setup({formatArgs,save,load:load$1,useColors,setupFormatters,colors,storage,log:log$a});weald.formatters.b=o=>o==null?"undefined":base58btc.baseEncode(o);weald.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);weald.formatters.m=o=>o==null?"undefined":base64$2.baseEncode(o);weald.formatters.p=o=>o==null?"undefined":o.toString();weald.formatters.c=o=>o==null?"undefined":o.toString();weald.formatters.k=o=>o==null?"undefined":o.toString();weald.formatters.a=o=>o==null?"undefined":o.toString();weald.formatters.e=o=>o==null?"undefined":notEmpty(o.stack)??notEmpty(o.message)??o.toString();function createDisabledLogger(o){const et=()=>{};return et.enabled=!1,et.color="",et.diff=0,et.log=()=>{},et.namespace=o,et.destroy=()=>!0,et.extend=()=>et,et}function defaultLogger(){return{forComponent(o){return logger$2(o)}}}function logger$2(o){let et=createDisabledLogger(`${o}:trace`);return weald.enabled(`${o}:trace`)&&weald.names.map(tt=>tt.toString()).find(tt=>tt.includes(":trace"))!=null&&(et=weald(`${o}:trace`)),Object.assign(weald(o),{error:weald(`${o}:error`),trace:et})}function notEmpty(o){if(o!=null&&(o=o.trim(),o.length!==0))return o}function mapIterable(o,et){const tt={[Symbol.iterator]:()=>tt,next:()=>{const nt=o.next(),rt=nt.value;return nt.done===!0||rt==null?{done:!0,value:void 0}:{done:!1,value:et(rt)}}};return tt}function peerIdFromString(o){const et=decode$6(base58btc.decode(`z${o}`));return peerIdFromMultihash(et)}class PeerMap{constructor(et){Ct(this,"map");if(this.map=new Map,et!=null)for(const[tt,nt]of et.entries())this.map.set(tt.toString(),{key:tt,value:nt})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(et){return this.map.delete(et.toString())}entries(){return mapIterable(this.map.entries(),et=>[et[1].key,et[1].value])}forEach(et){this.map.forEach((tt,nt)=>{et(tt.value,tt.key,this)})}get(et){var tt;return(tt=this.map.get(et.toString()))==null?void 0:tt.value}has(et){return this.map.has(et.toString())}set(et,tt){this.map.set(et.toString(),{key:et,value:tt})}keys(){return mapIterable(this.map.values(),et=>et.key)}values(){return mapIterable(this.map.values(),et=>et.value)}get size(){return this.map.size}}class PeerSet{constructor(et){Ct(this,"set");if(this.set=new Set,et!=null)for(const tt of et)this.set.add(tt.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(et){this.set.add(et.toString())}clear(){this.set.clear()}delete(et){this.set.delete(et.toString())}entries(){return mapIterable(this.set.entries(),et=>{const tt=peerIdFromString(et[0]);return[tt,tt]})}forEach(et){this.set.forEach(tt=>{const nt=peerIdFromString(tt);et(nt,nt,this)})}has(et){return this.set.has(et.toString())}values(){return mapIterable(this.set.values(),et=>peerIdFromString(et))}intersection(et){const tt=new PeerSet;for(const nt of et)this.has(nt)&&tt.add(nt);return tt}difference(et){const tt=new PeerSet;for(const nt of this)et.has(nt)||tt.add(nt);return tt}union(et){const tt=new PeerSet;for(const nt of et)tt.add(nt);for(const nt of this)tt.add(nt);return tt}}var murmurHash3js={exports:{}};(function(o,et){(function(tt,nt){var rt={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function ot(ft){if(!Array.isArray(ft)&&!ArrayBuffer.isView(ft))return!1;for(var yt=0;yt255)return!1;return!0}function it(ft,yt){return(ft&65535)*yt+(((ft>>>16)*yt&65535)<<16)}function st(ft,yt){return ft<>>32-yt}function at(ft){return ft^=ft>>>16,ft=it(ft,2246822507),ft^=ft>>>13,ft=it(ft,3266489909),ft^=ft>>>16,ft}function ct(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]+yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]+yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]+yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]+yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function lt(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]*yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]*yt[3],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[2]+=ft[3]*yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]*yt[3],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[2]*yt[2],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[3]*yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]*yt[3]+ft[1]*yt[2]+ft[2]*yt[1]+ft[3]*yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function dt(ft,yt){return yt%=64,yt===32?[ft[1],ft[0]]:yt<32?[ft[0]<>>32-yt,ft[1]<>>32-yt]:(yt-=32,[ft[1]<>>32-yt,ft[0]<>>32-yt])}function ht(ft,yt){return yt%=64,yt===0?ft:yt<32?[ft[0]<>>32-yt,ft[1]<>>1]),ft=lt(ft,[4283543511,3981806797]),ft=pt(ft,[0,ft[0]>>>1]),ft=lt(ft,[3301882366,444984403]),ft=pt(ft,[0,ft[0]>>>1]),ft}rt.x86.hash32=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%4,xt=ft.length-gt,vt=yt,bt=0,Et=3432918353,wt=461845907,kt=0;kt>>0},rt.x86.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=yt,bt=yt,Et=yt,wt=yt,kt=0,It=0,Rt=0,Pt=0,jt=597399067,Ot=2869860233,Bt=951274213,zt=2716044179,Ft=0;Ft>>0).toString(16)).slice(-8)+("00000000"+(bt>>>0).toString(16)).slice(-8)+("00000000"+(Et>>>0).toString(16)).slice(-8)+("00000000"+(wt>>>0).toString(16)).slice(-8)},rt.x64.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=[0,yt],bt=[0,yt],Et=[0,0],wt=[0,0],kt=[2277735313,289559509],It=[1291169091,658871167],Rt=0;Rt>>0).toString(16)).slice(-8)+("00000000"+(vt[1]>>>0).toString(16)).slice(-8)+("00000000"+(bt[0]>>>0).toString(16)).slice(-8)+("00000000"+(bt[1]>>>0).toString(16)).slice(-8)},o.exports&&(et=o.exports=rt),et.murmurHash3=rt})()})(murmurHash3js,murmurHash3js.exports);const MAX_FINGERPRINT_SIZE=64;class Fingerprint{constructor(et,tt,nt,rt=2){Ct(this,"fp");Ct(this,"h");Ct(this,"seed");if(rt>MAX_FINGERPRINT_SIZE)throw new TypeError("Invalid Fingerprint Size");const ot=tt.hashV(et,nt),it=alloc$2(rt);for(let st=0;stet.equals(tt))}add(et){if(!(et instanceof Fingerprint))throw new TypeError("Invalid Fingerprint");for(let tt=0;ttet.equals(nt));return tt>-1?(this.contents[tt]=null,!0):!1}}const FNV_PRIMES={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},FNV_OFFSETS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},cachedEncoder=new globalThis.TextEncoder;function fnv1aUint8Array(o,et){const tt=FNV_PRIMES[et];let nt=FNV_OFFSETS[et];for(let rt=0;rt0;){const it=cachedEncoder.encodeInto(ot,tt);ot=ot.slice(it.read);for(let st=0;stNumber(fnv1a$1(o,{size:32})),hashV:(o,et)=>numberToBuffer(fnv1a.hash(o,et))};function numberToBuffer(o){let et=o.toString(16);return et.length%2===1&&(et=`0${et}`),fromString(et,"base16")}const maxCuckooCount=500;class CuckooFilter{constructor(et){Ct(this,"bucketSize");Ct(this,"filterSize");Ct(this,"fingerprintSize");Ct(this,"buckets");Ct(this,"count");Ct(this,"hash");Ct(this,"seed");this.filterSize=et.filterSize,this.bucketSize=et.bucketSize??4,this.fingerprintSize=et.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10))}add(et){typeof et=="string"&&(et=fromString(et));const tt=new Fingerprint(et,this.hash,this.seed,this.fingerprintSize),nt=this.hash.hash(et,this.seed)%this.filterSize,rt=(nt^tt.hash())%this.filterSize;if(this.buckets[nt]==null&&(this.buckets[nt]=new Bucket(this.bucketSize)),this.buckets[rt]==null&&(this.buckets[rt]=new Bucket(this.bucketSize)),this.buckets[nt].add(tt)||this.buckets[rt].add(tt))return this.count++,!0;const ot=[nt,rt];let it=ot[getRandomInt(0,ot.length-1)];this.buckets[it]==null&&(this.buckets[it]=new Bucket(this.bucketSize));for(let st=0;st.002?2:o>1e-5?4:8}function optimize(o,et=.001){const tt=calculateBucketSize(et),nt=MAX_LOAD[tt],rt=Math.round(o/nt),ot=Math.min(Math.ceil(Math.log2(1/et)+Math.log2(2*tt)),MAX_FINGERPRINT_SIZE);return{filterSize:rt,bucketSize:tt,fingerprintSize:ot}}class ScalableCuckooFilter{constructor(et){Ct(this,"filterSize");Ct(this,"bucketSize");Ct(this,"fingerprintSize");Ct(this,"scale");Ct(this,"filterSeries");Ct(this,"hash");Ct(this,"seed");this.bucketSize=et.bucketSize??4,this.filterSize=et.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=et.fingerprintSize??2,this.scale=et.scale??2,this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10)),this.filterSeries=[new CuckooFilter({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(et){if(typeof et=="string"&&(et=fromString(et)),this.has(et))return!0;let tt=this.filterSeries.find(nt=>nt.reliable);if(tt==null){const nt=this.filterSize*Math.pow(this.scale,this.filterSeries.length);tt=new CuckooFilter({filterSize:nt,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(tt)}return tt.add(et)}has(et){typeof et=="string"&&(et=fromString(et));for(let tt=0;ttet+tt.count,0)}}function createScalableCuckooFilter(o,et=.001,tt){return new ScalableCuckooFilter({...optimize(o,et)})}const peerIdSymbol=Symbol.for("@libp2p/peer-id");function isPeerId(o){return!!(o!=null&&o[peerIdSymbol])}class InvalidParametersError extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}}Ct(InvalidParametersError,"name","InvalidParametersError");const events={},observable=o=>{o.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)}),o.port!=null&&o.port.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)})};observable.addEventListener=(o,et)=>{events[o]==null&&(events[o]=[]),events[o].push(et)};observable.removeEventListener=(o,et)=>{events[o]!=null&&(events[o]=events[o].filter(tt=>tt===et))};observable.dispatchEvent=function(o,et,tt){events[o]!=null&&events[o].forEach(nt=>nt(et,tt))};const WORKER_REQUEST_READ_LOCK="lock:worker:request-read",WORKER_RELEASE_READ_LOCK="lock:worker:release-read",MASTER_GRANT_READ_LOCK="lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK="lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK="lock:worker:release-write",MASTER_GRANT_WRITE_LOCK="lock:master:grant-write",nanoid=(o=21)=>Math.random().toString().substring(2),handleWorkerLockRequest=(o,et,tt,nt,rt)=>(ot,it)=>{if(it.data.type!==tt)return;const st={type:it.data.type,name:it.data.name,identifier:it.data.identifier};o.dispatchEvent(new MessageEvent(et,{data:{name:st.name,handler:async()=>{ot.postMessage({type:rt,name:st.name,identifier:st.identifier}),await new Promise(at=>{const ct=lt=>{if((lt==null?void 0:lt.data)==null)return;const dt={type:lt.data.type,name:lt.data.name,identifier:lt.data.identifier};dt.type===nt&&dt.identifier===st.identifier&&(ot.removeEventListener("message",ct),at())};ot.addEventListener("message",ct)})}}}))},makeWorkerLockRequest=(o,et,tt,nt)=>async()=>{const rt=nanoid();return globalThis.postMessage({type:et,identifier:rt,name:o}),new Promise(ot=>{const it=st=>{if((st==null?void 0:st.data)==null)return;const at={type:st.data.type,identifier:st.data.identifier};at.type===tt&&at.identifier===rt&&(globalThis.removeEventListener("message",it),ot(()=>{globalThis.postMessage({type:nt,identifier:rt,name:o})}))};globalThis.addEventListener("message",it)})},defaultOptions$4={singleProcess:!1},impl=o=>{if(o=Object.assign({},defaultOptions$4,o),!!globalThis.document||o.singleProcess){const tt=new EventTarget;return observable.addEventListener("message",handleWorkerLockRequest(tt,"requestReadLock",WORKER_REQUEST_READ_LOCK,WORKER_RELEASE_READ_LOCK,MASTER_GRANT_READ_LOCK)),observable.addEventListener("message",handleWorkerLockRequest(tt,"requestWriteLock",WORKER_REQUEST_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK)),tt}return{isWorker:!0,readLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_READ_LOCK,MASTER_GRANT_READ_LOCK,WORKER_RELEASE_READ_LOCK),writeLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK)}},mutexes={};let implementation;async function createReleaseable(o,et){let tt;const nt=new Promise(rt=>{tt=rt});return o.add(async()=>pTimeout((async()=>{await new Promise(rt=>{tt(()=>{rt()})})})(),{milliseconds:et.timeout})),nt}const createMutex=(o,et)=>{if(implementation.isWorker===!0)return{readLock:implementation.readLock(o,et),writeLock:implementation.writeLock(o,et)};const tt=new PQueue({concurrency:1});let nt;return{async readLock(){if(nt!=null)return createReleaseable(nt,et);nt=new PQueue({concurrency:et.concurrency,autoStart:!1});const rt=nt,ot=createReleaseable(nt,et);return tt.add(async()=>{rt.start(),await rt.onIdle().then(()=>{nt===rt&&(nt=null)})}),ot},async writeLock(){return nt=null,createReleaseable(tt,et)}}},defaultOptions$3={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function createMortice(o){const et=Object.assign({},defaultOptions$3,o);return implementation==null&&(implementation=impl(et),implementation.isWorker!==!0&&(implementation.addEventListener("requestReadLock",tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].readLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}),implementation.addEventListener("requestWriteLock",async tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].writeLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}))),mutexes[et.name]==null&&(mutexes[et.name]=createMutex(et.name,et)),mutexes[et.name]}var Peer;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&rt.value.byteLength>0&&(ot.uint32(18),ot.bytes(rt.value)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={key:"",value:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.Peer$metadataEntry||(o.Peer$metadataEntry={})),function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&(ot.uint32(18),Tag.codec().encode(rt.value,ot)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={key:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=Tag.codec().decode(rt,rt.uint32(),{limits:(ct=it.limits)==null?void 0:ct.value});break}default:{rt.skipType(lt&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)}(o.Peer$tagsEntry||(o.Peer$tagsEntry={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(10),Address.codec().encode(ot,nt);if(tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(18),nt.string(ot);if(tt.publicKey!=null&&(nt.uint32(34),nt.bytes(tt.publicKey)),tt.peerRecordEnvelope!=null&&(nt.uint32(42),nt.bytes(tt.peerRecordEnvelope)),tt.metadata!=null&&tt.metadata.size!==0)for(const[ot,it]of tt.metadata.entries())nt.uint32(50),o.Peer$metadataEntry.codec().encode({key:ot,value:it},nt);if(tt.tags!=null&&tt.tags.size!==0)for(const[ot,it]of tt.tags.entries())nt.uint32(58),o.Peer$tagsEntry.codec().encode({key:ot,value:it},nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at,ct,lt,dt,ht;const ot={addresses:[],protocols:[],metadata:new Map,tags:new Map},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(Address.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}case 2:{if(((ct=rt.limits)==null?void 0:ct.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 4:{ot.publicKey=tt.bytes();break}case 5:{ot.peerRecordEnvelope=tt.bytes();break}case 6:{if(((lt=rt.limits)==null?void 0:lt.metadata)!=null&&ot.metadata.size===rt.limits.metadata)throw new MaxSizeError('Decode error - map field "metadata" had too many elements');const mt=o.Peer$metadataEntry.codec().decode(tt,tt.uint32());ot.metadata.set(mt.key,mt.value);break}case 7:{if(((dt=rt.limits)==null?void 0:dt.tags)!=null&&ot.tags.size===rt.limits.tags)throw new MaxSizeError('Decode error - map field "tags" had too many elements');const mt=o.Peer$tagsEntry.codec().decode(tt,tt.uint32(),{limits:{value:(ht=rt.limits)==null?void 0:ht.tags$value}});ot.tags.set(mt.key,mt.value);break}default:{tt.skipType(pt&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Peer||(Peer={}));var Address;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.multiaddr!=null&&tt.multiaddr.byteLength>0&&(nt.uint32(10),nt.bytes(tt.multiaddr)),tt.isCertified!=null&&(nt.uint32(16),nt.bool(tt.isCertified)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={multiaddr:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.multiaddr=tt.bytes();break}case 2:{ot.isCertified=tt.bool();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Address||(Address={}));var Tag;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.value!=null&&tt.value!==0&&(nt.uint32(8),nt.uint32(tt.value)),tt.expiry!=null&&(nt.uint32(16),nt.uint64(tt.expiry)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={value:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.value=tt.uint32();break}case 2:{ot.expiry=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Tag||(Tag={}));function bytesToPeer(o,et){const tt=Peer.decode(et);if(tt.publicKey!=null&&o.publicKey==null){const ot=publicKeyFromProtobuf(tt.publicKey);o=peerIdFromPublicKey(ot)}const nt=new Map,rt=BigInt(Date.now());for(const[ot,it]of tt.tags.entries())it.expiry!=null&&it.expiry({multiaddr:multiaddr(ot),isCertified:it??!1})),metadata:tt.metadata,peerRecordEnvelope:tt.peerRecordEnvelope??void 0,tags:nt}}const pathSepS="/",pathSepB=new TextEncoder().encode(pathSepS),pathSep=pathSepB[0];class Key{constructor(et,tt){Ct(this,"_buf");if(typeof et=="string")this._buf=fromString(et);else if(et instanceof Uint8Array)this._buf=et;else throw new Error("Invalid key, should be String of Uint8Array");if(tt==null&&(tt=!0),tt&&this.clean(),this._buf.byteLength===0||this._buf[0]!==pathSep)throw new Error("Invalid key")}toString(et="utf8"){return toString$8(this._buf,et)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(et){return new Key(et.join(pathSepS))}static random(){return new Key(Math.random().toString().substring(2))}static asKey(et){return et instanceof Uint8Array||typeof et=="string"?new Key(et):typeof et.uint8Array=="function"?new Key(et.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=pathSepB),this._buf[0]!==pathSep){const et=new Uint8Array(this._buf.byteLength+1);et.fill(pathSep,0,1),et.set(this._buf,1),this._buf=et}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===pathSep;)this._buf=this._buf.subarray(0,-1)}less(et){const tt=this.list(),nt=et.list();for(let rt=0;rtit)return!1}return tt.lengthtt.namespaces()))])}}function namespaceType(o){const et=o.split(":");return et.length<2?"":et.slice(0,-1).join(":")}function namespaceValue(o){const et=o.split(":");return et[et.length-1]}function flatten(o){return[].concat(...o)}const NAMESPACE_COMMON="/peers/";function peerIdToDatastoreKey(o){if(!isPeerId(o)||o.type==null)throw new InvalidParametersError("Invalid PeerId");const et=o.toCID().toString();return new Key(`${NAMESPACE_COMMON}${et}`)}async function dedupeFilterAndSortAddresses(o,et,tt){const nt=new Map;for(const rt of tt){if(rt==null)continue;if(rt.multiaddr instanceof Uint8Array&&(rt.multiaddr=multiaddr(rt.multiaddr)),!isMultiaddr(rt.multiaddr))throw new InvalidParametersError("Multiaddr was invalid");if(!await et(o,rt.multiaddr))continue;const ot=rt.isCertified??!1,it=rt.multiaddr.toString(),st=nt.get(it);st!=null?rt.isCertified=st.isCertified||ot:nt.set(it,{multiaddr:rt.multiaddr,isCertified:ot})}return[...nt.values()].sort((rt,ot)=>rt.multiaddr.toString().localeCompare(ot.multiaddr.toString())).map(({isCertified:rt,multiaddr:ot})=>({isCertified:rt,multiaddr:ot.bytes}))}async function toPeerPB(o,et,tt,nt){if(et==null)throw new InvalidParametersError("Invalid PeerData");if(et.publicKey!=null&&o.publicKey!=null&&!et.publicKey.equals(o.publicKey))throw new InvalidParametersError("publicKey bytes do not match peer id publicKey bytes");const rt=nt.existingPeer;if(rt!=null&&!o.equals(rt.id))throw new InvalidParametersError("peer id did not match existing peer id");let ot=(rt==null?void 0:rt.addresses)??[],it=new Set((rt==null?void 0:rt.protocols)??[]),st=(rt==null?void 0:rt.metadata)??new Map,at=(rt==null?void 0:rt.tags)??new Map,ct=rt==null?void 0:rt.peerRecordEnvelope;if(tt==="patch"){if((et.multiaddrs!=null||et.addresses!=null)&&(ot=[],et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses)),et.protocols!=null&&(it=new Set(et.protocols)),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);st=createSortedMap(ht,{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags);at=createSortedMap(ht,{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}if(tt==="merge"){if(et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses),et.protocols!=null&&(it=new Set([...it,...et.protocols])),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);for(const[pt,mt]of ht)mt==null?st.delete(pt):st.set(pt,mt);st=createSortedMap([...st.entries()],{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags),pt=new Map(at);for(const[mt,ft]of ht)ft==null?pt.delete(mt):pt.set(mt,ft);at=createSortedMap([...pt.entries()],{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}let lt;(rt==null?void 0:rt.id.publicKey)!=null?lt=publicKeyToProtobuf(rt.id.publicKey):et.publicKey!=null?lt=publicKeyToProtobuf(et.publicKey):o.publicKey!=null&&(lt=publicKeyToProtobuf(o.publicKey));const dt={addresses:await dedupeFilterAndSortAddresses(o,nt.addressFilter??(async()=>!0),ot),protocols:[...it.values()].sort((ht,pt)=>ht.localeCompare(pt)),metadata:st,tags:at,publicKey:lt,peerRecordEnvelope:ct};return o.type!=="RSA"&&delete dt.publicKey,dt}function createSortedMap(o,et){var nt;const tt=new Map;for(const[rt,ot]of o)ot!=null&&et.validate(rt,ot);for(const[rt,ot]of o.sort(([it],[st])=>it.localeCompare(st)))ot!=null&&tt.set(rt,((nt=et.map)==null?void 0:nt.call(et,rt,ot))??ot);return tt}function validateMetadata(o,et){if(typeof o!="string")throw new InvalidParametersError("Metadata key must be a string");if(!(et instanceof Uint8Array))throw new InvalidParametersError("Metadata value must be a Uint8Array")}function validateTag(o,et){if(typeof o!="string")throw new InvalidParametersError("Tag name must be a string");if(et.value!=null){if(parseInt(`${et.value}`,10)!==et.value)throw new InvalidParametersError("Tag value must be an integer");if(et.value<0||et.value>100)throw new InvalidParametersError("Tag value must be between 0-100")}if(et.ttl!=null){if(parseInt(`${et.ttl}`,10)!==et.ttl)throw new InvalidParametersError("Tag ttl must be an integer");if(et.ttl<0)throw new InvalidParametersError("Tag ttl must be between greater than 0")}}function mapTag(o,et){let tt;return et.expiry!=null&&(tt=et.expiry),et.ttl!=null&&(tt=BigInt(Date.now()+Number(et.ttl))),{value:et.value??0,expiry:tt}}function decodePeer(o,et){const tt=o.toString().split("/")[2],nt=CID.parse(tt,base32$2),rt=peerIdFromCID(nt);return bytesToPeer(rt,et)}function mapQuery(o){return o==null?{}:{prefix:NAMESPACE_COMMON,filters:(o.filters??[]).map(et=>({key:tt,value:nt})=>et(decodePeer(tt,nt))),orders:(o.orders??[]).map(et=>(tt,nt)=>et(decodePeer(tt.key,tt.value),decodePeer(nt.key,nt.value)))}}var er,es,ts;class PersistentStore{constructor(et,tt={}){fn(this,er);Ct(this,"peerId");Ct(this,"datastore");Ct(this,"lock");Ct(this,"addressFilter");this.peerId=et.peerId,this.datastore=et.datastore,this.addressFilter=tt.addressFilter,this.lock=createMortice({name:"peer-store",singleProcess:!0})}async has(et){return this.datastore.has(peerIdToDatastoreKey(et))}async delete(et){if(this.peerId.equals(et))throw new InvalidParametersError("Cannot delete self peer");await this.datastore.delete(peerIdToDatastoreKey(et))}async load(et){const tt=await this.datastore.get(peerIdToDatastoreKey(et));return bytesToPeer(et,tt)}async save(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter});return gn(this,er,ts).call(this,et,ot,nt,rt)}async patch(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async merge(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"merge",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async*all(et){for await(const{key:tt,value:nt}of this.datastore.query(mapQuery(et??{}))){const rt=decodePeer(tt,nt);rt.id.equals(this.peerId)||(yield rt)}}}er=new WeakSet,es=async function(et){try{const tt=await this.datastore.get(peerIdToDatastoreKey(et)),nt=bytesToPeer(et,tt);return{existingBuf:tt,existingPeer:nt}}catch(tt){if(tt.name!=="NotFoundError")throw tt}return{}},ts=async function(et,tt,nt,rt){const ot=Peer.encode(tt);return nt!=null&&equals(ot,nt)?{peer:bytesToPeer(et,ot),previous:rt,updated:!1}:(await this.datastore.put(peerIdToDatastoreKey(et),ot),{peer:bytesToPeer(et,ot),previous:rt,updated:!0})};var Nl,eo,ns;Nl=Symbol.toStringTag;class PersistentPeerStore{constructor(et,tt={}){fn(this,eo);Ct(this,"store");Ct(this,"events");Ct(this,"peerId");Ct(this,"log");Ct(this,Nl,"@libp2p/peer-store");this.log=et.logger.forComponent("libp2p:peer-store"),this.events=et.events,this.peerId=et.peerId,this.store=new PersistentStore(et,tt)}async forEach(et,tt){this.log.trace("forEach await read lock");const nt=await this.store.lock.readLock();this.log.trace("forEach got read lock");try{for await(const rt of this.store.all(tt))et(rt)}finally{this.log.trace("forEach release read lock"),nt()}}async all(et){this.log.trace("all await read lock");const tt=await this.store.lock.readLock();this.log.trace("all got read lock");try{return await all$2(this.store.all(et))}finally{this.log.trace("all release read lock"),tt()}}async delete(et){this.log.trace("delete await write lock");const tt=await this.store.lock.writeLock();this.log.trace("delete got write lock");try{await this.store.delete(et)}finally{this.log.trace("delete release write lock"),tt()}}async has(et){this.log.trace("has await read lock");const tt=await this.store.lock.readLock();this.log.trace("has got read lock");try{return await this.store.has(et)}finally{this.log.trace("has release read lock"),tt()}}async get(et){this.log.trace("get await read lock");const tt=await this.store.lock.readLock();this.log.trace("get got read lock");try{return await this.store.load(et)}finally{this.log.trace("get release read lock"),tt()}}async save(et,tt){this.log.trace("save await write lock");const nt=await this.store.lock.writeLock();this.log.trace("save got write lock");try{const rt=await this.store.save(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("save release write lock"),nt()}}async patch(et,tt){this.log.trace("patch await write lock");const nt=await this.store.lock.writeLock();this.log.trace("patch got write lock");try{const rt=await this.store.patch(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("patch release write lock"),nt()}}async merge(et,tt){this.log.trace("merge await write lock");const nt=await this.store.lock.writeLock();this.log.trace("merge got write lock");try{const rt=await this.store.merge(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("merge release write lock"),nt()}}async consumePeerRecord(et,tt){const nt=await RecordEnvelope.openAndCertify(et,PeerRecord.DOMAIN),rt=peerIdFromCID(nt.publicKey.toCID());if((tt==null?void 0:tt.equals(rt))===!1)return this.log("envelope peer id was not the expected peer id - expected: %p received: %p",tt,rt),!1;const ot=PeerRecord.createFromProtobuf(nt.payload);let it;try{it=await this.get(rt)}catch(st){if(st.name!=="NotFoundError")throw st}if((it==null?void 0:it.peerRecordEnvelope)!=null){const st=await RecordEnvelope.createFromProtobuf(it.peerRecordEnvelope),at=PeerRecord.createFromProtobuf(st.payload);if(at.seqNumber>=ot.seqNumber)return this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",at.seqNumber,ot.seqNumber),!1}return await this.patch(ot.peerId,{peerRecordEnvelope:et,addresses:ot.multiaddrs.map(st=>({isCertified:!0,multiaddr:st}))}),!0}}eo=new WeakSet,ns=function(et,tt){tt.updated&&(this.peerId.equals(et)?this.events.safeDispatchEvent("self:peer:update",{detail:tt}):this.events.safeDispatchEvent("peer:update",{detail:tt}))};function persistentPeerStore(o,et={}){return new PersistentPeerStore(o,et)}const jr=class jr extends Error{constructor(tt="Not Found"){super(tt);Ct(this,"name",jr.name);Ct(this,"code",jr.code)}};Ct(jr,"name","NotFoundError"),Ct(jr,"code","ERR_NOT_FOUND");let NotFoundError=jr;function peekable(o){const[et,tt]=o[Symbol.asyncIterator]!=null?[o[Symbol.asyncIterator](),Symbol.asyncIterator]:[o[Symbol.iterator](),Symbol.iterator],nt=[];return{peek:()=>et.next(),push:rt=>{nt.push(rt)},next:()=>nt.length>0?{done:!1,value:nt.shift()}:et.next(),[tt](){return this}}}function isAsyncIterable$2(o){return o[Symbol.asyncIterator]!=null}function filter(o,et){let tt=0;if(isAsyncIterable$2(o))return async function*(){for await(const at of o)await et(at,tt++)&&(yield at)}();const nt=peekable(o),{value:rt,done:ot}=nt.next();if(ot===!0)return function*(){}();const it=et(rt,tt++);if(typeof it.then=="function")return async function*(){await it&&(yield rt);for await(const at of nt)await et(at,tt++)&&(yield at)}();const st=et;return function*(){it===!0&&(yield rt);for(const at of nt)st(at,tt++)&&(yield at)}()}function isAsyncIterable$1(o){return o[Symbol.asyncIterator]!=null}function sort(o,et){return isAsyncIterable$1(o)?async function*(){yield*(await all$2(o)).sort(et)}():function*(){yield*all$2(o).sort(et)}()}function isAsyncIterable(o){return o[Symbol.asyncIterator]!=null}function take(o,et){return isAsyncIterable(o)?async function*(){let tt=0;if(!(et<1)){for await(const nt of o)if(yield nt,tt++,tt===et)return}}():function*(){let tt=0;if(!(et<1)){for(const nt of o)if(yield nt,tt++,tt===et)return}}()}class BaseDatastore{put(et,tt,nt){return Promise.reject(new Error(".put is not implemented"))}get(et,tt){return Promise.reject(new Error(".get is not implemented"))}has(et,tt){return Promise.reject(new Error(".has is not implemented"))}delete(et,tt){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(et,tt={}){for await(const{key:nt,value:rt}of et)await this.put(nt,rt,tt),yield nt}async*getMany(et,tt={}){for await(const nt of et)yield{key:nt,value:await this.get(nt,tt)}}async*deleteMany(et,tt={}){for await(const nt of et)await this.delete(nt,tt),yield nt}batch(){let et=[],tt=[];return{put(nt,rt){et.push({key:nt,value:rt})},delete(nt){tt.push(nt)},commit:async nt=>{await drain(this.putMany(et,nt)),et=[],await drain(this.deleteMany(tt,nt)),tt=[]}}}async*_all(et,tt){throw new Error("._all is not implemented")}async*_allKeys(et,tt){throw new Error("._allKeys is not implemented")}query(et,tt){let nt=this._all(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.key.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){let rt=0;const ot=et.offset;nt=filter(nt,()=>rt++>=ot)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}queryKeys(et,tt){let nt=this._allKeys(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){const rt=et.offset;let ot=0;nt=filter(nt,()=>ot++>=rt)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}}class MemoryDatastore extends BaseDatastore{constructor(){super();Ct(this,"data");this.data=new Map}put(tt,nt){return this.data.set(tt.toString(),nt),tt}get(tt){const nt=this.data.get(tt.toString());if(nt==null)throw new NotFoundError;return nt}has(tt){return this.data.has(tt.toString())}delete(tt){this.data.delete(tt.toString())}*_all(){for(const[tt,nt]of this.data.entries())yield{key:new Key(tt),value:nt}}*_allKeys(){for(const tt of this.data.keys())yield new Key(tt)}}function debounce(o,et){let tt;return function(){const nt=function(){tt=void 0,o()};clearTimeout(tt),tt=setTimeout(nt,et)}}const defaultAddressFilter=o=>o;function stripPeerId(o,et){const tt=o.getPeerId();return tt!=null&&peerIdFromString$1(tt).equals(et)&&(o=o.decapsulate(multiaddr(`/p2p/${et.toString()}`))),o}var $l;$l=Symbol.toStringTag;class DefaultAddressManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"listen");Ct(this,"announce");Ct(this,"observed");Ct(this,"announceFilter");Ct(this,$l,"@libp2p/address-manager");const{listen:nt=[],announce:rt=[]}=tt;this.components=et,this.log=et.logger.forComponent("libp2p:address-manager"),this.listen=nt.map(ot=>ot.toString()),this.announce=new Set(rt.map(ot=>ot.toString())),this.observed=new Map,this.announceFilter=tt.announceFilter??defaultAddressFilter,this._updatePeerStoreAddresses=debounce(this._updatePeerStoreAddresses.bind(this),1e3),et.events.addEventListener("transport:listening",()=>{this._updatePeerStoreAddresses()}),et.events.addEventListener("transport:close",()=>{this._updatePeerStoreAddresses()})}_updatePeerStoreAddresses(){const et=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter(([tt,nt])=>nt.confident).map(([tt])=>multiaddr(tt))).map(tt=>tt.getPeerId()===this.components.peerId.toString()?tt.decapsulate(`/p2p/${this.components.peerId.toString()}`):tt);this.components.peerStore.patch(this.components.peerId,{multiaddrs:et}).catch(tt=>{this.log.error("error updating addresses",tt)})}getListenAddrs(){return Array.from(this.listen).map(et=>multiaddr(et))}getAnnounceAddrs(){return Array.from(this.announce).map(et=>multiaddr(et))}getObservedAddrs(){return Array.from(this.observed).map(([et])=>multiaddr(et))}addObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.has(tt)||this.observed.set(tt,{confident:!1})}confirmObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString(),rt=(this.observed.get(tt)??{confident:!1}).confident;this.observed.set(tt,{confident:!0}),rt||this._updatePeerStoreAddresses()}removeObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.delete(tt)}getAddresses(){let et=this.getAnnounceAddrs().map(nt=>nt.toString());et.length===0&&(et=this.components.transportManager.getAddrs().map(nt=>nt.toString())),et=et.concat(Array.from(this.observed).filter(([nt,rt])=>rt.confident).map(([nt])=>nt));const tt=new Set(et);return this.announceFilter(Array.from(tt).map(nt=>multiaddr(nt))).map(nt=>{var rt;return((rt=nt.protos().pop())==null?void 0:rt.path)===!0||nt.getPeerId()===this.components.peerId.toString()?nt:nt.encapsulate(`/p2p/${this.components.peerId.toString()}`)})}}var messages;(function(o){o.NOT_STARTED_YET="The libp2p node is not started yet",o.NOT_FOUND="Not found"})(messages||(messages={}));class MissingServiceError extends Error{constructor(et="Missing service"){super(et),this.name="MissingServiceError"}}class UnmetServiceDependenciesError extends Error{constructor(et="Unmet service dependencies"){super(et),this.name="UnmetServiceDependenciesError"}}class NoContentRoutersError extends Error{constructor(et="No content routers available"){super(et),this.name="NoContentRoutersError"}}class NoPeerRoutersError extends Error{constructor(et="No peer routers available"){super(et),this.name="NoPeerRoutersError"}}class QueriedForSelfError extends Error{constructor(et="Should not try to find self"){super(et),this.name="QueriedForSelfError"}}class UnhandledProtocolError extends Error{constructor(et="Unhandled protocol error"){super(et),this.name="UnhandledProtocolError"}}class DuplicateProtocolHandlerError extends Error{constructor(et="Duplicate protocol handler error"){super(et),this.name="DuplicateProtocolHandlerError"}}class DialDeniedError extends Error{constructor(et="Dial denied error"){super(et),this.name="DialDeniedError"}}class NoValidAddressesError extends Error{constructor(et="No valid addresses"){super(et),this.name="NoValidAddressesError"}}class ConnectionInterceptedError extends Error{constructor(et="Connection intercepted"){super(et),this.name="ConnectionInterceptedError"}}class ConnectionDeniedError extends Error{constructor(et="Connection denied"){super(et),this.name="ConnectionDeniedError"}}class MuxerUnavailableError extends Error{constructor(et="Stream is not multiplexed"){super(et),this.name="MuxerUnavailableError"}}class EncryptionFailedError extends Error{constructor(et="Encryption failed"){super(et),this.name="EncryptionFailedError"}}class TransportUnavailableError extends Error{constructor(et="Transport unavailable"){super(et),this.name="TransportUnavailableError"}}class DefaultComponents{constructor(et={}){Ct(this,"components",{});Ct(this,"_started",!1);this.components={};for(const[tt,nt]of Object.entries(et))this.components[tt]=nt;this.components.logger==null&&(this.components.logger=defaultLogger())}isStarted(){return this._started}async _invokeStartableMethod(et){await Promise.all(Object.values(this.components).filter(tt=>isStartable(tt)).map(async tt=>{var nt;await((nt=tt[et])==null?void 0:nt.call(tt))}))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}const OPTIONAL_SERVICES=["metrics","connectionProtector","dns"],NON_SERVICE_PROPERTIES=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];function defaultComponents(o={}){const et=new DefaultComponents(o);return new Proxy(et,{get(nt,rt,ot){if(typeof rt=="string"&&!NON_SERVICE_PROPERTIES.includes(rt)){const it=et.components[rt];if(it==null&&!OPTIONAL_SERVICES.includes(rt))throw new MissingServiceError(`${rt} not set`);return it}return Reflect.get(nt,rt,ot)},set(nt,rt,ot){return typeof rt=="string"?et.components[rt]=ot:Reflect.set(nt,rt,ot),!0}})}function checkServiceDependencies(o){const et={};for(const tt of Object.values(o.components))for(const nt of getServiceCapabilities(tt))et[nt]=!0;for(const tt of Object.values(o.components))for(const nt of getServiceDependencies(tt))if(et[nt]!==!0)throw new UnmetServiceDependenciesError(`Service "${getServiceName(tt)}" required capability "${nt}" but it was not provided by any component, you may need to add additional configuration when creating your node.`)}function getServiceCapabilities(o){return Array.isArray(o==null?void 0:o[serviceCapabilities])?o[serviceCapabilities]:[]}function getServiceDependencies(o){return Array.isArray(o==null?void 0:o[serviceDependencies])?o[serviceDependencies]:[]}function getServiceName(o){return(o==null?void 0:o[Symbol.toStringTag])??(o==null?void 0:o.toString())??"unknown"}function connectionGater(o={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async et=>{const tt=et.stringTuples();return tt[0][0]===4||tt[0][0]===41?!!isPrivateIp(`${tt[0][1]}`):!1},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...o}}function getPeerAddress(o){if(isPeerId$1(o))return{peerId:o,multiaddrs:[]};Array.isArray(o)||(o=[o]);let et;if(o.length>0){const tt=o[0].getPeerId();et=tt==null?void 0:peerIdFromString$1(tt),o.forEach(nt=>{if(!isMultiaddr(nt))throw new InvalidMultiaddrError("Invalid multiaddr");const rt=nt.getPeerId();if(rt==null){if(et!=null)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}else{const ot=peerIdFromString$1(rt);if((et==null?void 0:et.equals(ot))!==!0)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}})}return{peerId:et,multiaddrs:o}}const DEFAULT_CLOSABLE_PROTOCOLS=["/ipfs/id/1.0.0","/ipfs/id/push/1.0.0","/libp2p/autonat/1.0.0","/libp2p/dcutr"];async function safelyCloseConnectionIfUnused(o,et){var rt;const tt=((rt=o==null?void 0:o.streams)==null?void 0:rt.map(ot=>ot.protocol))??[],nt=(et==null?void 0:et.closableProtocols)??DEFAULT_CLOSABLE_PROTOCOLS;if(!(tt.filter(ot=>ot!=null&&!nt.includes(ot)).length>0))try{await(o==null?void 0:o.close(et))}catch(ot){o==null||o.abort(ot)}}const DIAL_TIMEOUT=5e3,UPGRADE_TIMEOUT=3e3,PROTOCOL_NEGOTIATION_TIMEOUT=2e3,MAX_PEER_ADDRS_TO_DIAL=25,INBOUND_CONNECTION_THRESHOLD=5,MAX_INCOMING_PENDING_CONNECTIONS=10,MAX_PARALLEL_RECONNECTS=5,LAST_DIAL_FAILURE_KEY="last-dial-failure",LAST_DIAL_SUCCESS_KEY="last-dial-success",MAX_DIAL_QUEUE_LENGTH=500,MAX_CONNECTIONS=100,MAX_PARALLEL_DIALS=50,defaultOptions$2={maxConnections:MAX_CONNECTIONS,allow:[]};class ConnectionPruner{constructor(et,tt={}){Ct(this,"maxConnections");Ct(this,"connectionManager");Ct(this,"peerStore");Ct(this,"allow");Ct(this,"events");Ct(this,"log");this.maxConnections=tt.maxConnections??defaultOptions$2.maxConnections,this.allow=tt.allow??defaultOptions$2.allow,this.connectionManager=et.connectionManager,this.peerStore=et.peerStore,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager:connection-pruner"),this.maybePruneConnections=this.maybePruneConnections.bind(this)}start(){this.events.addEventListener("connection:open",this.maybePruneConnections)}stop(){this.events.removeEventListener("connection:open",this.maybePruneConnections)}maybePruneConnections(){this._maybePruneConnections().catch(et=>{this.log.error("error while pruning connections %e",et)})}async _maybePruneConnections(){const et=this.connectionManager.getConnections(),tt=et.length;if(this.log("checking max connections limit %d/%d",tt,this.maxConnections),tt<=this.maxConnections)return;const nt=new PeerMap;for(const st of et){const at=st.remotePeer;if(!nt.has(at)){nt.set(at,0);try{const ct=await this.peerStore.get(at);nt.set(at,[...ct.tags.values()].reduce((lt,dt)=>lt+dt.value,0))}catch(ct){ct.name!=="NotFoundError"&&this.log.error("error loading peer tags",ct)}}}const rt=this.sortConnections(et,nt),ot=Math.max(tt-this.maxConnections,0),it=[];for(const st of rt)if(this.log("too many connections open - closing a connection to %p",st.remotePeer),this.allow.some(ct=>st.remoteAddr.toString().startsWith(ct.toString()))||it.push(st),it.length===ot)break;await Promise.all(it.map(async st=>{await safelyCloseConnectionIfUnused(st,{signal:AbortSignal.timeout(1e3)})})),this.events.safeDispatchEvent("connection:prune",{detail:it})}sortConnections(et,tt){return et.sort((nt,rt)=>{const ot=nt.timeline.open,it=rt.timeline.open;return otit?-1:0}).sort((nt,rt)=>nt.direction==="outbound"&&rt.direction==="inbound"?1:nt.direction==="inbound"&&rt.direction==="outbound"?-1:0).sort((nt,rt)=>nt.streams.length>rt.streams.length?1:nt.streams.length{const ot=tt.get(nt.remotePeer)??0,it=tt.get(rt.remotePeer)??0;return ot>it?1:ot{function st(){tt==null||tt.removeEventListener("abort",lt),o.removeEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.removeEventListener(nt.errorEvent,ct)}const at=dt=>{var ht;try{if(((ht=nt==null?void 0:nt.filter)==null?void 0:ht.call(nt,dt))===!1)return}catch(pt){st(),it(pt);return}st(),ot(dt)},ct=dt=>{st(),it(dt.detail)},lt=()=>{st(),it(rt)};tt==null||tt.addEventListener("abort",lt),o.addEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.addEventListener(nt.errorEvent,ct)})}class JobRecipient{constructor(et){Ct(this,"deferred");Ct(this,"signal");var tt;this.signal=et,this.deferred=pDefer(),this.onAbort=this.onAbort.bind(this),(tt=this.signal)==null||tt.addEventListener("abort",this.onAbort)}onAbort(){var et;this.deferred.reject(((et=this.signal)==null?void 0:et.reason)??new AbortError$6)}cleanup(){var et;(et=this.signal)==null||et.removeEventListener("abort",this.onAbort)}}function randomId(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}class Job{constructor(et,tt){Ct(this,"id");Ct(this,"fn");Ct(this,"options");Ct(this,"recipients");Ct(this,"status");Ct(this,"timeline");Ct(this,"controller");this.id=randomId(),this.status="queued",this.fn=et,this.options=tt,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,setMaxListeners$2(1/0,this.controller.signal),this.onAbort=this.onAbort.bind(this)}abort(et){this.controller.abort(et)}onAbort(){this.recipients.reduce((tt,nt)=>{var rt;return tt&&((rt=nt.signal)==null?void 0:rt.aborted)===!0},!0)&&(this.controller.abort(new AbortError$6),this.cleanup())}async join(et={}){var nt;const tt=new JobRecipient(et.signal);return this.recipients.push(tt),(nt=et.signal)==null||nt.addEventListener("abort",this.onAbort),tt.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();const et=await raceSignal(this.fn({...this.options??{},signal:this.controller.signal}),this.controller.signal);this.recipients.forEach(tt=>{tt.deferred.resolve(et)}),this.status="complete"}catch(et){this.recipients.forEach(tt=>{tt.deferred.reject(et)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(et=>{var tt;et.cleanup(),(tt=et.signal)==null||tt.removeEventListener("abort",this.onAbort)})}}class Queue extends TypedEventEmitter$1{constructor(tt={}){var nt;super();Ct(this,"concurrency");Ct(this,"maxSize");Ct(this,"queue");Ct(this,"pending");Ct(this,"sort");this.concurrency=tt.concurrency??Number.POSITIVE_INFINITY,this.maxSize=tt.maxSize??Number.POSITIVE_INFINITY,this.pending=0,tt.metricName!=null&&((nt=tt.metrics)==null||nt.registerMetricGroup(tt.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})})),this.sort=tt.sort,this.queue=[]}tryToStartAnother(){if(this.size===0)return queueMicrotask(()=>{this.safeDispatchEvent("empty")}),this.running===0&&queueMicrotask(()=>{this.safeDispatchEvent("idle")}),!1;if(this.pending{for(let nt=0;nt(this.safeDispatchEvent("completed",{detail:it}),this.safeDispatchEvent("success",{detail:{job:rt,result:it}}),it)).catch(it=>{if(rt.status==="queued"){for(let st=0;st{tt.abort(new AbortError$6)}),this.clear()}async onEmpty(tt){this.size!==0&&await raceEvent(this,"empty",tt==null?void 0:tt.signal)}async onSizeLessThan(tt,nt){this.sizethis.size{ht!=null?this.abort():this.clear(),nt.end(ht)},ot=ht=>{ht.detail!=null&&nt.push(ht.detail)},it=ht=>{rt(ht.detail)},st=()=>{rt()},at=()=>{rt(new AbortError$6("Queue aborted"))};this.addEventListener("completed",ot),this.addEventListener("error",it),this.addEventListener("idle",st),(lt=tt==null?void 0:tt.signal)==null||lt.addEventListener("abort",at);try{yield*nt}finally{this.removeEventListener("completed",ot),this.removeEventListener("error",it),this.removeEventListener("idle",st),(dt=tt==null?void 0:tt.signal)==null||dt.removeEventListener("abort",at),rt()}}}class PriorityQueue extends Queue{constructor(et={}){super({...et,sort:(tt,nt)=>tt.options.priority>nt.options.priority?-1:tt.options.priorityrt.toString())),nt}const defaultOptions$1={maxParallelDials:MAX_PARALLEL_DIALS,maxDialQueueLength:MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:MAX_PEER_ADDRS_TO_DIAL,dialTimeout:DIAL_TIMEOUT,resolvers:{dnsaddr:dnsaddrResolver}};class DialQueue{constructor(et,tt={}){Ct(this,"queue");Ct(this,"components");Ct(this,"addressSorter");Ct(this,"maxPeerAddrsToDial");Ct(this,"maxDialQueueLength");Ct(this,"dialTimeout");Ct(this,"shutDownController");Ct(this,"connections");Ct(this,"log");this.addressSorter=tt.addressSorter,this.maxPeerAddrsToDial=tt.maxPeerAddrsToDial??defaultOptions$1.maxPeerAddrsToDial,this.maxDialQueueLength=tt.maxDialQueueLength??defaultOptions$1.maxDialQueueLength,this.dialTimeout=tt.dialTimeout??defaultOptions$1.dialTimeout,this.connections=tt.connections??new PeerMap,this.log=et.logger.forComponent("libp2p:connection-manager:dial-queue"),this.components=et,this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal);for(const[nt,rt]of Object.entries(tt.resolvers??{}))resolvers$1.set(nt,rt);this.queue=new PriorityQueue({concurrency:tt.maxParallelDials??defaultOptions$1.maxParallelDials,metricName:"libp2p_dial_queue",metrics:et.metrics}),this.queue.addEventListener("error",nt=>{nt.detail.name!==AbortError$4.name&&this.log.error("error in dial queue - %e",nt.detail)})}start(){this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal)}stop(){this.shutDownController.abort(),this.queue.abort()}async dial(et,tt={}){var st,at,ct;const{peerId:nt,multiaddrs:rt}=getPeerAddress(et),ot=Array.from(this.connections.values()).flat().find(lt=>tt.force===!0?!1:lt.remotePeer.equals(nt)?!0:rt.find(dt=>dt.equals(lt.remoteAddr)));if((ot==null?void 0:ot.status)==="open")return this.log("already connected to %a",ot.remoteAddr),(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ot;const it=this.queue.queue.find(lt=>{if((nt==null?void 0:nt.equals(lt.options.peerId))===!0)return!0;const dt=lt.options.multiaddrs;if(dt==null)return!1;for(const ht of rt)if(dt.has(ht.toString()))return!0;return!1});if(it!=null){this.log("joining existing dial target for %p",nt);for(const lt of rt)it.options.multiaddrs.add(lt.toString());return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dial-queue:already-in-dial-queue")),it.join(tt)}if(this.queue.size>=this.maxDialQueueLength)throw new DialError("Dial queue is full");return this.log("creating dial target for %p",nt,rt.map(lt=>lt.toString())),(ct=tt.onProgress)==null||ct.call(tt,new CustomProgressEvent("dial-queue:add-to-dial-queue")),this.queue.add(async lt=>{var pt,mt;(pt=lt==null?void 0:lt.onProgress)==null||pt.call(lt,new CustomProgressEvent("dial-queue:start-dial"));const dt=this.createDialAbortController(lt==null?void 0:lt.signal);let ht;try{ht=await this.calculateMultiaddrs(nt,lt==null?void 0:lt.multiaddrs,{...lt,signal:dt}),(mt=lt==null?void 0:lt.onProgress)==null||mt.call(lt,new CustomProgressEvent("dial-queue:calculated-addresses",ht)),ht.map(({multiaddr:ft})=>ft.toString()).forEach(ft=>{lt==null||lt.multiaddrs.add(ft)})}catch(ft){throw dt.clear(),ft}try{let ft=0;const yt=[];for(const gt of ht){if(ft===this.maxPeerAddrsToDial)throw this.log("dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others",ft,nt),new DialError("Peer had more than maxPeerAddrsToDial");ft++;try{const xt=await this.components.transportManager.dial(gt.multiaddr,{...lt,signal:dt});this.log("dial to %a succeeded",gt.multiaddr);try{await this.components.peerStore.merge(xt.remotePeer,{multiaddrs:[xt.remoteAddr],metadata:{[LAST_DIAL_SUCCESS_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}return xt}catch(xt){if(this.log.error("dial failed to %a",gt.multiaddr,xt),nt!=null)try{await this.components.peerStore.merge(nt,{metadata:{[LAST_DIAL_FAILURE_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}if(dt.aborted)throw new TimeoutError$2(xt.message);yt.push(xt)}}throw yt.length===1?yt[0]:new AggregateError(yt,"All multiaddr dials failed")}finally{dt.clear()}},{peerId:nt,priority:tt.priority??DEFAULT_DIAL_PRIORITY,multiaddrs:new Set(rt.map(lt=>lt.toString())),signal:tt.signal,onProgress:tt.onProgress})}createDialAbortController(et){const tt=anySignal([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,et]);return setMaxListeners(1/0,tt),tt}async calculateMultiaddrs(et,tt=new Set,nt={}){var dt,ht;const rt=[...tt].map(pt=>({multiaddr:multiaddr(pt),isCertified:!1}));if(et!=null){if(this.components.peerId.equals(et))throw new DialError("Tried to dial self");if(await((ht=(dt=this.components.connectionGater).denyDialPeer)==null?void 0:ht.call(dt,et))===!0)throw new DialDeniedError("The dial request is blocked by gater.allowDialPeer");if(rt.length===0){this.log("loading multiaddrs for %p",et);try{const pt=await this.components.peerStore.get(et);rt.push(...pt.addresses),this.log("loaded multiaddrs for %p",et,rt.map(({multiaddr:mt})=>mt.toString()))}catch(pt){if(pt.name!=="NotFoundError")throw pt}}if(rt.length===0){this.log("looking up multiaddrs for %p in the peer routing",et);try{const pt=await this.components.peerRouting.findPeer(et);this.log("found multiaddrs for %p in the peer routing",et,rt.map(({multiaddr:mt})=>mt.toString())),rt.push(...pt.multiaddrs.map(mt=>({multiaddr:mt,isCertified:!1})))}catch(pt){pt.name!=="NoPeerRoutersError"&&this.log.error("looking up multiaddrs for %p in the peer routing failed",et,pt)}}}let ot=(await Promise.all(rt.map(async pt=>{const mt=await resolveMultiaddrs(pt.multiaddr,{dns:this.components.dns,...nt,log:this.log});return mt.length===1&&mt[0].equals(pt.multiaddr)?pt:mt.map(ft=>({multiaddr:ft,isCertified:!1}))}))).flat();if(et!=null){const pt=`/p2p/${et.toString()}`;ot=ot.map(mt=>{const ft=mt.multiaddr.protos().pop();return(ft==null?void 0:ft.path)===!0?mt:mt.multiaddr.getPeerId()==null?{multiaddr:mt.multiaddr.encapsulate(pt),isCertified:mt.isCertified}:mt})}const it=ot.filter(pt=>{if(this.components.transportManager.dialTransportForMultiaddr(pt.multiaddr)==null)return!1;const mt=pt.multiaddr.getPeerId();return et!=null&&mt!=null?et.equals(mt):!0}),st=new Map;for(const pt of it){const mt=pt.multiaddr.toString(),ft=st.get(mt);if(ft!=null){ft.isCertified=ft.isCertified||pt.isCertified||!1;continue}st.set(mt,pt)}const at=[...st.values()];if(at.length===0)throw new NoValidAddressesError("The dial request has no valid addresses");const ct=[];for(const pt of at)this.components.connectionGater.denyDialMultiaddr!=null&&await this.components.connectionGater.denyDialMultiaddr(pt.multiaddr)||ct.push(pt);const lt=this.addressSorter==null?defaultAddressSorter(ct):ct.sort(this.addressSorter);if(lt.length===0)throw new DialDeniedError("The connection gater denied all addresses in the dial request");return this.log.trace("addresses for %p before filtering",et??"unknown peer",ot.map(({multiaddr:pt})=>pt.toString())),this.log.trace("addresses for %p after filtering",et??"unknown peer",lt.map(({multiaddr:pt})=>pt.toString())),lt}async isDialable(et,tt={}){Array.isArray(et)||(et=[et]);try{const nt=await this.calculateMultiaddrs(void 0,new Set(et.map(rt=>rt.toString())),tt);return tt.runOnLimitedConnection===!1?nt.find(rt=>!Circuit.matches(rt.multiaddr))!=null:!0}catch(nt){this.log.trace("error calculating if multiaddr(s) were dialable",nt)}return!1}}class PeerQueue extends Queue{has(et){return this.find(et)!=null}find(et){return this.queue.find(tt=>et.equals(tt.options.peerId))}}var retry$2={};function RetryOperation(o,et){typeof et=="boolean"&&(et={forever:et}),this._originalTimeouts=JSON.parse(JSON.stringify(o)),this._timeouts=o,this._options=et||{},this._maxRetryTime=et&&et.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(o){if(this._timeout&&clearTimeout(this._timeout),!o)return!1;var et=new Date().getTime();if(o&&et-this._operationStart>=this._maxRetryTime)return this._errors.push(o),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(o);var tt=this._timeouts.shift();if(tt===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),tt=this._cachedTimeouts.slice(-1);else return!1;var nt=this;return this._timer=setTimeout(function(){nt._attempts++,nt._operationTimeoutCb&&(nt._timeout=setTimeout(function(){nt._operationTimeoutCb(nt._attempts)},nt._operationTimeout),nt._options.unref&&nt._timeout.unref()),nt._fn(nt._attempts)},tt),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(o,et){this._fn=o,et&&(et.timeout&&(this._operationTimeout=et.timeout),et.cb&&(this._operationTimeoutCb=et.cb));var tt=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){tt._operationTimeoutCb()},tt._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(o){console.log("Using RetryOperation.try() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=function(o){console.log("Using RetryOperation.start() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var o={},et=null,tt=0,nt=0;nt=tt&&(et=rt,tt=it)}return et};(function(o){var et=retry_operation;o.operation=function(tt){var nt=o.timeouts(tt);return new et(nt,{forever:tt&&(tt.forever||tt.retries===1/0),unref:tt&&tt.unref,maxRetryTime:tt&&tt.maxRetryTime})},o.timeouts=function(tt){if(tt instanceof Array)return[].concat(tt);var nt={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var rt in tt)nt[rt]=tt[rt];if(nt.minTimeout>nt.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var ot=[],it=0;itobjectToString.call(o)==="[object Error]",errorMessages=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function isNetworkError(o){return o&&isError(o)&&o.name==="TypeError"&&typeof o.message=="string"?o.message==="Load failed"?o.stack===void 0:errorMessages.has(o.message):!1}let AbortError$1=class extends Error{constructor(et){super(),et instanceof Error?(this.originalError=et,{message:et}=et):(this.originalError=new Error(et),this.originalError.stack=this.stack),this.name="AbortError",this.message=et}};const decorateErrorWithCounts=(o,et,tt)=>{const nt=tt.retries-(et-1);return o.attemptNumber=et,o.retriesLeft=nt,o};async function pRetry(o,et){return new Promise((tt,nt)=>{et={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...et};const rt=retry$1.operation(et),ot=()=>{var st;rt.stop(),nt((st=et.signal)==null?void 0:st.reason)};et.signal&&!et.signal.aborted&&et.signal.addEventListener("abort",ot,{once:!0});const it=()=>{var st;(st=et.signal)==null||st.removeEventListener("abort",ot),rt.stop()};rt.attempt(async st=>{try{const at=await o(st);it(),tt(at)}catch(at){try{if(!(at instanceof Error))throw new TypeError(`Non-error was thrown: "${at}". You should only throw errors.`);if(at instanceof AbortError$1)throw at.originalError;if(at instanceof TypeError&&!isNetworkError(at))throw at;if(decorateErrorWithCounts(at,st,et),await et.shouldRetry(at)||(rt.stop(),nt(at)),await et.onFailedAttempt(at),!rt.retry(at))throw rt.mainError()}catch(ct){decorateErrorWithCounts(ct,st,et),it(),nt(ct)}}})})}class ReconnectQueue{constructor(et,tt={}){Ct(this,"log");Ct(this,"queue");Ct(this,"started");Ct(this,"peerStore");Ct(this,"retries");Ct(this,"retryInterval");Ct(this,"backoffFactor");Ct(this,"connectionManager");Ct(this,"events");this.log=et.logger.forComponent("libp2p:reconnect-queue"),this.peerStore=et.peerStore,this.connectionManager=et.connectionManager,this.queue=new PeerQueue({concurrency:tt.maxParallelReconnects??MAX_PARALLEL_RECONNECTS,metricName:"libp2p_reconnect_queue",metrics:et.metrics}),this.started=!1,this.retries=tt.retries??5,this.backoffFactor=tt.backoffFactor,this.retryInterval=tt.retryInterval,this.events=et.events,et.events.addEventListener("peer:disconnect",nt=>{this.maybeReconnect(nt.detail).catch(rt=>{this.log.error("failed to maybe reconnect to %p - %e",nt.detail,rt)})})}async maybeReconnect(et){if(!this.started)return;const tt=await this.peerStore.get(et);hasKeepAliveTag(tt)&&(this.queue.has(et)||this.queue.add(async nt=>{await pRetry(async rt=>{if(this.started)try{await this.connectionManager.openConnection(et,{signal:nt==null?void 0:nt.signal})}catch(ot){throw this.log("reconnecting to %p attempt %d of %d failed - %e",et,rt,this.retries,ot),ot}},{signal:nt==null?void 0:nt.signal,retries:this.retries,factor:this.backoffFactor,minTimeout:this.retryInterval})},{peerId:et}).catch(async nt=>{this.log.error("failed to reconnect to %p - %e",et,nt);const rt={};[...tt.tags.keys()].forEach(ot=>{ot.startsWith(KEEP_ALIVE)&&(rt[ot]=void 0)}),await this.peerStore.merge(et,{tags:rt}),this.events.safeDispatchEvent("peer:reconnect-failure",{detail:et})}).catch(async nt=>{this.log.error("failed to remove keep-alive tag from %p - %e",et,nt)}))}start(){this.started=!0}async afterStart(){Promise.resolve().then(async()=>{const et=await this.peerStore.all({filters:[tt=>hasKeepAliveTag(tt)]});await Promise.all(et.map(async tt=>{await this.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error(nt)})}))}).catch(et=>{this.log.error(et)})}stop(){this.started=!1,this.queue.abort()}}function hasKeepAliveTag(o){for(const et of o.tags.keys())if(et.startsWith(KEEP_ALIVE))return!0;return!1}const DEFAULT_DIAL_PRIORITY=50,defaultOptions={maxConnections:MAX_CONNECTIONS,inboundConnectionThreshold:INBOUND_CONNECTION_THRESHOLD,maxIncomingPendingConnections:MAX_INCOMING_PENDING_CONNECTIONS};var Ol;Ol=Symbol.toStringTag;class DefaultConnectionManager{constructor(et,tt={}){Ct(this,"started");Ct(this,"connections");Ct(this,"allow");Ct(this,"deny");Ct(this,"maxIncomingPendingConnections");Ct(this,"incomingPendingConnections");Ct(this,"outboundPendingConnections");Ct(this,"maxConnections");Ct(this,"dialQueue");Ct(this,"reconnectQueue");Ct(this,"connectionPruner");Ct(this,"inboundConnectionRateLimiter");Ct(this,"peerStore");Ct(this,"metrics");Ct(this,"events");Ct(this,"log");Ct(this,"peerId");Ct(this,Ol,"@libp2p/connection-manager");if(this.maxConnections=tt.maxConnections??defaultOptions.maxConnections,this.maxConnections<1)throw new InvalidParametersError$1("Connection Manager maxConnections must be greater than 0");this.connections=new PeerMap,this.started=!1,this.peerId=et.peerId,this.peerStore=et.peerStore,this.metrics=et.metrics,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager"),this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.allow=(tt.allow??[]).map(nt=>multiaddr(nt)),this.deny=(tt.deny??[]).map(nt=>multiaddr(nt)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=tt.maxIncomingPendingConnections??defaultOptions.maxIncomingPendingConnections,this.outboundPendingConnections=0,this.inboundConnectionRateLimiter=new RateLimiter({points:tt.inboundConnectionThreshold??defaultOptions.inboundConnectionThreshold,duration:1}),this.connectionPruner=new ConnectionPruner({connectionManager:this,peerStore:et.peerStore,events:et.events,logger:et.logger},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new DialQueue(et,{addressSorter:tt.addressSorter,maxParallelDials:tt.maxParallelDials??MAX_PARALLEL_DIALS,maxDialQueueLength:tt.maxDialQueueLength??MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:tt.maxPeerAddrsToDial??MAX_PEER_ADDRS_TO_DIAL,dialTimeout:tt.dialTimeout??DIAL_TIMEOUT,resolvers:tt.resolvers??{dnsaddr:dnsaddrResolver},connections:this.connections}),this.reconnectQueue=new ReconnectQueue({events:et.events,peerStore:et.peerStore,logger:et.logger,connectionManager:this},{retries:tt.reconnectRetries,retryInterval:tt.reconnectRetryInterval,backoffFactor:tt.reconnectBackoffFactor,maxParallelReconnects:tt.maxParallelReconnects})}async start(){var et,tt,nt;(et=this.metrics)==null||et.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const rt={inbound:0,"inbound pending":this.incomingPendingConnections,outbound:0,"outbound pending":this.outboundPendingConnections};for(const ot of this.connections.values())for(const it of ot)rt[it.direction]++;return rt}}),(tt=this.metrics)==null||tt.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const rt={};for(const ot of this.connections.values())for(const it of ot)for(const st of it.streams){const at=`${st.direction} ${st.protocol??"unnegotiated"}`;rt[at]=(rt[at]??0)+1}return rt}}),(nt=this.metrics)==null||nt.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const rt={};for(const it of this.connections.values())for(const st of it){const at={};for(const ct of st.streams){const lt=`${ct.direction} ${ct.protocol??"unnegotiated"}`;at[lt]=(at[lt]??0)+1}for(const[ct,lt]of Object.entries(at))rt[ct]=rt[ct]??[],rt[ct].push(lt)}const ot={};for(let[it,st]of Object.entries(rt)){st=st.sort((ct,lt)=>ct-lt);const at=Math.floor(st.length*.9);ot[it]=st[at]}return ot}}),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),await start(this.dialQueue,this.reconnectQueue,this.connectionPruner),this.started=!0,this.log("started")}async stop(){this.events.removeEventListener("connection:open",this.onConnect),this.events.removeEventListener("connection:close",this.onDisconnect),await stop(this.reconnectQueue,this.dialQueue,this.connectionPruner);const et=[];for(const tt of this.connections.values())for(const nt of tt)et.push((async()=>{try{await nt.close()}catch(rt){this.log.error(rt)}})());this.log("closing %d connections",et.length),await Promise.all(et),this.connections.clear(),this.log("stopped")}onConnect(et){this._onConnect(et).catch(tt=>{this.log.error(tt)})}async _onConnect(et){const{detail:tt}=et;if(!this.started){await tt.close();return}if(tt.status!=="open")return;const nt=tt.remotePeer,rt=!this.connections.has(nt),ot=this.connections.get(nt)??[];ot.push(tt),this.connections.set(nt,ot),nt.publicKey!=null&&nt.type==="RSA"&&await this.peerStore.patch(nt,{publicKey:nt.publicKey}),rt&&this.events.safeDispatchEvent("peer:connect",{detail:tt.remotePeer})}onDisconnect(et){const{detail:tt}=et,nt=tt.remotePeer,ot=(this.connections.get(nt)??[]).filter(it=>it.id!==tt.id);this.connections.set(nt,ot),ot.length===0&&(this.log("onDisconnect remove all connections for peer %p",nt),this.connections.delete(nt),this.events.safeDispatchEvent("peer:disconnect",{detail:tt.remotePeer}))}getConnections(et){if(et!=null)return this.connections.get(et)??[];let tt=[];for(const nt of this.connections.values())tt=tt.concat(nt);return tt}getConnectionsMap(){return this.connections}async openConnection(et,tt={}){var nt,rt;if(!this.started)throw new NotStartedError("Not started");this.outboundPendingConnections++;try{(nt=tt.signal)==null||nt.throwIfAborted();const{peerId:ot}=getPeerAddress(et);if(this.peerId.equals(ot))throw new InvalidPeerIdError("Can not dial self");if(ot!=null&&tt.force!==!0){this.log("dial %p",ot);const ct=this.getConnections(ot).find(lt=>lt.limits==null);if(ct!=null)return this.log("had an existing non-limited connection to %p",ot),(rt=tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ct}const it=await this.dialQueue.dial(et,{...tt,priority:tt.priority??DEFAULT_DIAL_PRIORITY});if(it.status!=="open")throw new ConnectionClosedError("Remote closed connection during opening");let st=this.connections.get(it.remotePeer);st==null&&(st=[],this.connections.set(it.remotePeer,st));let at=!1;for(const ct of st)if(ct.id===it.id&&(at=!0),tt.force!==!0&&ct.id!==it.id&&ct.remoteAddr.equals(it.remoteAddr))return it.abort(new InvalidMultiaddrError("Duplicate multiaddr connection")),ct;return at||st.push(it),it}finally{this.outboundPendingConnections--}}async closeConnections(et,tt={}){const nt=this.connections.get(et)??[];await Promise.all(nt.map(async rt=>{try{await rt.close(tt)}catch(ot){rt.abort(ot)}}))}async acceptIncomingConnection(et){if(this.deny.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.log("connection from %a refused - connection remote address was in deny list",et.remoteAddr),!1;if(this.allow.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return this.log("connection from %a refused - incomingPendingConnections exceeded by host",et.remoteAddr),!1;if(et.remoteAddr.isThinWaistAddress()){const rt=et.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(rt,1)}catch{return this.log("connection from %a refused - inboundConnectionThreshold exceeded by host %s",et.remoteAddr,rt),!1}}return this.getConnections().length({id:tt.id,status:et[tt.status],peerId:tt.options.peerId,multiaddrs:[...tt.options.multiaddrs].map(nt=>multiaddr(nt))}))}async isDialable(et,tt={}){return this.dialQueue.isDialable(et,tt)}}class MovingAverage{constructor(et){Ct(this,"movingAverage");Ct(this,"variance");Ct(this,"deviation");Ct(this,"forecast");Ct(this,"timespan");Ct(this,"previousTime");this.timespan=et,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(et,tt){return 1-Math.exp(-(et-tt)/this.timespan)}push(et,tt=Date.now()){if(this.previousTime!=null){const nt=this.alpha(tt,this.previousTime),rt=et-this.movingAverage,ot=nt*rt;this.movingAverage=nt*et+(1-nt)*this.movingAverage,this.variance=(1-nt)*(this.variance+rt*ot),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+nt*rt}else this.movingAverage=et;this.previousTime=tt}}const DEFAULT_TIMEOUT_MULTIPLIER=1.2,DEFAULT_FAILURE_MULTIPLIER=2,DEFAULT_MIN_TIMEOUT=2e3;class AdaptiveTimeout{constructor(et={}){Ct(this,"success");Ct(this,"failure");Ct(this,"next");Ct(this,"metric");Ct(this,"timeoutMultiplier");Ct(this,"failureMultiplier");Ct(this,"minTimeout");var tt;this.success=new MovingAverage(et.interval??5e3),this.failure=new MovingAverage(et.interval??5e3),this.next=new MovingAverage(et.interval??5e3),this.failureMultiplier=et.failureMultiplier??DEFAULT_FAILURE_MULTIPLIER,this.timeoutMultiplier=et.timeoutMultiplier??DEFAULT_TIMEOUT_MULTIPLIER,this.minTimeout=et.minTimeout??DEFAULT_MIN_TIMEOUT,et.metricName!=null&&(this.metric=(tt=et.metrics)==null?void 0:tt.registerMetricGroup(et.metricName))}getTimeoutSignal(et={}){const tt=Math.max(Math.round(this.next.movingAverage*(et.timeoutFactor??this.timeoutMultiplier)),this.minTimeout),nt=AbortSignal.timeout(tt),rt=anySignal([et.signal,nt]);return setMaxListeners$2(1/0,rt,nt),rt.start=Date.now(),rt.timeout=tt,rt}cleanUp(et){var nt,rt;const tt=Date.now()-et.start;et.aborted?(this.failure.push(tt),this.next.push(tt*this.failureMultiplier),(nt=this.metric)==null||nt.update({failureMovingAverage:this.failure.movingAverage,failureDeviation:this.failure.deviation,failureForecast:this.failure.forecast,failureVariance:this.failure.variance,failure:tt})):(this.success.push(tt),this.next.push(tt),(rt=this.metric)==null||rt.update({successMovingAverage:this.success.movingAverage,successDeviation:this.success.deviation,successForecast:this.success.forecast,successVariance:this.success.variance,success:tt}))}}const DEFAULT_PING_INTERVAL_MS=1e4,PROTOCOL_VERSION="1.0.0",PROTOCOL_NAME="ping",PROTOCOL_PREFIX="ipfs",PING_LENGTH=32,DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE=!0;var Ml,Bl;Bl=Symbol.toStringTag,Ml=serviceCapabilities;class ConnectionMonitor{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"log");Ct(this,"heartbeatInterval");Ct(this,"pingIntervalMs");Ct(this,"abortController");Ct(this,"timeout");Ct(this,"abortConnectionOnPingFailure");Ct(this,Bl,"@libp2p/connection-monitor");Ct(this,Ml,["@libp2p/connection-monitor"]);this.components=et,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`,this.log=et.logger.forComponent("libp2p:connection-monitor"),this.pingIntervalMs=tt.pingInterval??DEFAULT_PING_INTERVAL_MS,this.abortConnectionOnPingFailure=tt.abortConnectionOnPingFailure??DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE,this.timeout=new AdaptiveTimeout({...tt.pingTimeout??{},metrics:et.metrics,metricName:"libp2p_connection_monitor_ping_time_milliseconds"})}start(){this.abortController=new AbortController,setMaxListeners(1/0,this.abortController.signal),this.heartbeatInterval=setInterval(()=>{this.components.connectionManager.getConnections().forEach(et=>{Promise.resolve().then(async()=>{var nt;let tt=Date.now();try{const rt=this.timeout.getTimeoutSignal({signal:(nt=this.abortController)==null?void 0:nt.signal}),ot=await et.newStream(this.protocol,{signal:rt,runOnLimitedConnection:!0}),it=byteStream(ot);tt=Date.now(),await Promise.all([it.write(randomBytes(PING_LENGTH),{signal:rt}),it.read(PING_LENGTH,{signal:rt})]),et.rtt=Date.now()-tt,await it.unwrap().close({signal:rt})}catch(rt){if(rt.name!=="UnsupportedProtocolError")throw rt;et.rtt=(Date.now()-tt)/2}}).catch(tt=>{this.log.error("error during heartbeat",tt),this.abortConnectionOnPingFailure?(this.log.error("aborting connection due to ping failure"),et.abort(tt)):this.log("connection ping failed, but not aborting due to abortConnectionOnPingFailure flag")})})},this.pingIntervalMs)}stop(){var et;(et=this.abortController)==null||et.abort(),this.heartbeatInterval!=null&&clearInterval(this.heartbeatInterval)}}var Dl;Dl=Symbol.toStringTag;class CompoundContentRouting{constructor(et,tt){Ct(this,"routers");Ct(this,"started");Ct(this,"components");Ct(this,Dl,"@libp2p/content-routing");this.routers=tt.routers??[],this.started=!1,this.components=et}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");const nt=this,rt=new PeerSet;for await(const ot of merge$2(...nt.routers.map(it=>it.findProviders(et,tt))))ot!=null&&(ot.multiaddrs.length>0&&await this.components.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id)&&(rt.add(ot.id),yield ot))}async provide(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");await Promise.all(this.routers.map(async nt=>{await nt.provide(et,tt)}))}async put(et,tt,nt){if(!this.isStarted())throw new NotStartedError;await Promise.all(this.routers.map(async rt=>{await rt.put(et,tt,nt)}))}async get(et,tt){if(!this.isStarted())throw new NotStartedError;return Promise.any(this.routers.map(async nt=>nt.get(et,tt)))}}var Fl;Fl=Symbol.toStringTag;class DefaultPeerRouting{constructor(et,tt={}){Ct(this,"log");Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"routers");Ct(this,Fl,"@libp2p/peer-routing");this.log=et.logger.forComponent("libp2p:peer-routing"),this.peerId=et.peerId,this.peerStore=et.peerStore,this.routers=tt.routers??[]}async findPeer(et,tt){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");if(et.toString()===this.peerId.toString())throw new QueriedForSelfError("Should not try to find self");const nt=this,rt=merge$2(...this.routers.map(ot=>async function*(){try{yield await ot.findPeer(et,tt)}catch(it){nt.log.error(it)}}()));for await(const ot of rt)if(ot!=null)return ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),ot;throw new NotFoundError$1}async*getClosestPeers(et,tt={}){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");const nt=this,rt=createScalableCuckooFilter(1024);for await(const ot of parallel(async function*(){const it=merge$2(...nt.routers.map(st=>st.getClosestPeers(et,tt)));for await(let st of it)yield async()=>{if(st.multiaddrs.length===0)try{st=await nt.findPeer(st.id,{...tt,useCache:!1})}catch(at){nt.log.error("could not find peer multiaddrs",at);return}return st}}()))ot!=null&&(ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id.toMultihash().bytes)&&(rt.add(ot.id.toMultihash().bytes),yield ot))}}var Ul,zl;class RandomWalk extends(zl=TypedEventEmitter,Ul=Symbol.toStringTag,zl){constructor(tt){super();Ct(this,"peerRouting");Ct(this,"log");Ct(this,"walking");Ct(this,"walkers");Ct(this,"shutdownController");Ct(this,"walkController");Ct(this,"needNext");Ct(this,Ul,"@libp2p/random-walk");this.log=tt.logger.forComponent("libp2p:random-walk"),this.peerRouting=tt.peerRouting,this.walkers=0,this.walking=!1,this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}start(){this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}stop(){this.shutdownController.abort()}async*walk(tt){var rt,ot;this.walking||this.startWalk(),this.walkers++;const nt=anySignal([this.shutdownController.signal,tt==null?void 0:tt.signal]);setMaxListeners(1/0,nt);try{for(;;)(rt=this.needNext)==null||rt.resolve(),this.needNext=pDefer(),yield(await raceEvent(this,"walk:peer",nt,{errorEvent:"walk:error"})).detail}finally{nt.clear(),this.walkers--,this.walkers===0&&((ot=this.walkController)==null||ot.abort(),this.walkController=void 0)}}startWalk(){this.walking=!0,this.walkController=new AbortController,setMaxListeners(1/0,this.walkController.signal);const tt=anySignal([this.walkController.signal,this.shutdownController.signal]);setMaxListeners(1/0,tt);const nt=Date.now();let rt=0;Promise.resolve().then(async()=>{for(this.log("start walk");this.walkers>0;)try{const ot=randomBytes(32);let it=Date.now();for await(const st of this.peerRouting.getClosestPeers(ot,{signal:tt}))tt.aborted&&this.log("aborting walk"),tt.throwIfAborted(),this.log("found peer %p after %dms for %d walkers",st.id,Date.now()-it,this.walkers),rt++,this.safeDispatchEvent("walk:peer",{detail:st}),this.walkers===1&&this.needNext!=null&&(this.log("wait for need next"),await raceSignal(this.needNext.promise,tt)),it=Date.now();this.log("walk iteration for %b and %d walkers finished, found %d peers",ot,this.walkers,rt)}catch(ot){this.log.error("randomwalk errored",ot),this.safeDispatchEvent("walk:error",{detail:ot})}this.log("no walkers left, ended walk")}).catch(ot=>{this.log.error("randomwalk errored",ot)}).finally(()=>{this.log("finished walk, found %d peers after %dms",rt,Date.now()-nt),this.walking=!1})}}const DEFAULT_MAX_INBOUND_STREAMS=32,DEFAULT_MAX_OUTBOUND_STREAMS=64;var Vl;Vl=Symbol.toStringTag;class DefaultRegistrar{constructor(et){Ct(this,"log");Ct(this,"topologies");Ct(this,"handlers");Ct(this,"components");Ct(this,Vl,"@libp2p/registrar");this.log=et.logger.forComponent("libp2p:registrar"),this.topologies=new Map,this.handlers=new Map,this.components=et,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onPeerIdentify=this._onPeerIdentify.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate),this.components.events.addEventListener("peer:identify",this._onPeerIdentify)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(et){const tt=this.handlers.get(et);if(tt==null)throw new UnhandledProtocolError(`No handler registered for protocol ${et}`);return tt}getTopologies(et){const tt=this.topologies.get(et);return tt==null?[]:[...tt.values()]}async handle(et,tt,nt){if(this.handlers.has(et))throw new DuplicateProtocolHandlerError(`Handler already registered for protocol ${et}`);const rt=mergeOptions$1.bind({ignoreUndefined:!0})({maxInboundStreams:DEFAULT_MAX_INBOUND_STREAMS,maxOutboundStreams:DEFAULT_MAX_OUTBOUND_STREAMS},nt);this.handlers.set(et,{handler:tt,options:rt}),await this.components.peerStore.merge(this.components.peerId,{protocols:[et]})}async unhandle(et){(Array.isArray(et)?et:[et]).forEach(nt=>{this.handlers.delete(nt)}),await this.components.peerStore.patch(this.components.peerId,{protocols:this.getProtocols()})}async register(et,tt){if(tt==null)throw new InvalidParametersError$1("invalid topology");const nt=`${(Math.random()*1e9).toString(36)}${Date.now()}`;let rt=this.topologies.get(et);return rt==null&&(rt=new Map,this.topologies.set(et,rt)),rt.set(nt,tt),nt}unregister(et){for(const[tt,nt]of this.topologies.entries())nt.has(et)&&(nt.delete(et),nt.size===0&&this.topologies.delete(tt))}_onDisconnect(et){const tt=et.detail;this.components.peerStore.get(tt).then(nt=>{var rt,ot,it;for(const st of nt.protocols){const at=this.topologies.get(st);if(at!=null)for(const ct of at.values())((rt=ct.filter)==null?void 0:rt.has(tt))!==!1&&((ot=ct.filter)==null||ot.remove(tt),(it=ct.onDisconnect)==null||it.call(ct,tt))}}).catch(nt=>{nt.name!=="NotFoundError"&&this.log.error("could not inform topologies of disconnecting peer %p",tt,nt)})}_onPeerUpdate(et){var ot,it,st;const{peer:tt,previous:nt}=et.detail,rt=((nt==null?void 0:nt.protocols)??[]).filter(at=>!tt.protocols.includes(at));for(const at of rt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())((ot=lt.filter)==null?void 0:ot.has(tt.id))!==!1&&((it=lt.filter)==null||it.remove(tt.id),(st=lt.onDisconnect)==null||st.call(lt,tt.id))}}_onPeerIdentify(et){var ot,it,st;const tt=et.detail.protocols,nt=et.detail.connection,rt=et.detail.peerId;for(const at of tt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())nt.limits!=null&<.notifyOnLimitedConnection!==!0||((ot=lt.filter)==null?void 0:ot.has(rt))!==!0&&((it=lt.filter)==null||it.add(rt),(st=lt.onConnect)==null||st.call(lt,rt,nt))}}}class TrackedMap extends Map{constructor(tt){super();Ct(this,"metric");const{name:nt,metrics:rt}=tt;this.metric=rt.registerMetric(nt),this.updateComponentMetric()}set(tt,nt){return super.set(tt,nt),this.updateComponentMetric(),this}delete(tt){const nt=super.delete(tt);return this.updateComponentMetric(),nt}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}function trackedMap(o){const{name:et,metrics:tt}=o;let nt;return tt!=null?nt=new TrackedMap({name:et,metrics:tt}):nt=new Map,nt}var Hl;Hl=Symbol.toStringTag;class DefaultTransportManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"transports");Ct(this,"listeners");Ct(this,"faultTolerance");Ct(this,"started");Ct(this,Hl,"@libp2p/transport-manager");this.log=et.logger.forComponent("libp2p:transports"),this.components=et,this.started=!1,this.transports=new Map,this.listeners=trackedMap({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=tt.faultTolerance??FaultTolerance.FATAL_ALL}add(et){const tt=et[Symbol.toStringTag];if(tt==null)throw new InvalidParametersError$1("Transport must have a valid tag");if(this.transports.has(tt))throw new InvalidParametersError$1(`There is already a transport with the tag ${tt}`);this.log("adding transport %s",tt),this.transports.set(tt,et),this.listeners.has(tt)||this.listeners.set(tt,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){const et=this.components.addressManager.getListenAddrs();await this.listen(et)}async stop(){const et=[];for(const[tt,nt]of this.listeners)for(this.log("closing listeners for %s",tt);nt.length>0;){const rt=nt.pop();rt!=null&&et.push(rt.close())}await Promise.all(et),this.log("all listeners closed");for(const tt of this.listeners.keys())this.listeners.set(tt,[]);this.started=!1}async dial(et,tt){var rt;const nt=this.dialTransportForMultiaddr(et);if(nt==null)throw new TransportUnavailableError(`No transport available for address ${String(et)}`);return(rt=tt==null?void 0:tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("transport-manager:selected-transport",nt[Symbol.toStringTag])),nt.dial(et,{...tt,upgrader:this.components.upgrader})}getAddrs(){let et=[];for(const tt of this.listeners.values())for(const nt of tt)et=[...et,...nt.getAddrs()];return et}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}dialTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.dialFilter([et]).length>0)return tt}listenTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.listenFilter([et]).length>0)return tt}async listen(et){if(!this.isStarted())throw new NotStartedError("Not started");if(et==null||et.length===0){this.log("no addresses were provided for listening, this node is dial only");return}const tt=[];for(const[nt,rt]of this.transports.entries()){const ot=rt.listenFilter(et),it=[];for(const ct of ot){this.log("creating listener for %s on %a",nt,ct);const lt=rt.createListener({upgrader:this.components.upgrader});let dt=this.listeners.get(nt)??[];dt==null&&(dt=[],this.listeners.set(nt,dt)),dt.push(lt),lt.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:lt})}),lt.addEventListener("close",()=>{const ht=dt.findIndex(pt=>pt===lt);dt.splice(ht,1),this.components.events.safeDispatchEvent("transport:close",{detail:lt})}),it.push(lt.listen(ct))}if(it.length===0){tt.push(nt);continue}if((await Promise.allSettled(it)).find(ct=>ct.status==="fulfilled")==null&&this.faultTolerance!==FaultTolerance.NO_FATAL)throw new NoValidAddressesError(`Transport (${nt}) could not listen on any available address`)}if(tt.length===this.transports.size){const nt=`no valid addresses were provided for transports [${tt.join(", ")}]`;if(this.faultTolerance===FaultTolerance.FATAL_ALL)throw new NoValidAddressesError(nt);this.log(`libp2p in dial mode only: ${nt}`)}}async remove(et){const tt=this.listeners.get(et)??[];this.log.trace("removing transport %s",et);const nt=[];for(this.log.trace("closing listeners for %s",et);tt.length>0;){const rt=tt.pop();rt!=null&&nt.push(rt.close())}await Promise.all(nt),this.transports.delete(et),this.listeners.delete(et)}async removeAll(){const et=[];for(const tt of this.transports.keys())et.push(this.remove(tt));await Promise.all(et)}}const PROTOCOL_ID="/multistream/1.0.0",MAX_PROTOCOL_LENGTH=1024;class UnsupportedProtocolError extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}}Ct(UnsupportedProtocolError,"name","UnsupportedProtocolError");class InvalidMessageError extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}}Ct(InvalidMessageError,"name","InvalidMessageError");const NewLine=fromString(` +`)}`:`${tt} :`}}_a$v=Constructed;typeStore.Constructed=_a$v;Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(et,tt,nt){return tt}toBER(et){return EMPTY_BUFFER$1}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";var _a$u;class EndOfContent extends BaseBlock{constructor(et={}){super(et,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent;typeStore.EndOfContent=_a$u;EndOfContent.NAME=END_OF_CONTENT_NAME;var _a$t;class Null extends BaseBlock{constructor(et={}){super(et,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(et,tt,nt){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=nt,tt+nt>et.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):tt+nt}toBER(et,tt){const nt=new ArrayBuffer(2);if(!et){const rt=new Uint8Array(nt);rt[0]=5,rt[1]=0}return tt&&tt.write(nt),nt}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null;typeStore.Null=_a$t;Null.NAME="NULL";class LocalBooleanValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),tt.valueHex?this.valueHexView=BufferSourceConverter.toUint8Array(tt.valueHex):this.valueHexView=new Uint8Array(1),et&&(this.value=et)}get value(){for(const et of this.valueHexView)if(et>0)return!0;return!1}set value(et){this.valueHexView[0]=et?255:0}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);return checkBufferParams(this,rt,tt,nt)?(this.valueHexView=rt.subarray(tt,tt+nt),nt>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=nt,tt+nt):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";var _a$s;let Boolean$1=class extends BaseBlock{constructor(et={}){super(et,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(et){this.valueBlock.value=et}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1;typeStore.Boolean=_a$s;Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock){constructor({isConstructed:et=!1,...tt}={}){super(tt),this.isConstructed=et}fromBER(et,tt,nt){let rt=0;if(this.isConstructed){if(this.isHexOnly=!1,rt=LocalConstructedValueBlock.prototype.fromBER.call(this,et,tt,nt),rt===-1)return rt;for(let ot=0;ot0&&ct.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=ct.unusedBits}return rt}const ot=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,ot,tt,nt))return-1;const it=ot.subarray(tt,tt+nt);if(this.unusedBits=it[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const st=it.subarray(1);try{if(st.byteLength){const at=localFromBER(st,0,st.byteLength);at.offset!==-1&&at.offset===nt-1&&(this.value=[at.result])}}catch{}}return this.valueHexView=it.subarray(1),this.blockLength=it.length,tt+nt}toBER(et,tt){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,et,tt);if(et)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER$1;const nt=new Uint8Array(this.valueHexView.length+1);return nt[0]=this.unusedBits,nt.set(this.valueHexView,1),nt.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";var _a$q;class BitString extends BaseBlock{constructor({idBlock:et={},lenBlock:tt={},...nt}={}){var rt,ot;(rt=nt.isConstructed)!==null&&rt!==void 0||(nt.isConstructed=!!(!((ot=nt.value)===null||ot===void 0)&&ot.length)),super({idBlock:{isConstructed:nt.isConstructed,...et},lenBlock:{...tt,isIndefiniteForm:!!nt.isIndefiniteForm},...nt},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(et,tt,nt){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(et,tt,nt)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const et=[],tt=this.valueBlock.valueHexView;for(const rt of tt)et.push(rt.toString(2).padStart(8,"0"));const nt=et.join("");return`${this.constructor.NAME} : ${nt.substring(0,nt.length-this.valueBlock.unusedBits)}`}}}_a$q=BitString;typeStore.BitString=_a$q;BitString.NAME=BIT_STRING_NAME;var _a$p;function viewAdd(o,et){const tt=new Uint8Array([0]),nt=new Uint8Array(o),rt=new Uint8Array(et);let ot=nt.slice(0);const it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct=0;const lt=at=0;ht--,dt++){switch(!0){case dt=ot.length:ot=utilConcatView(new Uint8Array([ct%10]),ot);break;default:ot[it-dt]=ct%10}}return tt[0]>0&&(ot=utilConcatView(tt,ot)),ot}function power2(o){if(o>=powers2.length)for(let et=powers2.length;et<=o;et++){const tt=new Uint8Array([0]);let nt=powers2[et-1].slice(0);for(let rt=nt.length-1;rt>=0;rt--){const ot=new Uint8Array([(nt[rt]<<1)+tt[0]]);tt[0]=ot[0]/10,nt[rt]=ot[0]%10}tt[0]>0&&(nt=utilConcatView(tt,nt)),powers2.push(nt)}return powers2[o]}function viewSub(o,et){let tt=0;const nt=new Uint8Array(o),rt=new Uint8Array(et),ot=nt.slice(0),it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct,lt=0;for(let dt=at;dt>=0;dt--,lt++)switch(ct=ot[it-lt]-st[at-lt]-tt,!0){case ct<0:tt=1,ot[it-lt]=ct+10;break;default:tt=0,ot[it-lt]=ct}if(tt>0)for(let dt=it-at+1;dt>=0;dt--,lt++)if(ct=ot[it-lt]-tt,ct<0)tt=1,ot[it-lt]=ct+10;else{tt=0,ot[it-lt]=ct;break}return ot.slice()}class LocalIntegerValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),this._valueDec=0,tt.valueHex&&this.setValueHex(),et!==void 0&&(this.valueDec=et)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}set valueDec(et){this._valueDec=et,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(et))}get valueDec(){return this._valueDec}fromDER(et,tt,nt,rt=0){const ot=this.fromBER(et,tt,nt);if(ot===-1)return ot;const it=this.valueHexView;return it[0]===0&&it[1]&128?this.valueHexView=it.subarray(1):rt!==0&&it.length1&&(rt=it.length+1),this.valueHexView=it.subarray(rt-it.length)),ot}toDER(et=!1){const tt=this.valueHexView;switch(!0){case(tt[0]&128)!==0:{const nt=new Uint8Array(this.valueHexView.length+1);nt[0]=0,nt.set(tt,1),this.valueHexView=nt}break;case(tt[0]===0&&(tt[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(et)}fromBER(et,tt,nt){const rt=super.fromBER(et,tt,nt);return rt===-1||this.setValueHex(),rt}toBER(et){return et?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const et=this.valueHexView.length*8-1;let tt=new Uint8Array(this.valueHexView.length*8/3),nt=0,rt;const ot=this.valueHexView;let it="",st=!1;for(let at=ot.byteLength-1;at>=0;at--){rt=ot[at];for(let ct=0;ct<8;ct++){if((rt&1)===1)switch(nt){case et:tt=viewSub(power2(nt),tt),it="-";break;default:tt=viewAdd(tt,power2(nt))}nt++,rt>>=1}}for(let at=0;at0;){const ot=new LocalSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.value.length===0&&(ot.isFirstSid=!0),this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et){const tt=[];for(let nt=0;ntNumber.MAX_SAFE_INTEGER){assertBigInt();const st=BigInt(rt);it.valueBigInt=st}else if(it.valueDec=parseInt(rt,10),isNaN(it.valueDec))return;this.value.length||(it.isFirstSid=!0,ot=!0),this.value.push(it)}while(nt!==-1)}toString(){let et="",tt=!1;for(let nt=0;nt0;){const ot=new LocalRelativeSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et,tt){const nt=[];for(let rt=0;rt4)continue;const st=4-it.length;for(let at=it.length-1;at>=0;at--)nt[rt*4+at+st]=it[at]}this.valueBlock.value=et}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";var _a$g;class UniversalString extends LocalUniversalStringValueBlock{constructor({...et}={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString;typeStore.UniversalString=_a$g;UniversalString.NAME="UniversalString";var _a$f;class NumericString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString;typeStore.NumericString=_a$f;NumericString.NAME="NumericString";var _a$e;class PrintableString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString;typeStore.PrintableString=_a$e;PrintableString.NAME="PrintableString";var _a$d;class TeletexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString;typeStore.TeletexString=_a$d;TeletexString.NAME="TeletexString";var _a$c;class VideotexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString;typeStore.VideotexString=_a$c;VideotexString.NAME="VideotexString";var _a$b;class IA5String extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String;typeStore.IA5String=_a$b;IA5String.NAME="IA5String";var _a$a;class GraphicString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString;typeStore.GraphicString=_a$a;GraphicString.NAME="GraphicString";var _a$9;class VisibleString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString;typeStore.VisibleString=_a$9;VisibleString.NAME="VisibleString";var _a$8;class GeneralString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString;typeStore.GeneralString=_a$8;GeneralString.NAME="GeneralString";var _a$7;class CharacterString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString;typeStore.CharacterString=_a$7;CharacterString.NAME="CharacterString";var _a$6;class UTCTime extends VisibleString{constructor({value:et,valueDate:tt,...nt}={}){if(super(nt),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,et){this.fromString(et),this.valueBlock.valueHexView=new Uint8Array(et.length);for(let rt=0;rt=50?this.year=1900+rt:this.year=2e3+rt,this.month=parseInt(nt[2],10),this.day=parseInt(nt[3],10),this.hour=parseInt(nt[4],10),this.minute=parseInt(nt[5],10),this.second=parseInt(nt[6],10)}toString(et="iso"){if(et==="iso"){const tt=new Array(7);return tt[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),tt[1]=padNumber(this.month,2),tt[2]=padNumber(this.day,2),tt[3]=padNumber(this.hour,2),tt[4]=padNumber(this.minute,2),tt[5]=padNumber(this.second,2),tt[6]="Z",tt.join("")}return super.toString(et)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime;typeStore.UTCTime=_a$6;UTCTime.NAME="UTCTime";var _a$5;class GeneralizedTime extends UTCTime{constructor(et={}){var tt;super(et),(tt=this.millisecond)!==null&&tt!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(et){super.fromDate(et),this.millisecond=et.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(et){let tt=!1,nt="",rt="",ot=0,it,st=0,at=0;if(et[et.length-1]==="Z")nt=et.substring(0,et.length-1),tt=!0;else{const dt=new Number(et[et.length-1]);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");nt=et}if(tt){if(nt.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(nt.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let dt=1,ht=nt.indexOf("+"),ft="";if(ht===-1&&(ht=nt.indexOf("-"),dt=-1),ht!==-1){if(ft=nt.substring(ht+1),nt=nt.substring(0,ht),ft.length!==2&&ft.length!==4)throw new Error("Wrong input string for conversion");let mt=parseInt(ft.substring(0,2),10);if(isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");if(st=dt*mt,ft.length===4){if(mt=parseInt(ft.substring(2,4),10),isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");at=dt*mt}}}let ct=nt.indexOf(".");if(ct===-1&&(ct=nt.indexOf(",")),ct!==-1){const dt=new Number(`0${nt.substring(ct)}`);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");ot=dt.valueOf(),rt=nt.substring(0,ct)}else rt=nt;switch(!0){case rt.length===8:if(it=/(\d{4})(\d{2})(\d{2})/ig,ct!==-1)throw new Error("Wrong input string for conversion");break;case rt.length===10:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.minute=Math.floor(dt),dt=60*(dt-this.minute),this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===12:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===14:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){const dt=1e3*ot;this.millisecond=Math.floor(dt)}break;default:throw new Error("Wrong input string for conversion")}const lt=it.exec(rt);if(lt===null)throw new Error("Wrong input string for conversion");for(let dt=1;dt0&&(nt=`0${nt}`),et.push(nt)}),BigInt("0x"+et.join(""))}function pkixToRSAPublicKey(o){const et=pkixToJwk(o);if(rsaKeySize(et)>MAX_RSA_KEY_SIZE)throw new InvalidPublicKeyError("Key size is too large");const tt=sha256$2(PublicKey.encode({Type:KeyType.RSA,Data:o})),nt=create$3(SHA2_256_CODE,tt);return new RSAPublicKey(et,nt)}function isPromise$3(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function hashAndVerify(o,et,tt){const nt=sha256.digest(tt instanceof Uint8Array?tt:tt.subarray());if(isPromise$3(nt))return nt.then(({digest:rt})=>secp256k1.verify(et,rt,o)).catch(rt=>{throw new VerificationError(String(rt))});try{return secp256k1.verify(et,nt.digest,o)}catch(rt){throw new VerificationError(String(rt))}}class Secp256k1PublicKey{constructor(et){Ct(this,"type","secp256k1");Ct(this,"raw");Ct(this,"_key");this._key=validateSecp256k1PublicKey(et),this.raw=compressSecp256k1PublicKey(this._key)}toMultihash(){return identity.digest(publicKeyToProtobuf(this))}toCID(){return CID.createV1(114,this.toMultihash())}toString(){return base58btc.encode(this.toMultihash().bytes).substring(1)}equals(et){return et==null||!(et.raw instanceof Uint8Array)?!1:equals(this.raw,et.raw)}verify(et,tt){return hashAndVerify(this._key,tt,et)}}function unmarshalSecp256k1PublicKey(o){return new Secp256k1PublicKey(o)}function compressSecp256k1PublicKey(o){return secp256k1.ProjectivePoint.fromHex(o).toRawBytes(!0)}function validateSecp256k1PublicKey(o){try{return secp256k1.ProjectivePoint.fromHex(o),o}catch(et){throw new InvalidPublicKeyError(String(et))}}async function generateKeyPair(o,et){return generateEd25519KeyPair()}function publicKeyFromProtobuf(o){const{Type:et,Data:tt}=PublicKey.decode(o),nt=tt??new Uint8Array;switch(et){case KeyType.RSA:return pkixToRSAPublicKey(nt);case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyFromRaw(o){return o.byteLength===32?unmarshalEd25519PublicKey(o):o.byteLength===33?unmarshalSecp256k1PublicKey(o):pkixToRSAPublicKey(o)}function publicKeyFromMultihash(o){const{Type:et,Data:tt}=PublicKey.decode(o.digest),nt=tt??new Uint8Array;switch(et){case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyToProtobuf(o){return PublicKey.encode({Type:KeyType[o.type],Data:o.raw})}const peerIdSymbol$2=Symbol.for("@libp2p/peer-id");var hs;let InvalidParametersError$2=(hs=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(hs,"name","InvalidParametersError"),hs);class InvalidCIDError extends Error{constructor(et="Invalid CID"){super(et),this.name="InvalidCIDError"}}Ct(InvalidCIDError,"name","InvalidCIDError");class InvalidMultihashError extends Error{constructor(et="Invalid Multihash"){super(et),this.name="InvalidMultihashError"}}Ct(InvalidMultihashError,"name","InvalidMultihashError");class UnsupportedKeyTypeError extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}}Ct(UnsupportedKeyTypeError,"name","UnsupportedKeyTypeError");const inspect=Symbol.for("nodejs.util.inspect.custom"),LIBP2P_KEY_CODE$1=114;var xa;class PeerIdImpl{constructor(et){Ct(this,"type");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"string");Ct(this,xa,!0);this.type=et.type,this.multihash=et.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}toString(){return this.string==null&&(this.string=base58btc.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return CID.createV1(LIBP2P_KEY_CODE$1,this.multihash)}toJSON(){return this.toString()}equals(et){var tt;if(et==null)return!1;if(et instanceof Uint8Array)return equals(this.multihash.bytes,et);if(typeof et=="string")return this.toString()===et;if(((tt=et==null?void 0:et.toMultihash())==null?void 0:tt.bytes)!=null)return equals(this.multihash.bytes,et.toMultihash().bytes);throw new Error("not valid Id")}[(xa=peerIdSymbol$2,inspect)](){return`PeerId(${this.toString()})`}}class RSAPeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"RSA"});Ct(this,"type","RSA");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Ed25519PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"Ed25519"});Ct(this,"type","Ed25519");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Secp256k1PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"secp256k1"});Ct(this,"type","secp256k1");Ct(this,"publicKey");this.publicKey=tt.publicKey}}const TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1=2336;var ba,$a;class URLPeerId{constructor(et){Ct(this,"type","url");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"url");Ct(this,ba,!0);this.url=et.toString(),this.multihash=identity.digest(fromString(this.url))}[($a=inspect,ba=peerIdSymbol$2,$a)](){return`PeerId(${this.url})`}toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return CID.createV1(TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1,this.toMultihash())}toJSON(){return this.toString()}equals(et){return et==null?!1:(et instanceof Uint8Array&&(et=toString$8(et)),et.toString()===this.toString())}}const LIBP2P_KEY_CODE=114,TRANSPORT_IPFS_GATEWAY_HTTP_CODE=2336;function peerIdFromString$1(o,et){let tt;if(o.charAt(0)==="1"||o.charAt(0)==="Q")tt=decode$6(base58btc.decode(`z${o}`));else throw new InvalidParametersError$2('Please pass a multibase decoder for strings that do not start with "1" or "Q"');return peerIdFromMultihash(tt)}function peerIdFromPublicKey(o){if(o.type==="Ed25519")return new Ed25519PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="secp256k1")return new Secp256k1PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="RSA")return new RSAPeerId({multihash:o.toCID().multihash,publicKey:o});throw new UnsupportedKeyTypeError}function peerIdFromPrivateKey(o){return peerIdFromPublicKey(o.publicKey)}function peerIdFromMultihash(o){if(isSha256Multihash(o))return new RSAPeerId({multihash:o});if(isIdentityMultihash(o))try{const et=publicKeyFromMultihash(o);if(et.type==="Ed25519")return new Ed25519PeerId({multihash:o,publicKey:et});if(et.type==="secp256k1")return new Secp256k1PeerId({multihash:o,publicKey:et})}catch{const tt=toString$8(o.digest);return new URLPeerId(new URL(tt))}throw new InvalidMultihashError("Supplied PeerID Multihash is invalid")}function peerIdFromCID(o){if((o==null?void 0:o.multihash)==null||o.version==null||o.version===1&&o.code!==LIBP2P_KEY_CODE&&o.code!==TRANSPORT_IPFS_GATEWAY_HTTP_CODE)throw new InvalidCIDError("Supplied PeerID CID is invalid");if(o.code===TRANSPORT_IPFS_GATEWAY_HTTP_CODE){const et=toString$8(o.multihash.digest);return new URLPeerId(new URL(et))}return peerIdFromMultihash(o.multihash)}function isIdentityMultihash(o){return o.code===identity.code}function isSha256Multihash(o){return o.code===sha256.code}let AbortError$8=class extends Error{constructor(tt,nt,rt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.name=rt??"AbortError",this.code=nt??"ABORT_ERR"}};async function raceSignal(o,et,tt){if(et==null)return o;if(et.aborted)return Promise.reject(new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName));let nt;const rt=new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName);try{return await Promise.race([o,new Promise((ot,it)=>{nt=()=>{it(rt)},et.addEventListener("abort",nt)})])}finally{nt!=null&&et.removeEventListener("abort",nt)}}class QueuelessPushable{constructor(){Ct(this,"readNext");Ct(this,"haveNext");Ct(this,"ended");Ct(this,"nextResult");this.ended=!1,this.readNext=pDefer(),this.haveNext=pDefer()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");const et=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=pDefer(),et}async throw(et){return this.ended=!0,et!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(et)),{done:!0,value:void 0}}async return(){const et={done:!0,value:void 0};return await this._push(void 0),et}async push(et,tt){await this._push(et,tt)}async end(et,tt){et!=null?await this.throw(et):await this._push(void 0,tt)}async _push(et,tt){if(et!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;et!=null?this.nextResult={done:!1,value:et}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=pDefer(),await raceSignal(this.readNext.promise,tt==null?void 0:tt.signal,tt)}}function queuelessPushable(){return new QueuelessPushable}class UnexpectedEOFError extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}}class CodeError extends Error{constructor(tt,nt){super(tt);Ct(this,"code");this.code=nt}}let AbortError$7=class extends CodeError{constructor(tt){super(tt,"ABORT_ERR");Ct(this,"type");this.type="aborted",this.name="AbortError"}};function byteStream(o,et){const tt=queuelessPushable();o.sink(tt).catch(async it=>{await tt.end(it)}),o.sink=async it=>{for await(const st of it)await tt.push(st);await tt.end()};let nt=o.source;o.source[Symbol.iterator]!=null?nt=o.source[Symbol.iterator]():o.source[Symbol.asyncIterator]!=null&&(nt=o.source[Symbol.asyncIterator]());const rt=new Uint8ArrayList;return{read:async(it,st)=>{var lt,dt;(lt=st==null?void 0:st.signal)==null||lt.throwIfAborted();let at;const ct=new Promise((ht,ft)=>{var mt;at=()=>{ft(new AbortError$7("Read aborted"))},(mt=st==null?void 0:st.signal)==null||mt.addEventListener("abort",at)});try{if(it==null){const{done:ft,value:mt}=await Promise.race([nt.next(),ct]);return ft===!0?new Uint8ArrayList:mt}for(;rt.byteLength{var at;(at=st==null?void 0:st.signal)==null||at.throwIfAborted(),it instanceof Uint8Array?await tt.push(it,st):await tt.push(it.subarray(),st)},unwrap:()=>{if(rt.byteLength>0){const it=o.source;o.source=async function*(){(et==null?void 0:et.yieldBytes)===!1?yield rt:yield*rt,yield*it}()}return o}}}class InvalidMessageLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}}class InvalidDataLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}}class InvalidDataLengthLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}}function lpStream(o,et={}){const tt=byteStream(o,et);et.maxDataLength!=null&&et.maxLengthLength==null&&(et.maxLengthLength=encodingLength$3(et.maxDataLength));const nt=(et==null?void 0:et.lengthDecoder)??decode$b,rt=(et==null?void 0:et.lengthEncoder)??encode$a;return{read:async it=>{let st=-1;const at=new Uint8ArrayList;for(;;){at.append(await tt.read(1,it));try{st=nt(at)}catch(ct){if(ct instanceof RangeError)continue;throw ct}if(st<0)throw new InvalidMessageLengthError("Invalid message length");if((et==null?void 0:et.maxLengthLength)!=null&&at.byteLength>et.maxLengthLength)throw new InvalidDataLengthLengthError("message length length too long");if(st>-1)break}if((et==null?void 0:et.maxDataLength)!=null&&st>et.maxDataLength)throw new InvalidDataLengthError("message length too long");return tt.read(st,it)},write:async(it,st)=>{await tt.write(new Uint8ArrayList(rt(it.byteLength),it),st)},writeV:async(it,st)=>{const at=new Uint8ArrayList(...it.flatMap(ct=>[rt(ct.byteLength),ct]));await tt.write(at,st)},unwrap:()=>tt.unwrap()}}function pair(){const o=pDefer();let et=!1;return{sink:async tt=>{if(et)throw new Error("already piped");et=!0,o.resolve(tt)},source:async function*(){yield*await o.promise}()}}function duplexPair(){const o=pair(),et=pair();return[{source:o.source,sink:et.sink},{source:et.source,sink:o.sink}]}var define_globalThis_process_env_default$2={};const NOISE_MSG_MAX_LENGTH_BYTES=65535,NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=NOISE_MSG_MAX_LENGTH_BYTES-16,DUMP_SESSION_KEYS=!!(define_globalThis_process_env_default$2!=null&&define_globalThis_process_env_default$2.DUMP_SESSION_KEYS);function number$2(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function bool(o){if(typeof o!="boolean")throw new Error(`boolean expected, not ${o}`)}function isBytes$1(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes(o,...et){if(!isBytes$1(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function exists(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output(o,et){bytes(o);const tt=et.outputLen;if(o.lengthnew Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(o){if(typeof o!="string")throw new Error(`string expected, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}function toBytes(o){if(typeof o=="string")o=utf8ToBytes(o);else if(isBytes$1(o))o=copyBytes(o);else throw new Error(`Uint8Array expected, got ${typeof o}`);return o}function checkOpts(o,et){if(et==null||typeof et!="object")throw new Error("options must be defined");return Object.assign(o,et)}function equalBytes(o,et){if(o.length!==et.length)return!1;let tt=0;for(let nt=0;nt(Object.assign(et,o),et);function setBigUint64(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=4,ct=0;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}function copyBytes(o){return Uint8Array.from(o)}function clean(...o){for(let et=0;etUint8Array.from(o.split("").map(et=>et.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(o,et){return o<>>32-et}function isAligned32(o){return o.byteOffset%4===0}const BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(o,et,tt,nt,rt,ot,it,st){const at=rt.length,ct=new Uint8Array(BLOCK_LEN),lt=u32(ct),dt=isAligned32(rt)&&isAligned32(ot),ht=dt?u32(rt):U32_EMPTY,ft=dt?u32(ot):U32_EMPTY;for(let mt=0;mt=MAX_COUNTER)throw new Error("arx: counter overflow");const pt=Math.min(BLOCK_LEN,at-mt);if(dt&&pt===BLOCK_LEN){const yt=mt/4;if(mt%4!==0)throw new Error("arx: invalid block position");for(let gt=0,xt;gt{bytes(st),bytes(at),bytes(ct);const ht=ct.length;if(lt===void 0&&(lt=new Uint8Array(ht)),bytes(lt),number$2(dt),dt<0||dt>=MAX_COUNTER)throw new Error("arx: counter overflow");if(lt.lengtho[et++]&255|(o[et++]&255)<<8;class Poly1305{constructor(et){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,et=toBytes(et),bytes(et,32);const tt=u8to16(et,0),nt=u8to16(et,2),rt=u8to16(et,4),ot=u8to16(et,6),it=u8to16(et,8),st=u8to16(et,10),at=u8to16(et,12),ct=u8to16(et,14);this.r[0]=tt&8191,this.r[1]=(tt>>>13|nt<<3)&8191,this.r[2]=(nt>>>10|rt<<6)&7939,this.r[3]=(rt>>>7|ot<<9)&8191,this.r[4]=(ot>>>4|it<<12)&255,this.r[5]=it>>>1&8190,this.r[6]=(it>>>14|st<<2)&8191,this.r[7]=(st>>>11|at<<5)&8065,this.r[8]=(at>>>8|ct<<8)&8191,this.r[9]=ct>>>5&127;for(let lt=0;lt<8;lt++)this.pad[lt]=u8to16(et,16+2*lt)}process(et,tt,nt=!1){const rt=nt?0:2048,{h:ot,r:it}=this,st=it[0],at=it[1],ct=it[2],lt=it[3],dt=it[4],ht=it[5],ft=it[6],mt=it[7],pt=it[8],yt=it[9],gt=u8to16(et,tt+0),xt=u8to16(et,tt+2),vt=u8to16(et,tt+4),bt=u8to16(et,tt+6),Et=u8to16(et,tt+8),wt=u8to16(et,tt+10),kt=u8to16(et,tt+12),It=u8to16(et,tt+14);let Rt=ot[0]+(gt&8191),$t=ot[1]+((gt>>>13|xt<<3)&8191),Nt=ot[2]+((xt>>>10|vt<<6)&8191),Mt=ot[3]+((vt>>>7|bt<<9)&8191),Bt=ot[4]+((bt>>>4|Et<<12)&8191),zt=ot[5]+(Et>>>1&8191),Ft=ot[6]+((Et>>>14|wt<<2)&8191),Yt=ot[7]+((wt>>>11|kt<<5)&8191),Ht=ot[8]+((kt>>>8|It<<8)&8191),Ut=ot[9]+(It>>>5|rt),qt=0,Pt=qt+Rt*st+$t*(5*yt)+Nt*(5*pt)+Mt*(5*mt)+Bt*(5*ft);qt=Pt>>>13,Pt&=8191,Pt+=zt*(5*ht)+Ft*(5*dt)+Yt*(5*lt)+Ht*(5*ct)+Ut*(5*at),qt+=Pt>>>13,Pt&=8191;let Zt=qt+Rt*at+$t*st+Nt*(5*yt)+Mt*(5*pt)+Bt*(5*mt);qt=Zt>>>13,Zt&=8191,Zt+=zt*(5*ft)+Ft*(5*ht)+Yt*(5*dt)+Ht*(5*lt)+Ut*(5*ct),qt+=Zt>>>13,Zt&=8191;let Qt=qt+Rt*ct+$t*at+Nt*st+Mt*(5*yt)+Bt*(5*pt);qt=Qt>>>13,Qt&=8191,Qt+=zt*(5*mt)+Ft*(5*ft)+Yt*(5*ht)+Ht*(5*dt)+Ut*(5*lt),qt+=Qt>>>13,Qt&=8191;let Lt=qt+Rt*lt+$t*ct+Nt*at+Mt*st+Bt*(5*yt);qt=Lt>>>13,Lt&=8191,Lt+=zt*(5*pt)+Ft*(5*mt)+Yt*(5*ft)+Ht*(5*ht)+Ut*(5*dt),qt+=Lt>>>13,Lt&=8191;let Gt=qt+Rt*dt+$t*lt+Nt*ct+Mt*at+Bt*st;qt=Gt>>>13,Gt&=8191,Gt+=zt*(5*yt)+Ft*(5*pt)+Yt*(5*mt)+Ht*(5*ft)+Ut*(5*ht),qt+=Gt>>>13,Gt&=8191;let nn=qt+Rt*ht+$t*dt+Nt*lt+Mt*ct+Bt*at;qt=nn>>>13,nn&=8191,nn+=zt*st+Ft*(5*yt)+Yt*(5*pt)+Ht*(5*mt)+Ut*(5*ft),qt+=nn>>>13,nn&=8191;let Wt=qt+Rt*ft+$t*ht+Nt*dt+Mt*lt+Bt*ct;qt=Wt>>>13,Wt&=8191,Wt+=zt*at+Ft*st+Yt*(5*yt)+Ht*(5*pt)+Ut*(5*mt),qt+=Wt>>>13,Wt&=8191;let hn=qt+Rt*mt+$t*ft+Nt*ht+Mt*dt+Bt*lt;qt=hn>>>13,hn&=8191,hn+=zt*ct+Ft*at+Yt*st+Ht*(5*yt)+Ut*(5*pt),qt+=hn>>>13,hn&=8191;let Xt=qt+Rt*pt+$t*mt+Nt*ft+Mt*ht+Bt*dt;qt=Xt>>>13,Xt&=8191,Xt+=zt*lt+Ft*ct+Yt*at+Ht*st+Ut*(5*yt),qt+=Xt>>>13,Xt&=8191;let Jt=qt+Rt*yt+$t*pt+Nt*mt+Mt*ft+Bt*ht;qt=Jt>>>13,Jt&=8191,Jt+=zt*dt+Ft*lt+Yt*ct+Ht*at+Ut*st,qt+=Jt>>>13,Jt&=8191,qt=(qt<<2)+qt|0,qt=qt+Pt|0,Pt=qt&8191,qt=qt>>>13,Zt+=qt,ot[0]=Pt,ot[1]=Zt,ot[2]=Qt,ot[3]=Lt,ot[4]=Gt,ot[5]=nn,ot[6]=Wt,ot[7]=hn,ot[8]=Xt,ot[9]=Jt}finalize(){const{h:et,pad:tt}=this,nt=new Uint16Array(10);let rt=et[1]>>>13;et[1]&=8191;for(let st=2;st<10;st++)et[st]+=rt,rt=et[st]>>>13,et[st]&=8191;et[0]+=rt*5,rt=et[0]>>>13,et[0]&=8191,et[1]+=rt,rt=et[1]>>>13,et[1]&=8191,et[2]+=rt,nt[0]=et[0]+5,rt=nt[0]>>>13,nt[0]&=8191;for(let st=1;st<10;st++)nt[st]=et[st]+rt,rt=nt[st]>>>13,nt[st]&=8191;nt[9]-=8192;let ot=(rt^1)-1;for(let st=0;st<10;st++)nt[st]&=ot;ot=~ot;for(let st=0;st<10;st++)et[st]=et[st]&ot|nt[st];et[0]=(et[0]|et[1]<<13)&65535,et[1]=(et[1]>>>3|et[2]<<10)&65535,et[2]=(et[2]>>>6|et[3]<<7)&65535,et[3]=(et[3]>>>9|et[4]<<4)&65535,et[4]=(et[4]>>>12|et[5]<<1|et[6]<<14)&65535,et[5]=(et[6]>>>2|et[7]<<11)&65535,et[6]=(et[7]>>>5|et[8]<<8)&65535,et[7]=(et[8]>>>8|et[9]<<5)&65535;let it=et[0]+tt[0];et[0]=it&65535;for(let st=1;st<8;st++)it=(et[st]+tt[st]|0)+(it>>>16)|0,et[st]=it&65535;clean(nt)}update(et){exists(this);const{buffer:tt,blockLen:nt}=this;et=toBytes(et);const rt=et.length;for(let ot=0;ot>>0,et[ot++]=nt[it]>>>8;return et}digest(){const{buffer:et,outputLen:tt}=this;this.digestInto(et);const nt=et.slice(0,tt);return this.destroy(),nt}}function wrapConstructorWithKey(o){const et=(nt,rt)=>o(rt).update(toBytes(nt)).digest(),tt=o(new Uint8Array(32));return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}const poly1305=wrapConstructorWithKey(o=>new Poly1305(o));function chachaCore(o,et,tt,nt,rt,ot=20){let it=o[0],st=o[1],at=o[2],ct=o[3],lt=et[0],dt=et[1],ht=et[2],ft=et[3],mt=et[4],pt=et[5],yt=et[6],gt=et[7],xt=rt,vt=tt[0],bt=tt[1],Et=tt[2],wt=it,kt=st,It=at,Rt=ct,$t=lt,Nt=dt,Mt=ht,Bt=ft,zt=mt,Ft=pt,Yt=yt,Ht=gt,Ut=xt,qt=vt,Pt=bt,Zt=Et;for(let Lt=0;Lt{o.update(et);const tt=et.length%16;tt&&o.update(ZEROS16.subarray(tt))},ZEROS32=new Uint8Array(32);function computeTag(o,et,tt,nt,rt){const ot=o(et,tt,ZEROS32),it=poly1305.create(ot);rt&&updatePadded(it,rt),updatePadded(it,nt);const st=new Uint8Array(16),at=createView(st);setBigUint64(at,0,BigInt(rt?rt.length:0),!0),setBigUint64(at,8,BigInt(nt.length),!0),it.update(st);const ct=it.digest();return clean(ot,st),ct}const _poly1305_aead=o=>(et,tt,nt)=>(bytes(et,32),bytes(tt),{encrypt(ot,it){const st=ot.length,at=st+16;it?bytes(it,at):it=new Uint8Array(at),o(et,tt,ot,it,1);const ct=computeTag(o,et,tt,it.subarray(0,-16),nt);return it.set(ct,st),clean(ct),it},decrypt(ot,it){const st=ot.length,at=st-16;if(st<16)throw new Error("encrypted data must be at least 16 bytes");it?bytes(it,at):it=new Uint8Array(at);const ct=ot.subarray(0,-16),lt=ot.subarray(-16),dt=computeTag(o,et,tt,ct,nt);if(!equalBytes(lt,dt))throw new Error("invalid tag");return o(et,tt,ct,it,1),clean(dt),it}}),chacha20poly1305=wrapCipher({blockSize:64,nonceLength:12,tagLength:16},_poly1305_aead(chacha20));function extract(o,et,tt){return hash$1(o),tt===void 0&&(tt=new Uint8Array(o.outputLen)),hmac(o,toBytes$2(tt),toBytes$2(et))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(o,et,tt,nt=32){if(hash$1(o),number$4(nt),nt>255*o.outputLen)throw new Error("Length should be <= 255*HashLen");const rt=Math.ceil(nt/o.outputLen);tt===void 0&&(tt=EMPTY_BUFFER);const ot=new Uint8Array(rt*o.outputLen),it=hmac.create(o,et),st=it._cloneInto(),at=new Uint8Array(it.outputLen);for(let ct=0;cto.generateX25519SharedKey(et.privateKey,tt).subarray(0,32),encrypt:o.chaCha20Poly1305Encrypt,decrypt:o.chaCha20Poly1305Decrypt,hash:o.hashSHA256,hkdf:o.getHKDF}}const uint16BEEncode=o=>{const et=allocUnsafe(2);return et[0]=o>>8,et[1]=o,et};uint16BEEncode.bytes=2;const uint16BEDecode=o=>{if(o.length<2)throw RangeError("Could not decode int16BE");if(o instanceof Uint8Array){let et=0;return et+=o[0]<<8,et+=o[1],et}return o.getUint16(0)};uint16BEDecode.bytes=2;function registerMetrics(o){return{xxHandshakeSuccesses:o.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:o.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:o.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:o.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:o.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}function logLocalStaticKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_STATIC_PUBLIC_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_STATIC_PRIVATE_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local static keys."))}function logLocalEphemeralKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_PUBLIC_EPHEMERAL_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_PRIVATE_EPHEMERAL_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local ephemeral keys."))}function logRemoteStaticKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_STATIC_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote static public key.")}function logRemoteEphemeralKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_EPHEMERAL_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote ephemeral keys.")}function logCipherState(o,et,tt){!tt.enabled||!DUMP_SESSION_KEYS||(tt(`CIPHER_STATE_1 ${o.n.getUint64()} ${o.k&&toString$8(o.k,"hex")}`),tt(`CIPHER_STATE_2 ${et.n.getUint64()} ${et.k&&toString$8(et.k,"hex")}`))}const rs=class rs extends Error{constructor(tt="Invalid crypto exchange"){super(tt);Ct(this,"code");this.code=rs.code}};Ct(rs,"code","ERR_INVALID_CRYPTO_EXCHANGE");let InvalidCryptoExchangeError=rs;const MIN_NONCE=0,MAX_NONCE=4294967295,ERR_MAX_NONCE="Cipherstate has reached maximum n, a new handshake must be performed";class Nonce{constructor(et=MIN_NONCE){Ct(this,"n");Ct(this,"bytes");Ct(this,"view");this.n=et,this.bytes=alloc$2(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,et,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>MAX_NONCE)throw new Error(ERR_MAX_NONCE)}}const ZEROLEN=alloc$2(0);class CipherState{constructor(et,tt=void 0,nt=0){Ct(this,"k");Ct(this,"n");Ct(this,"crypto");this.crypto=et,this.k=tt,this.n=new Nonce(nt)}hasKey(){return!!this.k}encryptWithAd(et,tt){if(!this.hasKey())return tt;this.n.assertValue();const nt=this.crypto.encrypt(tt,this.n.getBytes(),et,this.k);return this.n.increment(),nt}decryptWithAd(et,tt,nt){if(!this.hasKey())return tt;this.n.assertValue();const rt=this.crypto.decrypt(tt,this.n.getBytes(),et,this.k,nt);return this.n.increment(),rt}}class SymmetricState{constructor(et,tt){Ct(this,"cs");Ct(this,"ck");Ct(this,"h");Ct(this,"crypto");this.crypto=et;const nt=fromString(tt,"utf-8");this.h=hashProtocolName(et,nt),this.ck=this.h,this.cs=new CipherState(et)}mixKey(et){const[tt,nt]=this.crypto.hkdf(this.ck,et);this.ck=tt,this.cs=new CipherState(this.crypto,nt)}mixHash(et){this.h=this.crypto.hash(new Uint8ArrayList(this.h,et))}encryptAndHash(et){const tt=this.cs.encryptWithAd(this.h,et);return this.mixHash(tt),tt}decryptAndHash(et){const tt=this.cs.decryptWithAd(this.h,et);return this.mixHash(et),tt}split(){const[et,tt]=this.crypto.hkdf(this.ck,ZEROLEN);return[new CipherState(this.crypto,et),new CipherState(this.crypto,tt)]}}class AbstractHandshakeState{constructor(et){Ct(this,"ss");Ct(this,"s");Ct(this,"e");Ct(this,"rs");Ct(this,"re");Ct(this,"initiator");Ct(this,"crypto");const{crypto:tt,protocolName:nt,prologue:rt,initiator:ot,s:it,e:st,rs:at,re:ct}=et;this.crypto=tt,this.ss=new SymmetricState(tt,nt),this.ss.mixHash(rt),this.initiator=ot,this.s=it,this.e=st,this.rs=at,this.re=ct}writeE(){if(this.e)throw new Error("ephemeral keypair is already set");const et=this.crypto.generateKeypair();return this.ss.mixHash(et.publicKey),this.e=et,et.publicKey}writeS(){if(!this.s)throw new Error("static keypair is not set");return this.ss.encryptAndHash(this.s.publicKey)}writeEE(){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.re))}writeES(){if(this.initiator){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}else{if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}}writeSE(){if(this.initiator){if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}else{if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}}readE(et,tt=0){if(this.re)throw new Error("remote ephemeral public key is already set");if(et.byteLength(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.webtransportCerthashes!=null)for(const ot of tt.webtransportCerthashes)nt.uint32(10),nt.bytes(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={webtransportCerthashes:[]},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.webtransportCerthashes.push(tt.bytes());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseExtensions||(NoiseExtensions={}));var NoiseHandshakePayload;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.identityKey!=null&&tt.identityKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.identityKey)),tt.identitySig!=null&&tt.identitySig.byteLength>0&&(nt.uint32(18),nt.bytes(tt.identitySig)),tt.extensions!=null&&(nt.uint32(34),NoiseExtensions.codec().encode(tt.extensions,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={identityKey:alloc$2(0),identitySig:alloc$2(0)},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.identityKey=tt.bytes();break}case 2:{rt.identitySig=tt.bytes();break}case 4:{rt.extensions=NoiseExtensions.codec().decode(tt,tt.uint32());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseHandshakePayload||(NoiseHandshakePayload={}));async function createHandshakePayload(o,et,tt){const nt=await o.sign(getSignaturePayload(et));return NoiseHandshakePayload.encode({identityKey:publicKeyToProtobuf(o.publicKey),identitySig:nt,extensions:tt})}async function decodeHandshakePayload(o,et,tt){try{const nt=NoiseHandshakePayload.decode(o),rt=publicKeyFromProtobuf(nt.identityKey);if((tt==null?void 0:tt.equals(rt))===!1)throw new Error(`Payload identity key ${rt} does not match expected remote identity key ${tt}`);if(!et)throw new Error("Remote static does not exist");const ot=getSignaturePayload(et);if(!await rt.verify(ot,nt.identitySig))throw new Error("Invalid payload signature");return nt}catch(nt){throw new UnexpectedPeerError(nt.message)}}function getSignaturePayload(o){const et=fromString("noise-libp2p-static-key:");return o instanceof Uint8Array?concat$1([et,o],et.length+o.length):(o.prepend(et),o)}async function performHandshakeInitiator(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!0,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Initiator starting to send first message."),await nt.write(dt.writeMessageA(ZEROLEN),et),tt.trace("Stage 0 - Initiator finished sending first message."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 1 - Initiator waiting to receive first message from responder...");const ht=dt.readMessageB(await nt.read(et));tt.trace("Stage 1 - Initiator received the message."),logRemoteEphemeralKey(dt.re,tt),logRemoteStaticKey(dt.rs,tt),tt.trace("Initiator going to check remote's signature...");const ft=await decodeHandshakePayload(ht,dt.rs,at);tt.trace("All good with the signature!"),tt.trace("Stage 2 - Initiator sending third handshake message."),await nt.write(dt.writeMessageC(lt),et),tt.trace("Stage 2 - Initiator sent message with signed payload.");const[mt,pt]=dt.ss.split();return logCipherState(mt,pt,tt),{payload:ft,encrypt:yt=>mt.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>pt.decryptWithAd(ZEROLEN,yt,gt)}}async function performHandshakeResponder(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!1,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Responder waiting to receive first message."),dt.readMessageA(await nt.read(et)),tt.trace("Stage 0 - Responder received first message."),logRemoteEphemeralKey(dt.re,tt),tt.trace("Stage 1 - Responder sending out first message with signed payload and static key."),await nt.write(dt.writeMessageB(lt),et),tt.trace("Stage 1 - Responder sent the second handshake message with signed payload."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 2 - Responder waiting for third handshake message...");const ht=dt.readMessageC(await nt.read(et));tt.trace("Stage 2 - Responder received the message, finished handshake.");const ft=await decodeHandshakePayload(ht,dt.rs,at),[mt,pt]=dt.ss.split();return logCipherState(mt,pt,tt),{payload:ft,encrypt:yt=>pt.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>mt.decryptWithAd(ZEROLEN,yt,gt)}}const CHACHA_TAG_LENGTH=16;function encryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length);let it;nt instanceof Uint8Array?it=o.encrypt(nt.subarray(rt,ot)):it=o.encrypt(nt.sublist(rt,ot)),et==null||et.encryptedPackets.increment(),yield new Uint8ArrayList(uint16BEEncode(it.byteLength),it)}}}function decryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length),ot-CHACHA_TAG_LENGTHdecode$5(it,{lengthDecoder:uint16BEDecode}),decryptStream(tt,this.metrics),nt),rt}}function noise(o={}){return et=>new Noise(et,o)}const peerDiscoverySymbol$1=Symbol.for("@libp2p/peer-discovery");function setMaxListeners$7(){}const setMaxListeners$6=(o,...et)=>{try{[...et]}catch{}};var Yn,xl;let TypedEventEmitter$2=(xl=class extends EventTarget{constructor(){super();pn(this,Yn,new Map);setMaxListeners$6(1/0,this)}listenerCount(tt){const nt=jt(this,Yn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=jt(this,Yn).get(tt);ot==null&&(ot=[],jt(this,Yn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=jt(this,Yn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),jt(this,Yn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=jt(this,Yn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),jt(this,Yn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Yn=new WeakMap,xl);const serviceCapabilities$4=Symbol.for("@libp2p/service-capabilities"),DNS4=base("dns4"),DNS6=base("dns6"),DNSADDR=base("dnsaddr"),DNS$1=or$1(base("dns"),DNSADDR,DNS4,DNS6),IP=or$1(base("ip4"),base("ip6")),TCP$1=or$1(and$1(IP,base("tcp")),and$1(DNS$1,base("tcp"))),UDP=and$1(IP,base("udp")),UTP=and$1(UDP,base("utp")),QUIC=and$1(UDP,base("quic")),QUICV1=and$1(UDP,base("quic-v1")),_WebSockets$1=or$1(and$1(TCP$1,base("ws")),and$1(DNS$1,base("ws"))),WebSockets$2=or$1(and$1(_WebSockets$1,base("p2p")),_WebSockets$1),_WebSocketsSecure$1=or$1(and$1(TCP$1,base("wss")),and$1(DNS$1,base("wss")),and$1(TCP$1,base("tls"),base("ws")),and$1(DNS$1,base("tls"),base("ws"))),WebSocketsSecure$1=or$1(and$1(_WebSocketsSecure$1,base("p2p")),_WebSocketsSecure$1),HTTP=or$1(and$1(TCP$1,base("http")),and$1(IP,base("http")),and$1(DNS$1,base("http"))),HTTPS=or$1(and$1(TCP$1,base("https")),and$1(IP,base("https")),and$1(DNS$1,base("https"))),_WebRTCDirect$1=and$1(UDP,base("webrtc-direct"),base("certhash")),WebRTCDirect$1=or$1(and$1(_WebRTCDirect$1,base("p2p")),_WebRTCDirect$1),_WebTransport$1=and$1(QUICV1,base("webtransport"),base("certhash"),base("certhash")),WebTransport$1=or$1(and$1(_WebTransport$1,base("p2p")),_WebTransport$1),P2PWebRTCStar=or$1(and$1(WebSockets$2,base("p2p-webrtc-star"),base("p2p")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"),base("p2p")),and$1(WebSockets$2,base("p2p-webrtc-star")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"))),P2PWebRTCDirect=or$1(and$1(HTTP,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTPS,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTP,base("p2p-webrtc-direct")),and$1(HTTPS,base("p2p-webrtc-direct"))),Reliable=or$1(_WebSockets$1,_WebSocketsSecure$1,HTTP,HTTPS,P2PWebRTCStar,P2PWebRTCDirect,TCP$1,UTP,QUIC,DNS$1,WebRTCDirect$1,WebTransport$1),_P2P$1=or$1(and$1(Reliable,base("p2p")),P2PWebRTCStar,P2PWebRTCDirect,WebRTCDirect$1,WebTransport$1,base("p2p")),_Circuit$1=or$1(and$1(_P2P$1,base("p2p-circuit"),_P2P$1),and$1(_P2P$1,base("p2p-circuit")),and$1(base("p2p-circuit"),_P2P$1),and$1(Reliable,base("p2p-circuit")),and$1(base("p2p-circuit"),Reliable),base("p2p-circuit")),CircuitRecursive=()=>or$1(and$1(_Circuit$1,CircuitRecursive),_Circuit$1),Circuit$1=CircuitRecursive(),P2P=or$1(and$1(Circuit$1,_P2P$1,Circuit$1),and$1(_P2P$1,Circuit$1),and$1(Circuit$1,_P2P$1),Circuit$1,_P2P$1);function makeMatchesFunction(o){function et(tt){let nt;try{nt=multiaddr(tt)}catch{return!1}const rt=o(nt.protoNames());return rt===null?!1:rt===!0||rt===!1?rt:rt.length===0}return et}function and$1(...o){function et(tt){if(tt.length(nt=typeof rt=="function"?rt().partialMatch(tt):rt.partialMatch(tt),Array.isArray(nt)&&(tt=nt),nt===null)),nt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function or$1(...o){function et(nt){let rt=null;return o.some(ot=>{const it=typeof ot=="function"?ot().partialMatch(nt):ot.partialMatch(nt);return it!=null?(rt=it,!0):!1}),rt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function base(o){const et=o;function tt(rt){let ot;try{ot=multiaddr(rt)}catch{return!1}const it=ot.protoNames();return it.length===1&&it[0]===et}function nt(rt){return rt.length===0?null:rt[0]===et?rt.slice(1):null}return{toString:function(){return et},matches:tt,partialMatch:nt}}const DEFAULT_BOOTSTRAP_TAG_NAME$1="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE$1=50,DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT=1e3;var El,wl,Cl,Sl;class Bootstrap extends(Sl=TypedEventEmitter$2,Cl=peerDiscoverySymbol$1,wl=Symbol.toStringTag,El=serviceCapabilities$4,Sl){constructor(tt,nt={list:[]}){if(nt.list==null||nt.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super();Ct(this,"log");Ct(this,"timer");Ct(this,"list");Ct(this,"timeout");Ct(this,"components");Ct(this,"_init");Ct(this,Cl,this);Ct(this,wl,"@libp2p/bootstrap");Ct(this,El,["@libp2p/peer-discovery"]);this.components=tt,this.log=tt.logger.forComponent("libp2p:bootstrap"),this.timeout=nt.timeout??DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT,this.list=[];for(const rt of nt.list){if(!P2P.matches(rt)){this.log.error("Invalid multiaddr");continue}const ot=multiaddr(rt),it=ot.getPeerId();if(it==null){this.log.error("Invalid bootstrap multiaddr without peer id");continue}const st={id:peerIdFromString$1(it),multiaddrs:[ot]};this.list.push(st)}this._init=nt}isStarted(){return!!this.timer}start(){this.isStarted()||(this.log("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(tt=>{this.log.error(tt)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(const tt of this.list){if(await this.components.peerStore.merge(tt.id,{tags:{[this._init.tagName??DEFAULT_BOOTSTRAP_TAG_NAME$1]:{value:this._init.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE$1,ttl:this._init.tagTTL}},multiaddrs:tt.multiaddrs}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:tt}),this.components.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error("could not dial bootstrap peer %p",tt.id,nt)})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}}Ct(Bootstrap,"tag","bootstrap");function bootstrap(o){return et=>new Bootstrap(et,o)}var ps;let UnsupportedProtocolError$1=(ps=class extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}},Ct(ps,"name","UnsupportedProtocolError"),ps);var gs;let InvalidMessageError$2=(gs=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(gs,"name","InvalidMessageError"),gs);function setMaxListeners$5(){}const setMaxListeners$4=(o,...et)=>{try{[...et]}catch{}},serviceCapabilities$3=Symbol.for("@libp2p/service-capabilities");var Envelope;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.publicKey!=null&&tt.publicKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.payloadType!=null&&tt.payloadType.byteLength>0&&(nt.uint32(18),nt.bytes(tt.payloadType)),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(26),nt.bytes(tt.payload)),tt.signature!=null&&tt.signature.byteLength>0&&(nt.uint32(42),nt.bytes(tt.signature)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={publicKey:alloc$2(0),payloadType:alloc$2(0),payload:alloc$2(0),signature:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.publicKey=tt.bytes();break}case 2:{ot.payloadType=tt.bytes();break}case 3:{ot.payload=tt.bytes();break}case 5:{ot.signature=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Envelope||(Envelope={}));class InvalidSignatureError extends Error{constructor(et="Invalid signature"){super(et),this.name="InvalidSignatureError"}}const cr=class cr{constructor(et){Ct(this,"publicKey");Ct(this,"payloadType");Ct(this,"payload");Ct(this,"signature");Ct(this,"marshaled");const{publicKey:tt,payloadType:nt,payload:rt,signature:ot}=et;this.publicKey=tt,this.payloadType=nt,this.payload=rt,this.signature=ot}marshal(){return this.marshaled==null&&(this.marshaled=Envelope.encode({publicKey:publicKeyToProtobuf(this.publicKey),payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(et){return equals(this.marshal(),et.marshal())}async validate(et){const tt=formatSignaturePayload(et,this.payloadType,this.payload);return this.publicKey.verify(tt.subarray(),this.signature)}};Ct(cr,"createFromProtobuf",async et=>{const tt=Envelope.decode(et),nt=publicKeyFromProtobuf(tt.publicKey);return new cr({publicKey:nt,payloadType:tt.payloadType,payload:tt.payload,signature:tt.signature})}),Ct(cr,"seal",async(et,tt)=>{if(tt==null)throw new Error("Missing private key");const nt=et.domain,rt=et.codec,ot=et.marshal(),it=formatSignaturePayload(nt,rt,ot),st=await tt.sign(it.subarray());return new cr({publicKey:tt.publicKey,payloadType:rt,payload:ot,signature:st})}),Ct(cr,"openAndCertify",async(et,tt)=>{const nt=await cr.createFromProtobuf(et);if(!await nt.validate(tt))throw new InvalidSignatureError("Envelope signature is not valid for the given domain");return nt});let RecordEnvelope=cr;const formatSignaturePayload=(o,et,tt)=>{const nt=fromString(o),rt=encode$a(nt.byteLength),ot=encode$a(et.length),it=encode$a(tt.length);return new Uint8ArrayList(rt,nt,ot,et,it,tt)};function arrayEquals(o,et){const tt=(nt,rt)=>nt.toString().localeCompare(rt.toString());return o.length!==et.length?!1:(et.sort(tt),o.sort(tt).every((nt,rt)=>et[rt].equals(nt)))}const ENVELOPE_DOMAIN_PEER_RECORD="libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD=Uint8Array.from([3,1]);var PeerRecord$1;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.multiaddr!=null&&rt.multiaddr.byteLength>0&&(ot.uint32(10),ot.bytes(rt.multiaddr)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={multiaddr:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.multiaddr=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.AddressInfo||(o.AddressInfo={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerId!=null&&tt.peerId.byteLength>0&&(nt.uint32(10),nt.bytes(tt.peerId)),tt.seq!=null&&tt.seq!==0n&&(nt.uint32(16),nt.uint64(tt.seq)),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(26),o.AddressInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerId:alloc$2(0),seq:0n,addresses:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.peerId=tt.bytes();break}case 2:{ot.seq=tt.uint64();break}case 3:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(o.AddressInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerRecord$1||(PeerRecord$1={}));const nr=class nr{constructor(et){Ct(this,"peerId");Ct(this,"multiaddrs");Ct(this,"seqNumber");Ct(this,"domain",nr.DOMAIN);Ct(this,"codec",nr.CODEC);Ct(this,"marshaled");const{peerId:tt,multiaddrs:nt,seqNumber:rt}=et;this.peerId=tt,this.multiaddrs=nt??[],this.seqNumber=rt??BigInt(Date.now())}marshal(){return this.marshaled==null&&(this.marshaled=PeerRecord$1.encode({peerId:this.peerId.toMultihash().bytes,seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(et=>({multiaddr:et.bytes}))})),this.marshaled}equals(et){return!(!(et instanceof nr)||!this.peerId.equals(et.peerId)||this.seqNumber!==et.seqNumber||!arrayEquals(this.multiaddrs,et.multiaddrs))}};Ct(nr,"createFromProtobuf",et=>{const tt=PeerRecord$1.decode(et),nt=peerIdFromMultihash(decode$6(tt.peerId)),rt=(tt.addresses??[]).map(it=>multiaddr(it.multiaddr)),ot=tt.seq;return new nr({peerId:nt,multiaddrs:rt,seqNumber:ot})}),Ct(nr,"DOMAIN",ENVELOPE_DOMAIN_PEER_RECORD),Ct(nr,"CODEC",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD);let PeerRecord=nr;function isAsyncIterable$4(o){return o[Symbol.asyncIterator]!=null}function drain(o){if(isAsyncIterable$4(o))return(async()=>{for await(const et of o);})();for(const et of o);}const CustomEvent$1=globalThis.CustomEvent??Event;async function*parallel(o,et={}){let tt=et.concurrency??1/0;tt<1&&(tt=1/0);const nt=et.ordered==null?!1:et.ordered,rt=new EventTarget,ot=[];let it=pDefer(),st=pDefer(),at=!1,ct,lt=!1;rt.addEventListener("task-complete",()=>{st.resolve()}),Promise.resolve().then(async()=>{try{for await(const mt of o){if(ot.length===tt&&(it=pDefer(),await it.promise),lt)break;const pt={done:!1};ot.push(pt),mt().then(yt=>{pt.done=!0,pt.ok=!0,pt.value=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))},yt=>{pt.done=!0,pt.err=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))})}at=!0,rt.dispatchEvent(new CustomEvent$1("task-complete"))}catch(mt){ct=mt,rt.dispatchEvent(new CustomEvent$1("task-complete"))}});function dt(){var mt;return nt?(mt=ot[0])==null?void 0:mt.done:!!ot.find(pt=>pt.done)}function*ht(){for(;ot.length>0&&ot[0].done;){const mt=ot[0];if(ot.shift(),mt.ok)yield mt.value;else throw lt=!0,it.resolve(),mt.err;it.resolve()}}function*ft(){for(;dt();)for(let mt=0;mt{const it=await tt.read(ot);return rt.decode(it)},write:async(rt,ot,it)=>{await tt.write(ot.encode(rt),it)},writeV:async(rt,ot,it)=>{await tt.writeV(rt.map(st=>ot.encode(st)),it)},pb:rt=>({read:async ot=>nt.read(rt,ot),write:async(ot,it)=>nt.write(ot,rt,it),writeV:async(ot,it)=>nt.writeV(ot,rt,it),unwrap:()=>nt}),unwrap:()=>tt.unwrap()};return nt}const IDENTIFY_PROTOCOL_VERSION="0.1.0",MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",MAX_IDENTIFY_MESSAGE_SIZE=1024*8,MAX_PUSH_CONCURRENCY=32;var Identify$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.protocolVersion!=null&&(nt.uint32(42),nt.string(tt.protocolVersion)),tt.agentVersion!=null&&(nt.uint32(50),nt.string(tt.agentVersion)),tt.publicKey!=null&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.listenAddrs!=null)for(const ot of tt.listenAddrs)nt.uint32(18),nt.bytes(ot);if(tt.observedAddr!=null&&(nt.uint32(34),nt.bytes(tt.observedAddr)),tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(26),nt.string(ot);tt.signedPeerRecord!=null&&(nt.uint32(66),nt.bytes(tt.signedPeerRecord)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={listenAddrs:[],protocols:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 5:{ot.protocolVersion=tt.string();break}case 6:{ot.agentVersion=tt.string();break}case 1:{ot.publicKey=tt.bytes();break}case 2:{if(((st=rt.limits)==null?void 0:st.listenAddrs)!=null&&ot.listenAddrs.length===rt.limits.listenAddrs)throw new MaxLengthError('Decode error - map field "listenAddrs" had too many elements');ot.listenAddrs.push(tt.bytes());break}case 4:{ot.observedAddr=tt.bytes();break}case 3:{if(((at=rt.limits)==null?void 0:at.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 8:{ot.signedPeerRecord=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Identify$1||(Identify$1={}));var define_process_default={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof define_process_default<"u"&&typeof define_process_default.versions=="object"&&define_process_default.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1;const detectElectron=getDefaultExportFromCjs(isElectron_1),isEnvWithDom=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,isElectron=detectElectron(),isBrowser=isEnvWithDom&&!isElectron,isElectronMain=isElectron&&!isEnvWithDom,isElectronRenderer=isElectron&&isEnvWithDom,isNode=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&globalThis.process.release.name==="node"&&!isElectron,isWebWorker=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",defaultValues={protocolPrefix:"ipfs",timeout:5e3,maxInboundStreams:1,maxOutboundStreams:1,maxObservedAddresses:10,maxMessageSize:MAX_IDENTIFY_MESSAGE_SIZE,runOnConnectionOpen:!0,runOnSelfUpdate:!0,runOnLimitedConnection:!0,concurrency:MAX_PUSH_CONCURRENCY};function getCleanMultiaddr(o){if(o!=null&&o.length>0)try{return multiaddr(o)}catch{}}function getAgentVersion(o,et){return et!=null||(et=`${o.name}/${o.version}`,isNode||isElectronMain?et+=` UserAgent=${globalThis.process.version}`:(isBrowser||isWebWorker||isElectronRenderer||isReactNative)&&(et+=` UserAgent=${globalThis.navigator.userAgent}`)),et}async function consumeIdentifyMessage(o,et,tt,nt,rt){if(tt("received identify from %p",nt.remotePeer),rt==null)throw new InvalidMessageError$2("message was null or undefined");const ot={};if(rt.listenAddrs.length>0&&(ot.addresses=rt.listenAddrs.map(at=>({isCertified:!1,multiaddr:multiaddr(at)}))),rt.protocols.length>0&&(ot.protocols=rt.protocols),rt.publicKey!=null){const at=publicKeyFromProtobuf(rt.publicKey);if(!peerIdFromPublicKey(at).equals(nt.remotePeer))throw new InvalidMessageError$2("public key did not match remote PeerId");ot.publicKey=at}let it;if(rt.signedPeerRecord!=null){tt.trace("received signedPeerRecord from %p",nt.remotePeer);let at=rt.signedPeerRecord;const ct=await RecordEnvelope.openAndCertify(at,PeerRecord.DOMAIN);let lt=PeerRecord.createFromProtobuf(ct.payload);const dt=peerIdFromCID(ct.publicKey.toCID());if(!lt.peerId.equals(dt))throw new InvalidMessageError$2("signing key does not match PeerId in the PeerRecord");if(!nt.remotePeer.equals(lt.peerId))throw new InvalidMessageError$2("signing key does not match remote PeerId");let ht;try{ht=await o.get(lt.peerId)}catch(ft){if(ft.name!=="NotFoundError")throw ft}if(ht!=null&&(ot.metadata=ht.metadata,ht.peerRecordEnvelope!=null)){const ft=await RecordEnvelope.createFromProtobuf(ht.peerRecordEnvelope),mt=PeerRecord.createFromProtobuf(ft.payload);mt.seqNumber>=lt.seqNumber&&(tt("sequence number was lower or equal to existing sequence number - stored: %d received: %d",mt.seqNumber,lt.seqNumber),lt=mt,at=ht.peerRecordEnvelope)}ot.peerRecordEnvelope=at,ot.addresses=lt.multiaddrs.map(ft=>({isCertified:!0,multiaddr:ft})),it={seq:lt.seqNumber,addresses:lt.multiaddrs}}else tt("%p did not send a signed peer record",nt.remotePeer);if(tt.trace("patching %p with",nt.remotePeer,ot),await o.patch(nt.remotePeer,ot),rt.agentVersion!=null||rt.protocolVersion!=null){const at={};rt.agentVersion!=null&&(at.AgentVersion=fromString(rt.agentVersion)),rt.protocolVersion!=null&&(at.ProtocolVersion=fromString(rt.protocolVersion)),tt.trace("merging %p metadata",nt.remotePeer,at),await o.merge(nt.remotePeer,{metadata:at})}const st={peerId:nt.remotePeer,protocolVersion:rt.protocolVersion,agentVersion:rt.agentVersion,publicKey:rt.publicKey,listenAddrs:rt.listenAddrs.map(at=>multiaddr(at)),observedAddr:rt.observedAddr==null?void 0:multiaddr(rt.observedAddr),protocols:rt.protocols,signedPeerRecord:it,connection:nt};return et.safeDispatchEvent("peer:identify",{detail:st}),st}class AbstractIdentify{constructor(et,tt){Ct(this,"host");Ct(this,"protocol");Ct(this,"started");Ct(this,"timeout");Ct(this,"peerId");Ct(this,"privateKey");Ct(this,"peerStore");Ct(this,"registrar");Ct(this,"addressManager");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"maxMessageSize");Ct(this,"maxObservedAddresses");Ct(this,"events");Ct(this,"runOnLimitedConnection");Ct(this,"log");this.protocol=tt.protocol,this.started=!1,this.peerId=et.peerId,this.privateKey=et.privateKey,this.peerStore=et.peerStore,this.registrar=et.registrar,this.addressManager=et.addressManager,this.events=et.events,this.log=tt.log,this.timeout=tt.timeout??defaultValues.timeout,this.maxInboundStreams=tt.maxInboundStreams??defaultValues.maxInboundStreams,this.maxOutboundStreams=tt.maxOutboundStreams??defaultValues.maxOutboundStreams,this.maxMessageSize=tt.maxMessageSize??defaultValues.maxMessageSize,this.maxObservedAddresses=tt.maxObservedAddresses??defaultValues.maxObservedAddresses,this.runOnLimitedConnection=tt.runOnLimitedConnection??defaultValues.runOnLimitedConnection,this.host={protocolVersion:`${tt.protocolPrefix??defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,agentVersion:getAgentVersion(et.nodeInfo,tt.agentVersion)}}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:fromString(this.host.agentVersion),ProtocolVersion:fromString(this.host.protocolVersion)}}),await this.registrar.handle(this.protocol,et=>{this.handleProtocol(et).catch(tt=>{this.log.error(tt)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0)}async stop(){await this.registrar.unhandle(this.protocol),this.started=!1}}var Netmask_1;(function(){var o,et,tt,nt,rt,ot,it,st;st=function(at){var ct,lt,dt,ht;return ct=(at&255<<24)>>>24,lt=(at&255<<16)>>>16,dt=(at&65280)>>>8,ht=at&255,[ct,lt,dt,ht].join(".")},it=function(at){var ct,lt,dt,ht,ft,mt;for(ct=[],dt=ht=0;ht<=3&&at.length!==0;dt=++ht){if(dt>0){if(at[0]!==".")throw new Error("Invalid IP");at=at.substring(1)}mt=et(at),ft=mt[0],lt=mt[1],at=at.substring(lt),ct.push(ft)}if(at.length!==0)throw new Error("Invalid IP");switch(ct.length){case 1:if(ct[0]>4294967295)throw new Error("Invalid IP");return ct[0]>>>0;case 2:if(ct[0]>255||ct[1]>16777215)throw new Error("Invalid IP");return(ct[0]<<24|ct[1])>>>0;case 3:if(ct[0]>255||ct[1]>255||ct[2]>65535)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2])>>>0;case 4:if(ct[0]>255||ct[1]>255||ct[2]>255||ct[3]>255)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2]<<8|ct[3])>>>0;default:throw new Error("Invalid IP")}},tt=function(at){return at.charCodeAt(0)},nt=tt("0"),ot=tt("a"),rt=tt("A"),et=function(at){var ct,lt,dt,ht,ft;for(ht=0,ct=10,lt="9",dt=0,at.length>1&&at[dt]==="0"&&(at[dt+1]==="x"||at[dt+1]==="X"?(dt+=2,ct=16):"0"<=at[dt+1]&&at[dt+1]<="9"&&(dt++,ct=8,lt="7")),ft=dt;dt>>0;else if(ct===16)if("a"<=at[dt]&&at[dt]<="f")ht=ht*ct+(10+tt(at[dt])-ot)>>>0;else if("A"<=at[dt]&&at[dt]<="F")ht=ht*ct+(10+tt(at[dt])-rt)>>>0;else break;else break;if(ht>4294967295)throw new Error("too large");dt++}if(dt===ft)throw new Error("empty octet");return[ht,dt]},o=function(){function at(ct,lt){var dt,ht,ft;if(typeof ct!="string")throw new Error("Missing `net' parameter");if(lt||(ft=ct.split("/",2),ct=ft[0],lt=ft[1]),lt||(lt=32),typeof lt=="string"&<.indexOf(".")>-1){try{this.maskLong=it(lt)}catch{throw new Error("Invalid mask: "+lt)}for(dt=ht=32;ht>=0;dt=--ht)if(this.maskLong===4294967295<<32-dt>>>0){this.bitmask=dt;break}}else if(lt||lt===0)this.bitmask=parseInt(lt,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(it(ct)&this.maskLong)>>>0}catch{throw new Error("Invalid net address: "+ct)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+lt);this.size=Math.pow(2,32-this.bitmask),this.base=st(this.netLong),this.mask=st(this.maskLong),this.hostmask=st(~this.maskLong),this.first=this.bitmask<=30?st(this.netLong+1):this.base,this.last=this.bitmask<=30?st(this.netLong+this.size-2):st(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?st(this.netLong+this.size-1):void 0}return at.prototype.contains=function(ct){return typeof ct=="string"&&(ct.indexOf("/")>0||ct.split(".").length!==4)&&(ct=new at(ct)),ct instanceof at?this.contains(ct.base)&&this.contains(ct.broadcast||ct.last):(it(ct)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},at.prototype.next=function(ct){return ct==null&&(ct=1),new at(st(this.netLong+this.size*ct),this.mask)},at.prototype.forEach=function(ct){var lt,dt,ht;for(ht=it(this.first),dt=it(this.last),lt=0;ht<=dt;)ct(st(ht),ht,lt),lt++,ht++},at.prototype.toString=function(){return this.base+"/"+this.bitmask},at}(),Netmask_1=o}).call(commonjsGlobal);const PRIVATE_IP_RANGES=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],NETMASK_RANGES=PRIVATE_IP_RANGES.map(o=>new Netmask_1(o));function ipv4Check(o){for(const et of NETMASK_RANGES)if(et.contains(o))return!0;return!1}function isIpv4MappedIpv6(o){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(o)}function ipv4MappedIpv6Check(o){const et=o.split(":");if(et.length<2)return!1;const tt=et[et.length-1].padStart(4,"0"),nt=et[et.length-2].padStart(4,"0"),rt=`${parseInt(nt.substring(0,2),16)}.${parseInt(nt.substring(2),16)}.${parseInt(tt.substring(0,2),16)}.${parseInt(tt.substring(2),16)}`;return ipv4Check(rt)}function isIpv4EmbeddedIpv6(o){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)}function ipv4EmbeddedIpv6Check(o){const et=o.split(":"),tt=et[et.length-1];return ipv4Check(tt)}function ipv6Check(o){return/^::$/.test(o)||/^::1$/.test(o)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(o)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(o)||/^ff([0-9a-fA-F]{2,2}):/i.test(o)}function isPrivateIp(o){return isIPv4(o)?ipv4Check(o):isIpv4MappedIpv6(o)?ipv4MappedIpv6Check(o):isIpv4EmbeddedIpv6(o)?ipv4EmbeddedIpv6Check(o):isIPv6(o)?ipv6Check(o):void 0}const toParts=o=>o.toString().split("/").slice(1),func=o=>({match:et=>et.length<1?!1:o(et[0])?et.slice(1):!1,pattern:"fn"}),literal=o=>({match:et=>func(tt=>tt===o).match(et),pattern:o}),string$3=()=>({match:o=>func(et=>typeof et=="string").match(o),pattern:"{string}"}),number$1=()=>({match:o=>func(et=>!isNaN(parseInt(et))).match(o),pattern:"{number}"}),peerId=()=>({match:o=>{if(o.length<2||o[0]!=="p2p"&&o[0]!=="ipfs")return!1;if(o[1].startsWith("Q")||o[1].startsWith("1"))try{base58btc.decode(`z${o[1]}`)}catch{return!1}else return!1;return o.slice(2)},pattern:"/p2p/{peerid}"}),certhash=()=>({match:o=>{if(o.length<2||o[0]!=="certhash")return!1;try{base64url.decode(o[1])}catch{return!1}return o.slice(2)},pattern:"/certhash/{certhash}"}),optional=o=>({match:et=>{const tt=o.match(et);return tt===!1?et:tt},pattern:`optional(${o.pattern})`}),or=(...o)=>({match:et=>{let tt;for(const nt of o){const rt=nt.match(et);rt!==!1&&(tt==null||rt.lengthet.pattern).join(", ")})`}),and=(...o)=>({match:et=>{for(const tt of o){const nt=tt.match(et);if(nt===!1)return!1;et=nt}return et},pattern:`and(${o.map(et=>et.pattern).join(", ")})`});function fmt(...o){function et(rt){let ot=toParts(rt);for(const it of o){const st=it.match(ot);if(st===!1)return!1;ot=st}return ot}function tt(rt){return et(rt)!==!1}function nt(rt){const ot=et(rt);return ot===!1?!1:ot.length===0}return{matchers:o,matches:tt,exactMatch:nt}}const _DNS4=and(literal("dns4"),string$3()),_DNS6=and(literal("dns6"),string$3()),_DNSADDR=and(literal("dnsaddr"),string$3()),_DNS=and(literal("dns"),string$3());fmt(_DNS4,optional(peerId()));fmt(_DNS6,optional(peerId()));fmt(_DNSADDR,optional(peerId()));fmt(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId()));const _IP4=and(literal("ip4"),func(isIPv4)),_IP6=and(literal("ip6"),func(isIPv6)),_IP=or(_IP4,_IP6),_IP_OR_DOMAIN=or(_IP,_DNS,_DNS4,_DNS6,_DNSADDR),IP_OR_DOMAIN=fmt(or(_IP,and(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId())))),_TCP=and(_IP_OR_DOMAIN,literal("tcp"),number$1()),_UDP=and(_IP_OR_DOMAIN,literal("udp"),number$1()),TCP=fmt(and(_TCP,optional(peerId()))),_QUIC=and(_UDP,literal("quic")),_QUICV1=and(_UDP,literal("quic-v1")),QUIC_V0_OR_V1=or(_QUIC,_QUICV1),_WEB=or(_IP_OR_DOMAIN,_TCP,_UDP,_QUIC,_QUICV1),_WebSockets=or(and(_WEB,literal("ws"),optional(peerId()))),WebSockets$1=fmt(_WebSockets),_WebSocketsSecure=or(and(_WEB,literal("wss"),optional(peerId())),and(_WEB,literal("tls"),optional(and(literal("sni"),string$3())),literal("ws"),optional(peerId()))),WebSocketsSecure=fmt(_WebSocketsSecure),_WebRTCDirect=and(_UDP,literal("webrtc-direct"),optional(certhash()),optional(certhash()),optional(peerId())),WebRTCDirect=fmt(_WebRTCDirect),_WebTransport=and(_QUICV1,literal("webtransport"),optional(certhash()),optional(certhash()),optional(peerId())),WebTransport=fmt(_WebTransport),_P2P=or(_WebSockets,_WebSocketsSecure,and(_TCP,optional(peerId())),and(QUIC_V0_OR_V1,optional(peerId())),and(_IP_OR_DOMAIN,optional(peerId())),_WebRTCDirect,_WebTransport,peerId()),_Circuit=and(_P2P,literal("p2p-circuit"),peerId()),Circuit=fmt(_Circuit),_WebRTC=or(and(_P2P,literal("p2p-circuit"),literal("webrtc"),optional(peerId())),and(_P2P,literal("webrtc"),optional(peerId())),and(literal("webrtc"),optional(peerId()))),WebRTC=fmt(_WebRTC);or(and(_IP_OR_DOMAIN,literal("tcp"),number$1(),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("http"),optional(peerId())));or(and(_IP_OR_DOMAIN,literal("tcp"),or(and(literal("443"),literal("http")),and(number$1(),literal("https"))),optional(peerId())),and(_IP_OR_DOMAIN,literal("tls"),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("https"),optional(peerId())));or(and(literal("memory"),string$3(),optional(peerId())));var Al,Rl;class Identify extends(Rl=AbstractIdentify,Al=serviceCapabilities$3,Rl){constructor(tt,nt={}){super(tt,{...nt,protocol:`/${nt.protocolPrefix??defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`,log:tt.logger.forComponent("libp2p:identify")});Ct(this,Al,["@libp2p/identify"]);(nt.runOnConnectionOpen??defaultValues.runOnConnectionOpen)&&tt.events.addEventListener("connection:open",rt=>{const ot=rt.detail;this.identify(ot).catch(it=>{it.name!==UnsupportedProtocolError$1.name&&this.log.error("error during identify trigged by connection:open",it)})})}async _identify(tt,nt={}){let rt;if(nt.signal==null){const ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot),nt={...nt,signal:ot}}try{rt=await tt.newStream(this.protocol,{...nt,runOnLimitedConnection:this.runOnLimitedConnection});const it=await pbStream(rt,{maxDataLength:this.maxMessageSize}).pb(Identify$1).read(nt);return await rt.close(nt),it}catch(ot){throw rt==null||rt.abort(ot),ot}}async identify(tt,nt={}){const rt=await this._identify(tt,nt),{publicKey:ot,protocols:it,observedAddr:st}=rt;if(ot==null)throw new InvalidMessageError$2("public key was missing from identify message");const at=publicKeyFromProtobuf(ot),ct=peerIdFromCID(at.toCID());if(!tt.remotePeer.equals(ct))throw new InvalidMessageError$2("identified peer does not match the expected peer");if(this.peerId.equals(ct))throw new InvalidMessageError$2("identified peer is our own peer id?");const lt=getCleanMultiaddr(st);return this.log("identify completed for peer %p and protocols %o",ct,it),lt!=null&&(this.log("our observed address was %a",lt),isPrivateIp(lt==null?void 0:lt.nodeAddress().address)===!0?this.log("our observed address was private"):this.addressManager.getObservedAddrs().length<(this.maxObservedAddresses??1/0)&&(this.log("storing our observed address"),this.addressManager.addObservedAddr(lt))),consumeIdentifyMessage(this.peerStore,this.events,this.log,tt,rt)}async handleProtocol(tt){const{connection:nt,stream:rt}=tt,ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot);try{const it=await this.peerStore.get(this.peerId),st=this.addressManager.getAddresses().map(dt=>dt.decapsulateCode(getProtocol("p2p").code));let at=it.peerRecordEnvelope;if(st.length>0&&at==null){const dt=new PeerRecord({peerId:this.peerId,multiaddrs:st});at=(await RecordEnvelope.seal(dt,this.privateKey)).marshal().subarray()}let ct=nt.remoteAddr.bytes;IP_OR_DOMAIN.matches(nt.remoteAddr)||(ct=void 0),await pbStream(rt).pb(Identify$1).write({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:publicKeyToProtobuf(this.privateKey.publicKey),listenAddrs:st.map(dt=>dt.bytes),signedPeerRecord:at,observedAddr:ct,protocols:it.protocols},{signal:ot}),await rt.close({signal:ot})}catch(it){this.log.error("could not respond to identify request",it),rt.abort(it)}}}function identify(o={}){return et=>new Identify(et,o)}class MuxerClosedError extends Error{constructor(et="The muxer is closed"){super(et),this.name="MuxerClosedError"}}Ct(MuxerClosedError,"name","MuxerClosedError");var ys;let InvalidMessageError$1=(ys=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(ys,"name","InvalidMessageError"),ys);var xs;let TooManyOutboundProtocolStreamsError$1=(xs=class extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}},Ct(xs,"name","TooManyOutboundProtocolStreamsError"),xs);const serviceCapabilities$2=Symbol.for("@libp2p/service-capabilities");function getIterator(o){if(o!=null){if(typeof o[Symbol.iterator]=="function")return o[Symbol.iterator]();if(typeof o[Symbol.asyncIterator]=="function")return o[Symbol.asyncIterator]();if(typeof o.next=="function")return o}throw new Error("argument is not an iterator or iterable")}function isPromise$2(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function closeSource(o,et){var nt,rt;const tt=(rt=(nt=getIterator(o)).return)==null?void 0:rt.call(nt);isPromise$2(tt)&&tt.catch(ot=>{et.error("could not cause iterator to return",ot)})}const createAbortError=()=>{const o=new Error("Delay aborted");return o.name="AbortError",o},clearMethods=new WeakMap;function createDelay({clearTimeout:o,setTimeout:et}={}){return(tt,{value:nt,signal:rt}={})=>{if(rt!=null&&rt.aborted)return Promise.reject(createAbortError());let ot,it,st;const at=o??clearTimeout,ct=()=>{at(ot),st(createAbortError())},lt=()=>{rt&&rt.removeEventListener("abort",ct)},dt=new Promise((ht,ft)=>{it=()=>{lt(),ht(nt)},st=ft,ot=(et??setTimeout)(it,tt)});return rt&&rt.addEventListener("abort",ct,{once:!0}),clearMethods.set(dt,()=>{at(ot),ot=null,it()}),dt}}const delay=createDelay();class RateLimitError extends Error{constructor(tt="Rate limit exceeded",nt){super(tt);Ct(this,"remainingPoints");Ct(this,"msBeforeNext");Ct(this,"consumedPoints");Ct(this,"isFirstInDuration");this.name="RateLimitError",this.remainingPoints=nt.remainingPoints,this.msBeforeNext=nt.msBeforeNext,this.consumedPoints=nt.consumedPoints,this.isFirstInDuration=nt.isFirstInDuration}}class QueueFullError extends Error{constructor(et="The queue was full"){super(et),this.name="QueueFullError"}}Ct(QueueFullError,"name","QueueFullError");class RateLimiter{constructor(et={}){Ct(this,"memoryStorage");Ct(this,"points");Ct(this,"duration");Ct(this,"blockDuration");Ct(this,"execEvenly");Ct(this,"execEvenlyMinDelayMs");Ct(this,"keyPrefix");this.points=et.points??4,this.duration=et.duration??1,this.blockDuration=et.blockDuration??0,this.execEvenly=et.execEvenly??!1,this.execEvenlyMinDelayMs=et.execEvenlyMinDelayMs??this.duration*1e3/this.points,this.keyPrefix=et.keyPrefix??"rlflx",this.memoryStorage=new MemoryStorage}async consume(et,tt=1,nt={}){const rt=this.getKey(et),ot=this._getKeySecDuration(nt);let it=this.memoryStorage.incrby(rt,tt,ot);if(it.remainingPoints=Math.max(this.points-it.consumedPoints,0),it.consumedPoints>this.points)throw this.blockDuration>0&&it.consumedPoints<=this.points+tt&&(it=this.memoryStorage.set(rt,it.consumedPoints,this.blockDuration)),new RateLimitError("Rate limit exceeded",it);if(this.execEvenly&&it.msBeforeNext>0&&!it.isFirstInDuration){let st=Math.ceil(it.msBeforeNext/(it.remainingPoints+2));st=0?nt:this.duration)*1e3;return this.memoryStorage.set(this.getKey(et),tt,nt),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:tt,isFirstInDuration:!1}}get(et){const tt=this.memoryStorage.get(this.getKey(et));return tt!=null&&(tt.remainingPoints=Math.max(this.points-tt.consumedPoints,0)),tt}delete(et){this.memoryStorage.delete(this.getKey(et))}_getKeySecDuration(et){return(et==null?void 0:et.customDuration)!=null&&et.customDuration>=0?et.customDuration:this.duration}getKey(et){return this.keyPrefix.length>0?`${this.keyPrefix}:${et}`:et}parseKey(et){return et.substring(this.keyPrefix.length)}}class MemoryStorage{constructor(){Ct(this,"storage");this.storage=new Map}incrby(et,tt,nt){const rt=this.storage.get(et);if(rt!=null){const ot=rt.expiresAt!=null?rt.expiresAt.getTime()-new Date().getTime():-1;return rt.expiresAt==null||ot>0?(rt.value+=tt,{remainingPoints:0,msBeforeNext:ot,consumedPoints:rt.value,isFirstInDuration:!1}):this.set(et,tt,nt)}return this.set(et,tt,nt)}set(et,tt,nt){const rt=nt*1e3,ot=this.storage.get(et);ot!=null&&clearTimeout(ot.timeoutId);const it={value:tt,expiresAt:rt>0?new Date(Date.now()+rt):void 0};return this.storage.set(et,it),rt>0&&(it.timeoutId=setTimeout(()=>{this.storage.delete(et)},rt),it.timeoutId.unref!=null&&it.timeoutId.unref()),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:it.value,isFirstInDuration:!0}}get(et){const tt=this.storage.get(et);if(tt!=null)return{remainingPoints:0,msBeforeNext:tt.expiresAt!=null?tt.expiresAt.getTime()-new Date().getTime():-1,consumedPoints:tt.value,isFirstInDuration:!1}}delete(et){const tt=this.storage.get(et);return tt!=null?(tt.timeoutId!=null&&clearTimeout(tt.timeoutId),this.storage.delete(et),!0):!1}}var MessageTypes;(function(o){o[o.NEW_STREAM=0]="NEW_STREAM",o[o.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",o[o.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",o[o.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",o[o.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",o[o.RESET_RECEIVER=5]="RESET_RECEIVER",o[o.RESET_INITIATOR=6]="RESET_INITIATOR"})(MessageTypes||(MessageTypes={}));const MessageTypeNames=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),InitiatorMessageTypes=Object.freeze({NEW_STREAM:MessageTypes.NEW_STREAM,MESSAGE:MessageTypes.MESSAGE_INITIATOR,CLOSE:MessageTypes.CLOSE_INITIATOR,RESET:MessageTypes.RESET_INITIATOR}),ReceiverMessageTypes=Object.freeze({MESSAGE:MessageTypes.MESSAGE_RECEIVER,CLOSE:MessageTypes.CLOSE_RECEIVER,RESET:MessageTypes.RESET_RECEIVER}),MAX_MSG_SIZE=1<<20,MAX_MSG_QUEUE_SIZE=4<<20;class Decoder{constructor(et=MAX_MSG_SIZE,tt=MAX_MSG_QUEUE_SIZE){Ct(this,"_buffer");Ct(this,"_headerInfo");Ct(this,"_maxMessageSize");Ct(this,"_maxUnprocessedMessageQueueSize");this._buffer=new Uint8ArrayList,this._headerInfo=null,this._maxMessageSize=et,this._maxUnprocessedMessageQueueSize=tt}write(et){if(et==null||et.length===0)return[];if(this._buffer.append(et),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw new InvalidMessageError$1("Unprocessed message queue size too large!");const tt=[];for(;this._buffer.length!==0;){if(this._headerInfo==null)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(ct){if(ct.name==="InvalidMessageError")throw ct;break}const{id:nt,type:rt,length:ot,offset:it}=this._headerInfo;if(this._buffer.length-itthis._maxMessageSize)throw new InvalidMessageError$1("Message size too large");return{id:tt>>3,type:it,offset:nt+ot,length:rt}}}const MSB=128,REST=127;function readVarInt(o,et=0){let tt=0,nt=0,rt=et,ot;const it=o.length;do{if(rt>=it||nt>49)throw et=0,new RangeError("Could not decode varint");ot=o.get(rt++),tt+=nt<28?(ot&REST)<=MSB);return et=rt-et,{value:tt,offset:et}}const POOL_SIZE=10*1024;class Encoder{constructor(){Ct(this,"_pool");Ct(this,"_poolOffset");this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0}write(et,tt){const nt=this._pool;let rt=this._poolOffset;encode$a(et.id<<3|et.type,nt,rt),rt+=encodingLength$3(et.id<<3|et.type),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null?(encode$a(et.data.length,nt,rt),rt+=encodingLength$3(et.data.length)):(encode$a(0,nt,rt),rt+=encodingLength$3(0));const ot=nt.subarray(this._poolOffset,rt);POOL_SIZE-rt<100?(this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0):this._poolOffset=rt,tt.append(ot),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null&&tt.append(et.data)}}const encoder$1=new Encoder;async function*encode$4(o){for await(const et of o){const tt=new Uint8ArrayList;encoder$1.write(et,tt),yield tt}}class StreamInputBufferError extends Error{constructor(et="Stream input buffer error"){super(et),this.name="StreamInputBufferError"}}var vs;let AbortError$6=(vs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(vs,"name","AbortError"),vs);class StreamResetError extends Error{constructor(et="The stream has been reset"){super(et),this.name="StreamResetError"}}Ct(StreamResetError,"name","StreamResetError");class StreamStateError extends Error{constructor(et="The stream is in an invalid state"){super(et),this.name="StreamStateError"}}Ct(StreamStateError,"name","StreamStateError");function setMaxListeners$3(){}const setMaxListeners$2=(o,...et)=>{try{[...et]}catch{}};var Zn,Tl;let TypedEventEmitter$1=(Tl=class extends EventTarget{constructor(){super();pn(this,Zn,new Map);setMaxListeners$2(1/0,this)}listenerCount(tt){const nt=jt(this,Zn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=jt(this,Zn).get(tt);ot==null&&(ot=[],jt(this,Zn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=jt(this,Zn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),jt(this,Zn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=jt(this,Zn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),jt(this,Zn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Zn=new WeakMap,Tl);const DEFAULT_SEND_CLOSE_WRITE_TIMEOUT=5e3;function isPromise$1(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}class AbstractStream{constructor(et){Ct(this,"id");Ct(this,"direction");Ct(this,"timeline");Ct(this,"protocol");Ct(this,"metadata");Ct(this,"source");Ct(this,"status");Ct(this,"readStatus");Ct(this,"writeStatus");Ct(this,"log");Ct(this,"sinkController");Ct(this,"sinkEnd");Ct(this,"closed");Ct(this,"endErr");Ct(this,"streamSource");Ct(this,"onEnd");Ct(this,"onCloseRead");Ct(this,"onCloseWrite");Ct(this,"onReset");Ct(this,"onAbort");Ct(this,"sendCloseWriteTimeout");Ct(this,"sendingData");this.sinkController=new AbortController,this.sinkEnd=pDefer(),this.closed=pDefer(),this.log=et.log,this.status="open",this.readStatus="ready",this.writeStatus="ready",this.id=et.id,this.metadata=et.metadata??{},this.direction=et.direction,this.timeline={open:Date.now()},this.sendCloseWriteTimeout=et.sendCloseWriteTimeout??DEFAULT_SEND_CLOSE_WRITE_TIMEOUT,this.onEnd=et.onEnd,this.onCloseRead=et==null?void 0:et.onCloseRead,this.onCloseWrite=et==null?void 0:et.onCloseWrite,this.onReset=et==null?void 0:et.onReset,this.onAbort=et==null?void 0:et.onAbort,this.source=this.streamSource=pushable({onEnd:tt=>{tt!=null?this.log.trace("source ended with error",tt):this.log.trace("source ended"),this.onSourceEnd(tt)}}),this.sink=this.sink.bind(this)}async sink(et){if(this.writeStatus!=="ready")throw new StreamStateError(`writable end state is "${this.writeStatus}" not "ready"`);try{this.writeStatus="writing";const tt={signal:this.sinkController.signal};if(this.direction==="outbound"){const rt=this.sendNewStream(tt);isPromise$1(rt)&&await rt}const nt=()=>{closeSource(et,this.log)};try{this.sinkController.signal.addEventListener("abort",nt),this.log.trace("sink reading from source");for await(let rt of et){rt=rt instanceof Uint8Array?new Uint8ArrayList(rt):rt;const ot=this.sendData(rt,tt);isPromise$1(ot)&&(this.sendingData=pDefer(),await ot,this.sendingData.resolve(),this.sendingData=void 0)}}finally{this.sinkController.signal.removeEventListener("abort",nt)}this.log.trace('sink finished reading from source, write status is "%s"',this.writeStatus),this.writeStatus==="writing"&&(this.writeStatus="closing",this.log.trace("send close write to remote"),await this.sendCloseWrite({signal:AbortSignal.timeout(this.sendCloseWriteTimeout)}),this.writeStatus="closed"),this.onSinkEnd()}catch(tt){throw this.log.trace("sink ended with error, calling abort with error",tt),this.abort(tt),tt}finally{this.log.trace("resolve sink end"),this.sinkEnd.resolve()}}onSourceEnd(et){var tt;this.timeline.closeRead==null&&(this.timeline.closeRead=Date.now(),this.readStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseRead)==null||tt.call(this),this.timeline.closeWrite!=null?(this.log.trace("source and sink ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("source ended, waiting for sink to end"))}onSinkEnd(et){var tt;this.timeline.closeWrite==null&&(this.timeline.closeWrite=Date.now(),this.writeStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseWrite)==null||tt.call(this),this.timeline.closeRead!=null?(this.log.trace("sink and source ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("sink ended, waiting for source to end"))}async close(et){this.log.trace("closing gracefully"),this.status="closing",await raceSignal(Promise.all([this.closeWrite(et),this.closeRead(et),this.closed.promise]),et==null?void 0:et.signal),this.status="closed",this.log.trace("closed gracefully")}async closeRead(et={}){if(this.readStatus==="closing"||this.readStatus==="closed")return;this.log.trace('closing readable end of stream with starting read status "%s"',this.readStatus);const tt=this.readStatus;this.readStatus="closing",this.status!=="reset"&&this.status!=="aborted"&&this.timeline.closeRead==null&&(this.log.trace("send close read to remote"),await this.sendCloseRead(et)),tt==="ready"&&(this.log.trace("ending internal source queue with %d queued bytes",this.streamSource.readableLength),this.streamSource.end()),this.log.trace("closed readable end of stream")}async closeWrite(et={}){this.writeStatus==="closing"||this.writeStatus==="closed"||(this.log.trace('closing writable end of stream with starting write status "%s"',this.writeStatus),this.writeStatus==="ready"&&(this.log.trace("sink was never sunk, sink an empty array"),await raceSignal(this.sink([]),et.signal)),this.writeStatus==="writing"&&(this.sendingData!=null&&await raceSignal(this.sendingData.promise,et.signal),this.log.trace("aborting source passed to .sink"),this.sinkController.abort(),await raceSignal(this.sinkEnd.promise,et.signal)),this.writeStatus="closed",this.log.trace("closed writable end of stream"))}abort(et){var nt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;this.log("abort with error",et),this.log("try to send reset to remote");const tt=this.sendReset();isPromise$1(tt)&&tt.catch(rt=>{this.log.error("error sending reset message",rt)}),this.status="aborted",this.timeline.abort=Date.now(),this._closeSinkAndSource(et),(nt=this.onAbort)==null||nt.call(this,et)}reset(){var tt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;const et=new StreamResetError("stream reset");this.status="reset",this.timeline.reset=Date.now(),this._closeSinkAndSource(et),(tt=this.onReset)==null||tt.call(this)}_closeSinkAndSource(et){this._closeSink(et),this._closeSource(et)}_closeSink(et){this.writeStatus==="writing"&&(this.log.trace("end sink source"),this.sinkController.abort()),this.onSinkEnd(et)}_closeSource(et){this.readStatus!=="closing"&&this.readStatus!=="closed"&&(this.log.trace("ending source with %d bytes to be read by consumer",this.streamSource.readableLength),this.readStatus="closing",this.streamSource.end(et))}remoteCloseWrite(){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("received remote close write but local source is already closed");return}this.log.trace("remote close write"),this._closeSource()}remoteCloseRead(){if(this.writeStatus==="closing"||this.writeStatus==="closed"){this.log("received remote close read but local sink is already closed");return}this.log.trace("remote close read"),this._closeSink()}destroy(){if(this.status==="closed"||this.status==="aborted"||this.status==="reset"){this.log("received destroy but we are already closed");return}this.log.trace("stream destroyed"),this._closeSinkAndSource()}sourcePush(et){this.streamSource.push(et)}sourceReadableLength(){return this.streamSource.readableLength}}class MplexStream extends AbstractStream{constructor(tt){super(tt);Ct(this,"name");Ct(this,"streamId");Ct(this,"send");Ct(this,"types");Ct(this,"maxDataSize");this.types=tt.direction==="outbound"?InitiatorMessageTypes:ReceiverMessageTypes,this.send=tt.send,this.name=tt.name,this.streamId=tt.streamId,this.maxDataSize=tt.maxDataSize}async sendNewStream(){await this.send({id:this.streamId,type:InitiatorMessageTypes.NEW_STREAM,data:new Uint8ArrayList(fromString(this.name))})}async sendData(tt){for(tt=tt.sublist();tt.byteLength>0;){const nt=Math.min(tt.byteLength,this.maxDataSize);await this.send({id:this.streamId,type:this.types.MESSAGE,data:tt.sublist(0,nt)}),tt.consume(nt)}}async sendReset(){await this.send({id:this.streamId,type:this.types.RESET})}async sendCloseWrite(){await this.send({id:this.streamId,type:this.types.CLOSE})}async sendCloseRead(){}}function createStream(o){const{id:et,name:tt,send:nt,onEnd:rt,type:ot="initiator",maxMsgSize:it=MAX_MSG_SIZE}=o;return new MplexStream({id:ot==="initiator"?`i${et}`:`r${et}`,streamId:et,name:`${tt??et}`,direction:ot==="initiator"?"outbound":"inbound",maxDataSize:it,onEnd:rt,send:nt,log:o.logger.forComponent(`libp2p:mplex:stream:${ot}:${et}`)})}const MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAM_BUFFER_SIZE=1024*1024*4,DISCONNECT_THRESHOLD=5,CLOSE_TIMEOUT$2=500;function printMessage(o){const et={...o,type:`${MessageTypeNames[o.type]} (${o.type})`};return o.type===MessageTypes.NEW_STREAM&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray())),(o.type===MessageTypes.MESSAGE_INITIATOR||o.type===MessageTypes.MESSAGE_RECEIVER)&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray(),"base16")),et}class MplexStreamMuxer{constructor(et,tt){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"sink");Ct(this,"source");Ct(this,"log");Ct(this,"_streamId");Ct(this,"_streams");Ct(this,"_init");Ct(this,"_source");Ct(this,"closeController");Ct(this,"rateLimiter");Ct(this,"closeTimeout");Ct(this,"logger");tt=tt??{},this.log=et.logger.forComponent("libp2p:mplex"),this.logger=et.logger,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=tt,this.closeTimeout=tt.closeTimeout??CLOSE_TIMEOUT$2,this.sink=this._createSink(),this._source=pushable({objectMode:!0,onEnd:()=>{for(const nt of this._streams.initiators.values())nt.destroy();for(const nt of this._streams.receivers.values())nt.destroy()}}),this.source=pipe(this._source,nt=>encode$4(nt)),this.closeController=new AbortController,this.rateLimiter=new RateLimiter({points:tt.disconnectThreshold??DISCONNECT_THRESHOLD,duration:1})}get streams(){const et=[];for(const tt of this._streams.initiators.values())et.push(tt);for(const tt of this._streams.receivers.values())et.push(tt);return et}newStream(et){if(this.closeController.signal.aborted)throw new MuxerClosedError("Muxer already closed");const tt=this._streamId++;et=et==null?tt.toString():et.toString();const nt=this._streams.initiators;return this._newStream({id:tt,name:et,type:"initiator",registry:nt})}async close(et){if(this.closeController.signal.aborted)return;const tt=(et==null?void 0:et.signal)??AbortSignal.timeout(this.closeTimeout);try{await Promise.all(this.streams.map(async nt=>nt.close({signal:tt}))),this._source.end(),await this._source.onEmpty({signal:tt}),this.closeController.abort()}catch(nt){this.abort(nt)}}abort(et){this.closeController.signal.aborted||(this.streams.forEach(tt=>{tt.abort(et)}),this.closeController.abort(et))}_newReceiverStream(et){const{id:tt,name:nt}=et,rt=this._streams.receivers;return this._newStream({id:tt,name:nt,type:"receiver",registry:rt})}_newStream(et){const{id:tt,name:nt,type:rt,registry:ot}=et;if(this.log("new %s stream %s",rt,tt),rt==="initiator"&&this._streams.initiators.size===(this._init.maxOutboundStreams??MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION))throw new TooManyOutboundProtocolStreamsError$1("Too many outbound streams open");if(ot.has(tt))throw new Error(`${rt} stream ${tt} already exists!`);const at=createStream({id:tt,name:nt,send:async ct=>{this.log.enabled&&this.log.trace("%s stream %s send",rt,tt,printMessage(ct)),this._source.push(ct)},type:rt,onEnd:()=>{this.log("%s stream with id %s and protocol %s ended",rt,tt,at.protocol),ot.delete(tt),this._init.onStreamEnd!=null&&this._init.onStreamEnd(at)},maxMsgSize:this._init.maxMsgSize,logger:this.logger});return ot.set(tt,at),at}_createSink(){return async tt=>{const nt=()=>{closeSource(tt,this.log)};this.closeController.signal.addEventListener("abort",nt);try{const rt=new Decoder(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const ot of tt)for(const it of rt.write(ot))await this._handleIncoming(it);this._source.end()}catch(rt){this.log("error in sink",rt),this._source.end(rt)}finally{this.closeController.signal.removeEventListener("abort",nt)}}}async _handleIncoming(et){const{id:tt,type:nt}=et;if(this.log.enabled&&this.log.trace("incoming message",printMessage(et)),et.type===MessageTypes.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)){this.log("too many inbound streams open"),this._source.push({id:tt,type:MessageTypes.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{this.log("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),this.abort(new Error("Too many open streams"));return}return}const st=this._newReceiverStream({id:tt,name:toString$8(et.data instanceof Uint8Array?et.data:et.data.subarray())});this._init.onIncomingStream!=null&&this._init.onIncomingStream(st);return}const ot=((nt&1)===1?this._streams.initiators:this._streams.receivers).get(tt);if(ot==null){this.log("missing stream %s for message type %s",tt,MessageTypeNames[nt]);try{await this.rateLimiter.consume("missing-stream",1)}catch{this.log("rate limit hit when receiving messages for streams that do not exist - closing remote connection"),this.abort(new Error("Too many messages for missing streams"));return}return}const it=this._init.maxStreamBufferSize??MAX_STREAM_BUFFER_SIZE;try{switch(nt){case MessageTypes.MESSAGE_INITIATOR:case MessageTypes.MESSAGE_RECEIVER:if(ot.sourceReadableLength()>it)throw this._source.push({id:et.id,type:nt===MessageTypes.MESSAGE_INITIATOR?MessageTypes.RESET_RECEIVER:MessageTypes.RESET_INITIATOR}),new StreamInputBufferError("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers");ot.sourcePush(et.data);break;case MessageTypes.CLOSE_INITIATOR:case MessageTypes.CLOSE_RECEIVER:ot.remoteCloseWrite();break;case MessageTypes.RESET_INITIATOR:case MessageTypes.RESET_RECEIVER:ot.reset();break;default:this.log("unknown message type %s",nt)}}catch(st){this.log.error("error while processing message",st),ot.abort(st)}}}var Il,_l;_l=Symbol.toStringTag,Il=serviceCapabilities$2;class Mplex{constructor(et,tt={}){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"_init");Ct(this,"components");Ct(this,_l,"@libp2p/mplex");Ct(this,Il,["@libp2p/stream-multiplexing"]);this.components=et,this._init=tt}createStreamMuxer(et={}){return new MplexStreamMuxer(this.components,{...et,...this._init})}}function mplex(o={}){return et=>new Mplex(et,o)}function isAsyncIterable$3(o){return o[Symbol.asyncIterator]!=null}function first(o){if(isAsyncIterable$3(o))return(async()=>{for await(const et of o)return et})();for(const et of o)return et}const PING_LENGTH$1=32,PROTOCOL_VERSION$1="1.0.0",PROTOCOL_NAME$1="ping",PROTOCOL_PREFIX$1="ipfs",TIMEOUT=1e4,MAX_INBOUND_STREAMS=2,MAX_OUTBOUND_STREAMS=1;var $l;$l=Symbol.toStringTag;class PingService{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"started");Ct(this,"timeout");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"runOnLimitedConnection");Ct(this,"log");Ct(this,$l,"@libp2p/ping");this.components=et,this.log=et.logger.forComponent("libp2p:ping"),this.started=!1,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX$1}/${PROTOCOL_NAME$1}/${PROTOCOL_VERSION$1}`,this.timeout=tt.timeout??TIMEOUT,this.maxInboundStreams=tt.maxInboundStreams??MAX_INBOUND_STREAMS,this.maxOutboundStreams=tt.maxOutboundStreams??MAX_OUTBOUND_STREAMS,this.runOnLimitedConnection=tt.runOnLimitedConnection??!0,this.handleMessage=this.handleMessage.bind(this)}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(et){this.log("incoming ping from %p",et.connection.remotePeer);const{stream:tt}=et,nt=Date.now();AbortSignal.timeout(this.timeout).addEventListener("abort",()=>{tt==null||tt.abort(new TimeoutError$3("ping timeout"))}),pipe(tt,async function*(ot){let it=0;for await(const st of ot){if(it+=st.byteLength,it>PING_LENGTH$1){tt==null||tt.abort(new InvalidMessageError$3("Too much data received"));return}yield st}},tt).catch(ot=>{this.log.error("incoming ping from %p failed with error",et.connection.remotePeer,ot),tt==null||tt.abort(ot)}).finally(()=>{const ot=Date.now()-nt;this.log("incoming ping from %p complete in %dms",et.connection.remotePeer,ot)})}async ping(et,tt={}){var at,ct;this.log("pinging %p",et);const nt=Date.now(),rt=randomBytes(PING_LENGTH$1),ot=await this.components.connectionManager.openConnection(et,tt);let it,st=()=>{};if(tt.signal==null){const lt=AbortSignal.timeout(this.timeout);tt={...tt,signal:lt}}try{it=await ot.newStream(this.protocol,{...tt,runOnLimitedConnection:this.runOnLimitedConnection}),st=()=>{it==null||it.abort(new AbortError$9)},(at=tt.signal)==null||at.addEventListener("abort",st,{once:!0});const lt=await pipe([rt],it,async ht=>first(ht)),dt=Date.now()-nt;if(lt==null)throw new ProtocolError$2(`Did not receive a ping ack after ${dt}ms`);if(!equals(rt,lt.subarray()))throw new ProtocolError$2(`Received wrong ping ack after ${dt}ms`);return this.log("ping %p complete in %dms",ot.remotePeer,dt),dt}catch(lt){throw this.log.error("error while pinging %p",ot.remotePeer,lt),it==null||it.abort(lt),lt}finally{(ct=tt.signal)==null||ct.removeEventListener("abort",st),it!=null&&await it.close()}}}function ping(o={}){return et=>new PingService(et,o)}const transportSymbol=Symbol.for("@libp2p/transport");var FaultTolerance$1;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance$1||(FaultTolerance$1={}));var bs;let AbortError$5=(bs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(bs,"name","AbortError"),bs);class ConnectionFailedError extends Error{constructor(et="Connection failed"){super(et),this.name="ConnectionFailedError"}}Ct(ConnectionFailedError,"name","ConnectionFailedError");const serviceCapabilities$1=Symbol.for("@libp2p/service-capabilities"),ASSUME_HTTP_CODES=[getProtocol("tcp").code,getProtocol("dns").code,getProtocol("dnsaddr").code,getProtocol("dns4").code,getProtocol("dns6").code];function extractSNI(o){var et;return(et=extractTuple("sni",o))==null?void 0:et[1]}function extractPort(o){var tt;const et=(tt=extractTuple("tcp",o))==null?void 0:tt[1];return et==null?"":`:${et}`}function extractTuple(o,et){let tt;try{tt=getProtocol(o).code}catch{return}for(const[nt,rt]of et)if(nt===tt&&rt!=null)return[nt,rt]}function hasTLS(o){return o.some(([et,tt])=>et===getProtocol("tls").code)}function interpretNext(o,et,tt){const nt=interpreters[getProtocol(o).name];if(nt==null)throw new Error(`Can't interpret protocol ${getProtocol(o).name}`);const rt=nt(et,tt);return o===getProtocol("ip6").code?`[${rt}]`:rt}const interpreters={ip4:(o,et)=>o,ip6:(o,et)=>et.length===0?o:`[${o}]`,tcp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`tcp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},udp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`udp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},dnsaddr:(o,et)=>o,dns4:(o,et)=>o,dns6:(o,et)=>o,dns:(o,et)=>o,ipfs:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/ipfs/${o}`},p2p:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p/${o}`},http:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`https://${nt}${rt}`;const ot=tt?"https://":"http://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},"http-path":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");const nt=interpretNext(tt[0],tt[1]??"",et),rt=decodeURIComponent(o);return`${nt}/${rt}`},tls:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},sni:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},https:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`https://${nt}`},ws:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`wss://${nt}${rt}`;const ot=tt?"wss://":"ws://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},wss:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`wss://${nt}`},"p2p-websocket-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-websocket-star`},"p2p-webrtc-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-star`},"p2p-webrtc-direct":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-direct`}};function multiaddrToUri(o,et){const nt=multiaddr(o).stringTuples(),rt=nt.pop();if(rt==null)throw new Error("Unexpected end of multiaddr");const ot=getProtocol(rt[0]),it=interpreters[ot.name];if(it==null)throw new Error(`No interpreter found for ${ot.name}`);let st=it(rt[1]??"",nt);return ASSUME_HTTP_CODES.includes(rt[0])&&(st=st.replace(/^.*:\/\//,""),rt[1]==="443"?st=`https://${st}`:st=`http://${st}`),(st.startsWith("http://")||st.startsWith("https://")||st.startsWith("ws://")||st.startsWith("wss://"))&&(st=new URL(st).toString(),st.endsWith("/")&&(st=st.substring(0,st.length-1))),st}const ready=async o=>{if(o.readyState>=2)throw new Error("socket closed");o.readyState!==1&&await new Promise((et,tt)=>{function nt(){o.removeEventListener("open",rt),o.removeEventListener("error",ot)}function rt(){nt(),et()}function ot(it){nt(),tt(it.error??new Error(`connect ECONNREFUSED ${o.url}`))}o.addEventListener("open",rt),o.addEventListener("error",ot)})},sink=(o,et)=>(et=et??{},et.closeOnEnd=et.closeOnEnd!==!1,async nt=>{for await(const rt of nt){try{await ready(o)}catch(ot){if(ot.message==="socket closed")break;throw ot}if(o.readyState===o.CLOSING||o.readyState===o.CLOSED)break;o.send(rt)}et.closeOnEnd!=null&&o.readyState<=1&&await new Promise((rt,ot)=>{o.addEventListener("close",it=>{if(it.wasClean||it.code===1006)rt();else{const st=Object.assign(new Error("ws error"),{event:it});ot(st)}}),setTimeout(()=>{o.close()})})});var dom={},eventIterator={};Object.defineProperty(eventIterator,"__esModule",{value:!0});class EventQueue{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(et){if(this.isStopped)return;const tt={value:et,done:!1};if(this.pullQueue.length){const nt=this.pullQueue.shift();nt&&nt.resolve(tt)}else this.pushQueue.push(Promise.resolve(tt)),this.highWaterMark!==void 0&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const et of this.pullQueue)et.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(et){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const tt of this.pullQueue)tt.reject(et);this.pullQueue.length=0}else{const tt=Promise.reject(et);tt.catch(()=>{}),this.pushQueue.push(tt)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:et=>{const tt=this.pushQueue.shift();return tt?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),tt):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((nt,rt)=>{this.pullQueue.push({resolve:nt,reject:rt})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}let EventIterator$1=class{constructor(et,{highWaterMark:tt=100,lowWaterMark:nt=1}={}){const rt=new EventQueue;rt.highWaterMark=tt,rt.lowWaterMark=nt,rt.removeCallback=et({push:ot=>rt.push(ot),stop:()=>rt.stop(),fail:ot=>rt.fail(ot),on:(ot,it)=>{rt.eventHandlers[ot]=it}})||(()=>{}),this[Symbol.asyncIterator]=()=>rt[Symbol.asyncIterator](),Object.freeze(this)}};eventIterator.EventIterator=EventIterator$1;eventIterator.default=EventIterator$1;Object.defineProperty(dom,"__esModule",{value:!0});const event_iterator_1=eventIterator;var EventIterator=dom.EventIterator=event_iterator_1.EventIterator;function subscribe(o,et,tt){return new event_iterator_1.EventIterator(({push:nt})=>(this.addEventListener(o,nt,et),()=>this.removeEventListener(o,nt,et)),tt)}dom.subscribe=subscribe;dom.default=event_iterator_1.EventIterator;function isArrayBuffer(o){var et;return o instanceof ArrayBuffer||((et=o==null?void 0:o.constructor)==null?void 0:et.name)==="ArrayBuffer"&&typeof(o==null?void 0:o.byteLength)=="number"}const source=o=>{o.binaryType="arraybuffer";const et=async()=>{await new Promise((ot,it)=>{if(nt){ot();return}if(rt!=null){it(rt);return}const st=lt=>{o.removeEventListener("open",at),o.removeEventListener("error",ct),lt()},at=()=>{st(ot)},ct=lt=>{st(()=>{it(lt.error??new Error(`connect ECONNREFUSED ${o.url}`))})};o.addEventListener("open",at),o.addEventListener("error",ct)})},tt=async function*(){const ot=new EventIterator(({push:it,stop:st,fail:at})=>{const ct=dt=>{let ht=null;typeof dt.data=="string"&&(ht=fromString(dt.data)),isArrayBuffer(dt.data)&&(ht=new Uint8Array(dt.data)),dt.data instanceof Uint8Array&&(ht=dt.data),ht!=null&&it(ht)},lt=dt=>{at(dt.error??new Error("Socket error"))};return o.addEventListener("message",ct),o.addEventListener("error",lt),o.addEventListener("close",st),()=>{o.removeEventListener("message",ct),o.removeEventListener("error",lt),o.removeEventListener("close",st)}},{highWaterMark:1/0});await et();for await(const it of ot)yield isArrayBuffer(it)?new Uint8Array(it):it}();let nt=o.readyState===1,rt;return o.addEventListener("open",()=>{nt=!0,rt=null}),o.addEventListener("close",()=>{nt=!1,rt=null}),o.addEventListener("error",ot=>{nt||(rt=ot.error??new Error(`connect ECONNREFUSED ${o.url}`))}),Object.assign(tt,{connected:et})},duplex=(o,et)=>{et=et??{};const tt=source(o);let nt=et.remoteAddress,rt=et.remotePort;if(o.url!=null)try{const it=new URL(o.url);nt=it.hostname,rt=parseInt(it.port,10)}catch{}if(nt==null||rt==null)throw new Error("Remote connection did not have address and/or port");return{sink:sink(o,et),source:tt,connected:async()=>{await tt.connected()},close:async()=>{(o.readyState===o.CONNECTING||o.readyState===o.OPEN)&&await new Promise(it=>{o.addEventListener("close",()=>{it()}),o.close()})},destroy:()=>{o.terminate!=null?o.terminate():o.close()},remoteAddress:nt,remotePort:rt,socket:o}},WebSocket$1=WebSocket,map={"http:":"ws:","https:":"wss:"},defaultProtocol="ws:",wsurl=(o,et)=>{if(o.startsWith("//")&&(o=`${(et==null?void 0:et.protocol)??defaultProtocol}${o}`),o.startsWith("/")&&et!=null){const nt=et.protocol??defaultProtocol,rt=et.host,ot=et.port!=null&&(rt==null?void 0:rt.endsWith(`:${et.port}`))!==!0?`:${et.port}`:"";o=`${nt}//${rt}${ot}${o}`}const tt=new URL(o);for(const[nt,rt]of Object.entries(map))tt.protocol===nt&&(tt.protocol=rt);return tt};function connect(o,et){const tt=typeof window>"u"?void 0:window.location;et=et??{};const nt=wsurl(o,tt),rt=new WebSocket$1(nt.toString(),et.websocket);return duplex(rt,et)}class CustomProgressEvent extends Event{constructor(tt,nt){super(tt);Ct(this,"type");Ct(this,"detail");this.type=tt,this.detail=nt}}function all$1(o){return o.filter(et=>WebSocketsSecure.exactMatch(et)||WebSockets$1.exactMatch(et))}function wss(o){return o.filter(et=>WebSocketsSecure.exactMatch(et))}function createListener(){throw new Error("WebSocket Servers can not be created in the browser!")}const CLOSE_TIMEOUT$1=500;function socketToMaConn(o,et,tt){const nt=tt.logger.forComponent("libp2p:websockets:maconn"),rt=tt.metrics,ot=tt.metricPrefix??"",it={log:nt,async sink(st){try{await o.sink(async function*(){for await(const at of st)at instanceof Uint8Array?yield at:yield at.subarray()}())}catch(at){at.type!=="aborted"&&nt.error(at)}},source:o.source,remoteAddr:et,timeline:{open:Date.now()},async close(st={}){var lt,dt;const at=Date.now();if(st.signal==null){const ht=AbortSignal.timeout(CLOSE_TIMEOUT$1);st={...st,signal:ht}}const ct=()=>{const{host:ht,port:ft}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s after %dms, destroying it manually",ht,ft,Date.now()-at),this.abort(new AbortError$5("Socket close timeout"))};(lt=st.signal)==null||lt.addEventListener("abort",ct);try{await o.close()}catch(ht){nt.error("error closing WebSocket gracefully",ht),this.abort(ht)}finally{(dt=st.signal)==null||dt.removeEventListener("abort",ct),it.timeline.close=Date.now()}},abort(st){const{host:at,port:ct}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s due to error",at,ct,st),o.destroy(),it.timeline.close=Date.now(),rt==null||rt.increment({[`${ot}error`]:!0})}};return o.socket.addEventListener("close",()=>{rt==null||rt.increment({[`${ot}close`]:!0}),it.timeline.close==null&&(it.timeline.close=Date.now())},{once:!0}),it}var Pl,Ll,Nl;Nl=transportSymbol,Ll=Symbol.toStringTag,Pl=serviceCapabilities$1;class WebSockets{constructor(et,tt){Ct(this,"log");Ct(this,"init");Ct(this,"logger");Ct(this,"metrics");Ct(this,"components");Ct(this,Nl,!0);Ct(this,Ll,"@libp2p/websockets");Ct(this,Pl,["@libp2p/transport"]);this.log=et.logger.forComponent("libp2p:websockets"),this.logger=et.logger,this.components=et,this.init=tt,et.metrics!=null&&(this.metrics={dialerEvents:et.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}async dial(et,tt){var it;this.log("dialing %s",et),tt=tt??{};const nt=await this._connect(et,tt),rt=socketToMaConn(nt,et,{logger:this.logger,metrics:(it=this.metrics)==null?void 0:it.dialerEvents});this.log("new outbound connection %s",rt.remoteAddr);const ot=await tt.upgrader.upgradeOutbound(rt,tt);return this.log("outbound connection %s upgraded",rt.remoteAddr),ot}async _connect(et,tt){var it,st,at,ct,lt;(it=tt==null?void 0:tt.signal)==null||it.throwIfAborted();const nt=et.toOptions();this.log("dialing %s:%s",nt.host,nt.port);const rt=pDefer(),ot=connect(multiaddrToUri(et),this.init);ot.socket.addEventListener("error",()=>{var ht;const dt=new ConnectionFailedError(`Could not connect to ${et.toString()}`);this.log.error("connection error:",dt),(ht=this.metrics)==null||ht.dialerEvents.increment({error:!0}),rt.reject(dt)});try{(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("websockets:open-connection")),await raceSignal(Promise.race([ot.connected(),rt.promise]),tt.signal)}catch(dt){throw((at=tt.signal)==null?void 0:at.aborted)===!0&&((ct=this.metrics)==null||ct.dialerEvents.increment({abort:!0})),ot.close().catch(ht=>{this.log.error("error closing raw socket",ht)}),dt}return this.log("connected %s",et),(lt=this.metrics)==null||lt.dialerEvents.increment({connect:!0}),ot}createListener(et){return createListener({logger:this.logger,metrics:this.components.metrics},{...this.init,...et})}listenFilter(et){var tt,nt;return et=Array.isArray(et)?et:[et],((tt=this.init)==null?void 0:tt.filter)!=null?(nt=this.init)==null?void 0:nt.filter(et):isBrowser||isWebWorker?wss(et):all$1(et)}dialFilter(et){return this.listenFilter(et)}}function webSockets(o={}){return et=>new WebSockets(et,o)}const connectionSymbol=Symbol.for("@libp2p/connection"),contentRoutingSymbol=Symbol.for("@libp2p/content-routing"),peerDiscoverySymbol=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$1=Symbol.for("@libp2p/peer-id");function isPeerId$1(o){return!!(o!=null&&o[peerIdSymbol$1])}const peerRoutingSymbol=Symbol.for("@libp2p/peer-routing"),KEEP_ALIVE="keep-alive";var FaultTolerance;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance||(FaultTolerance={}));var Es;let AbortError$4=(Es=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(Es,"name","AbortError"),Es);var ws;let InvalidParametersError$1=(ws=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ws,"name","InvalidParametersError"),ws);class ConnectionClosingError extends Error{constructor(et="The connection is closing"){super(et),this.name="ConnectionClosingError"}}Ct(ConnectionClosingError,"name","ConnectionClosingError");class ConnectionClosedError extends Error{constructor(et="The connection is closed"){super(et),this.name="ConnectionClosedError"}}Ct(ConnectionClosedError,"name","ConnectionClosedError");var Cs;let NotFoundError$1=(Cs=class extends Error{constructor(et="Not found"){super(et),this.name="NotFoundError"}},Ct(Cs,"name","NotFoundError"),Cs);class InvalidPeerIdError extends Error{constructor(et="Invalid PeerID"){super(et),this.name="InvalidPeerIdError"}}Ct(InvalidPeerIdError,"name","InvalidPeerIdError");class InvalidMultiaddrError extends Error{constructor(et="Invalid multiaddr"){super(et),this.name="InvalidMultiaddrError"}}Ct(InvalidMultiaddrError,"name","InvalidMultiaddrError");var Ss;let TimeoutError$2=(Ss=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(Ss,"name","TimeoutError"),Ss);class NotStartedError extends Error{constructor(et="Not started"){super(et),this.name="NotStartedError"}}Ct(NotStartedError,"name","NotStartedError");class DialError extends Error{constructor(et="Dial error"){super(et),this.name="DialError"}}Ct(DialError,"name","DialError");class LimitedConnectionError extends Error{constructor(et="Limited connection"){super(et),this.name="LimitedConnectionError"}}Ct(LimitedConnectionError,"name","LimitedConnectionError");class TooManyInboundProtocolStreamsError extends Error{constructor(et="Too many inbound protocol streams"){super(et),this.name="TooManyInboundProtocolStreamsError"}}Ct(TooManyInboundProtocolStreamsError,"name","TooManyInboundProtocolStreamsError");class TooManyOutboundProtocolStreamsError extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}}Ct(TooManyOutboundProtocolStreamsError,"name","TooManyOutboundProtocolStreamsError");function setMaxListeners$1(){}const setMaxListeners=(o,...et)=>{try{[...et]}catch{}};var Xn;class TypedEventEmitter extends EventTarget{constructor(){super();pn(this,Xn,new Map);setMaxListeners(1/0,this)}listenerCount(tt){const nt=jt(this,Xn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=jt(this,Xn).get(tt);ot==null&&(ot=[],jt(this,Xn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=jt(this,Xn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),jt(this,Xn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=jt(this,Xn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),jt(this,Xn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}}Xn=new WeakMap;function isStartable(o){return o!=null&&typeof o.start=="function"&&typeof o.stop=="function"}async function start(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStart!=null&&await tt.beforeStart()})),await Promise.all(et.map(async tt=>{await tt.start()})),await Promise.all(et.map(async tt=>{tt.afterStart!=null&&await tt.afterStart()}))}async function stop(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStop!=null&&await tt.beforeStop()})),await Promise.all(et.map(async tt=>{await tt.stop()})),await Promise.all(et.map(async tt=>{tt.afterStop!=null&&await tt.afterStop()}))}const serviceCapabilities=Symbol.for("@libp2p/service-capabilities"),serviceDependencies=Symbol.for("@libp2p/service-dependencies");let TimeoutError$1=class extends Error{constructor(et){super(et),this.name="TimeoutError"}},AbortError$3=class extends Error{constructor(et){super(),this.name="AbortError",this.message=et}};const getDOMException=o=>globalThis.DOMException===void 0?new AbortError$3(o):new DOMException(o),getAbortedReason=o=>{const et=o.reason===void 0?getDOMException("This operation was aborted."):o.reason;return et instanceof Error?et:getDOMException(et)};function pTimeout(o,et){const{milliseconds:tt,fallback:nt,message:rt,customTimers:ot={setTimeout,clearTimeout}}=et;let it;const at=new Promise((ct,lt)=>{if(typeof tt!="number"||Math.sign(tt)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${tt}\``);if(et.signal){const{signal:ht}=et;ht.aborted&<(getAbortedReason(ht));const ft=()=>{lt(getAbortedReason(ht))};ht.addEventListener("abort",ft,{once:!0}),o.finally(()=>{ht.removeEventListener("abort",ft)})}if(tt===Number.POSITIVE_INFINITY){o.then(ct,lt);return}const dt=new TimeoutError$1;it=ot.setTimeout.call(void 0,()=>{if(nt){try{ct(nt())}catch(ht){lt(ht)}return}typeof o.cancel=="function"&&o.cancel(),rt===!1?ct():rt instanceof Error?lt(rt):(dt.message=rt??`Promise timed out after ${tt} milliseconds`,lt(dt))},tt),(async()=>{try{ct(await o)}catch(ht){lt(ht)}})()}).finally(()=>{at.clear()});return at.clear=()=>{ot.clearTimeout.call(void 0,it),it=void 0},at}function lowerBound(o,et,tt){let nt=0,rt=o.length;for(;rt>0;){const ot=Math.trunc(rt/2);let it=nt+ot;tt(o[it],et)<=0?(nt=++it,rt-=ot+1):rt=ot}return nt}var Jn,Ol;let PriorityQueue$1=(Ol=class{constructor(){pn(this,Jn,[])}enqueue(et,tt){tt={priority:0,...tt};const nt={priority:tt.priority,run:et};if(this.size&&jt(this,Jn)[this.size-1].priority>=tt.priority){jt(this,Jn).push(nt);return}const rt=lowerBound(jt(this,Jn),nt,(ot,it)=>it.priority-ot.priority);jt(this,Jn).splice(rt,0,nt)}dequeue(){const et=jt(this,Jn).shift();return et==null?void 0:et.run}filter(et){return jt(this,Jn).filter(tt=>tt.priority===et.priority).map(tt=>tt.run)}get size(){return jt(this,Jn).length}},Jn=new WeakMap,Ol);var Qr,Yr,vr,co,Zr,lo,zn,Xr,Dn,uo,Vn,Jr,ir,ho,Tn,tu,nu,ru,ou,iu,Xo,Bs,Ds,Jo,su,_i;class PQueue extends EventEmitter$1{constructor(tt){var nt,rt;super();pn(this,Tn);pn(this,Qr);pn(this,Yr);pn(this,vr,0);pn(this,co);pn(this,Zr);pn(this,lo,0);pn(this,zn);pn(this,Xr);pn(this,Dn);pn(this,uo);pn(this,Vn,0);pn(this,Jr);pn(this,ir);pn(this,ho);Ct(this,"timeout");if(tt={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:PriorityQueue$1,...tt},!(typeof tt.intervalCap=="number"&&tt.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((nt=tt.intervalCap)==null?void 0:nt.toString())??""}\` (${typeof tt.intervalCap})`);if(tt.interval===void 0||!(Number.isFinite(tt.interval)&&tt.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((rt=tt.interval)==null?void 0:rt.toString())??""}\` (${typeof tt.interval})`);un(this,Qr,tt.carryoverConcurrencyCount),un(this,Yr,tt.intervalCap===Number.POSITIVE_INFINITY||tt.interval===0),un(this,co,tt.intervalCap),un(this,Zr,tt.interval),un(this,Dn,new tt.queueClass),un(this,uo,tt.queueClass),this.concurrency=tt.concurrency,this.timeout=tt.timeout,un(this,ho,tt.throwOnTimeout===!0),un(this,ir,tt.autoStart===!1)}get concurrency(){return jt(this,Jr)}set concurrency(tt){if(!(typeof tt=="number"&&tt>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${tt}\` (${typeof tt})`);un(this,Jr,tt),gn(this,Tn,Jo).call(this)}async add(tt,nt={}){return nt={timeout:this.timeout,throwOnTimeout:jt(this,ho),...nt},new Promise((rt,ot)=>{jt(this,Dn).enqueue(async()=>{var it;br(this,Vn)._++,br(this,vr)._++;try{(it=nt.signal)==null||it.throwIfAborted();let st=tt({signal:nt.signal});nt.timeout&&(st=pTimeout(Promise.resolve(st),{milliseconds:nt.timeout})),nt.signal&&(st=Promise.race([st,gn(this,Tn,su).call(this,nt.signal)]));const at=await st;rt(at),this.emit("completed",at)}catch(st){if(st instanceof TimeoutError$1&&!nt.throwOnTimeout){rt();return}ot(st),this.emit("error",st)}finally{gn(this,Tn,ru).call(this)}},nt),this.emit("add"),gn(this,Tn,Xo).call(this)})}async addAll(tt,nt){return Promise.all(tt.map(async rt=>this.add(rt,nt)))}start(){return jt(this,ir)?(un(this,ir,!1),gn(this,Tn,Jo).call(this),this):this}pause(){un(this,ir,!0)}clear(){un(this,Dn,new(jt(this,uo)))}async onEmpty(){jt(this,Dn).size!==0&&await gn(this,Tn,_i).call(this,"empty")}async onSizeLessThan(tt){jt(this,Dn).sizejt(this,Dn).size{gn(this,Tn,ou).call(this)},nt)),!0}return!1},Xo=function(){if(jt(this,Dn).size===0)return jt(this,zn)&&clearInterval(jt(this,zn)),un(this,zn,void 0),this.emit("empty"),jt(this,Vn)===0&&this.emit("idle"),!1;if(!jt(this,ir)){const tt=!jt(this,Tn,iu);if(jt(this,Tn,tu)&&jt(this,Tn,nu)){const nt=jt(this,Dn).dequeue();return nt?(this.emit("active"),nt(),tt&&gn(this,Tn,Bs).call(this),!0):!1}}return!1},Bs=function(){jt(this,Yr)||jt(this,zn)!==void 0||(un(this,zn,setInterval(()=>{gn(this,Tn,Ds).call(this)},jt(this,Zr))),un(this,lo,Date.now()+jt(this,Zr)))},Ds=function(){jt(this,vr)===0&&jt(this,Vn)===0&&jt(this,zn)&&(clearInterval(jt(this,zn)),un(this,zn,void 0)),un(this,vr,jt(this,Qr)?jt(this,Vn):0),gn(this,Tn,Jo).call(this)},Jo=function(){for(;gn(this,Tn,Xo).call(this););},su=async function(tt){return new Promise((nt,rt)=>{tt.addEventListener("abort",()=>{rt(tt.reason)},{once:!0})})},_i=async function(tt,nt){return new Promise(rt=>{const ot=()=>{nt&&!nt()||(this.off(tt,ot),rt())};this.on(tt,ot)})};function getTypes(o){const et=[RecordType.A];return o==null?et:Array.isArray(o)?o.length===0?et:o:[o]}const DEFAULT_TTL=60;function toDNSResponse(o){return{Status:o.Status??0,TC:o.TC??o.flag_tc??!1,RD:o.RD??o.flag_rd??!1,RA:o.RA??o.flag_ra??!1,AD:o.AD??o.flag_ad??!1,CD:o.CD??o.flag_cd??!1,Question:(o.Question??o.questions??[]).map(et=>({name:et.name,type:RecordType[et.type]})),Answer:(o.Answer??o.answers??[]).map(et=>({name:et.name,type:RecordType[et.type],TTL:et.TTL??et.ttl??DEFAULT_TTL,data:et.data instanceof Uint8Array?toString$8(et.data):et.data}))}}const DEFAULT_QUERY_CONCURRENCY=4;function dnsJsonOverHttps(o,et={}){const tt=new PQueue({concurrency:et.queryConcurrency??DEFAULT_QUERY_CONCURRENCY});return async(nt,rt={})=>{var st;const ot=new URLSearchParams;ot.set("name",nt),getTypes(rt.types).forEach(at=>{ot.append("type",RecordType[at])}),(st=rt.onProgress)==null||st.call(rt,new CustomProgressEvent("dns:query",{detail:nt}));const it=await tt.add(async()=>{var lt;const at=await fetch(`${o}?${ot}`,{headers:{accept:"application/dns-json"},signal:rt==null?void 0:rt.signal});if(at.status!==200)throw new Error(`Unexpected HTTP status: ${at.status} - ${at.statusText}`);const ct=toDNSResponse(await at.json());return(lt=rt.onProgress)==null||lt.call(rt,new CustomProgressEvent("dns:response",{detail:ct})),ct},{signal:rt.signal});if(it==null)throw new Error("No DNS response received");return it}}function defaultResolver(){return[dnsJsonOverHttps("https://cloudflare-dns.com/dns-query"),dnsJsonOverHttps("https://dns.google/resolve")]}var hashlru=function(o){if(!o)throw Error("hashlru must have a max value, of type number, greater than 0");var et=0,tt=Object.create(null),nt=Object.create(null);function rt(ot,it){tt[ot]=it,et++,et>=o&&(et=0,nt=tt,tt=Object.create(null))}return{has:function(ot){return tt[ot]!==void 0||nt[ot]!==void 0},remove:function(ot){tt[ot]!==void 0&&(tt[ot]=void 0),nt[ot]!==void 0&&(nt[ot]=void 0)},get:function(ot){var it=tt[ot];if(it!==void 0)return it;if((it=nt[ot])!==void 0)return rt(ot,it),it},set:function(ot,it){tt[ot]!==void 0?tt[ot]=it:rt(ot,it)},clear:function(){tt=Object.create(null),nt=Object.create(null)}}};const hashlru$1=getDefaultExportFromCjs(hashlru);class CachedAnswers{constructor(et){Ct(this,"lru");this.lru=hashlru$1(et)}get(et,tt){let nt=!0;const rt=[];for(const ot of tt){const it=this.getAnswers(et,ot);if(it.length===0){nt=!1;break}rt.push(...it)}if(nt)return toDNSResponse({answers:rt})}getAnswers(et,tt){const nt=`${et.toLowerCase()}-${tt}`,rt=this.lru.get(nt);if(rt!=null){const ot=rt.filter(it=>it.expires>Date.now()).map(({expires:it,value:st})=>({...st,TTL:Math.round((it-Date.now())/1e3),type:RecordType[st.type]}));return ot.length===0&&this.lru.remove(nt),ot}return[]}add(et,tt){const nt=`${et.toLowerCase()}-${tt.type}`,rt=this.lru.get(nt)??[];rt.push({expires:Date.now()+(tt.TTL??DEFAULT_TTL)*1e3,value:tt}),this.lru.set(nt,rt)}remove(et,tt){const nt=`${et.toLowerCase()}-${tt}`;this.lru.remove(nt)}clear(){this.lru.clear()}}function cache(o){return new CachedAnswers(o)}const DEFAULT_ANSWER_CACHE_SIZE=1e3;class DNS{constructor(et){Ct(this,"resolvers");Ct(this,"cache");this.resolvers={},this.cache=cache(et.cacheSize??DEFAULT_ANSWER_CACHE_SIZE),Object.entries(et.resolvers??{}).forEach(([tt,nt])=>{Array.isArray(nt)||(nt=[nt]),tt.endsWith(".")||(tt=`${tt}.`),this.resolvers[tt]=nt}),this.resolvers["."]==null&&(this.resolvers["."]=defaultResolver())}async query(et,tt={}){var at,ct,lt;const nt=getTypes(tt.types),rt=tt.cached!==!1?this.cache.get(et,nt):void 0;if(rt!=null)return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dns:cache",{detail:rt})),rt;const ot=`${et.split(".").pop()}.`,it=(this.resolvers[ot]??this.resolvers["."]).sort(()=>Math.random()>.5?-1:1),st=[];for(const dt of it){if(((ct=tt.signal)==null?void 0:ct.aborted)===!0)break;try{const ht=await dt(et,{...tt,types:nt});for(const ft of ht.Answer)this.cache.add(et,ft);return ht}catch(ht){st.push(ht),(lt=tt.onProgress)==null||lt.call(tt,new CustomProgressEvent("dns:error",{detail:ht}))}}throw st.length===1?st[0]:new AggregateError(st,`DNS lookup of ${et} ${nt} failed`)}}var RecordType;(function(o){o[o.A=1]="A",o[o.CNAME=5]="CNAME",o[o.TXT=16]="TXT",o[o.AAAA=28]="AAAA"})(RecordType||(RecordType={}));function dns(o={}){return new DNS(o)}const MAX_RECURSIVE_DEPTH=32,{code:dnsaddrCode}=getProtocol("dnsaddr");class RecursionLimitError extends Error{constructor(et="Max recursive depth reached"){super(et),this.name="RecursionLimitError"}}const dnsaddrResolver=async function(et,tt={}){const nt=tt.maxRecursiveDepth??MAX_RECURSIVE_DEPTH;if(nt===0)throw new RecursionLimitError("Max recursive depth reached");const[,rt]=et.stringTuples().find(([ct])=>ct===dnsaddrCode)??[],it=await((tt==null?void 0:tt.dns)??dns()).query(`_dnsaddr.${rt}`,{signal:tt==null?void 0:tt.signal,types:[RecordType.TXT]}),st=et.getPeerId(),at=[];for(const ct of it.Answer){const lt=ct.data.replace(/["']/g,"").trim().split("=")[1];if(lt==null||st!=null&&!lt.includes(st))continue;const dt=multiaddr(lt);if(lt.startsWith("/dnsaddr")){const ht=await dt.resolve({...tt,maxRecursiveDepth:nt-1});at.push(...ht.map(ft=>ft.toString()))}else at.push(dt.toString())}return at};var isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const et=Object.getPrototypeOf(o);return et===null||et===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty:hasOwnProperty$1}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty$1=(o,et,tt)=>Object.defineProperty(o,et,{value:tt,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const et=[];for(const tt in o)hasOwnProperty$1.call(o,tt)&&et.push(tt);if(Object.getOwnPropertySymbols){const tt=Object.getOwnPropertySymbols(o);for(const nt of tt)propertyIsEnumerable.call(o,nt)&&et.push(nt)}return et};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const et=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}function cloneOptionObject(o){const et=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}const mergeKeys=(o,et,tt,nt)=>(tt.forEach(rt=>{typeof et[rt]>"u"&&nt.ignoreUndefined||(rt in o&&o[rt]!==Object.getPrototypeOf(o)?defineProperty$1(o,rt,merge$1(o[rt],et[rt],nt)):defineProperty$1(o,rt,clone(et[rt])))}),o),concatArrays=(o,et,tt)=>{let nt=o.slice(0,0),rt=0;return[o,et].forEach(ot=>{const it=[];for(let st=0;st!it.includes(st)),tt)}),nt};function merge$1(o,et,tt){return tt.concatArrays&&Array.isArray(o)&&Array.isArray(et)?concatArrays(o,et,tt):!isOptionObject(et)||!isOptionObject(o)?clone(et):mergeKeys(o,et,getEnumerableOwnPropertyKeys(et),tt)}var mergeOptions=function(...o){const et=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let tt={_:{}};for(const nt of o)if(nt!==void 0){if(!isOptionObject(nt))throw new TypeError("`"+nt+"` is not an Option Object");tt=merge$1(tt,{_:nt},et)}return tt._};const mergeOptions$1=getDefaultExportFromCjs(mergeOptions);var define_globalThis_process_env_default$1={};const DefaultConfig={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:o=>o},connectionManager:{resolvers:{dnsaddr:dnsaddrResolver}},transportManager:{faultTolerance:FaultTolerance.FATAL_ALL}};async function validateConfig(o){const et=mergeOptions$1(DefaultConfig,o);if(et.connectionProtector===null&&(define_globalThis_process_env_default$1==null?void 0:define_globalThis_process_env_default$1.LIBP2P_FORCE_PNET)!=null)throw new InvalidParametersError$1("Private network is enforced, but no protector was provided");return et}const s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;function ms(o,et){try{if(typeof o=="string"&&o.length>0)return parse$3(o);if(typeof o=="number"&&isFinite(o))return et!=null&&et.long?fmtLong(o):fmtShort(o);throw new Error("Value is not a string or number.")}catch(tt){const nt=isError$1(tt)?`${tt.message}. value=${JSON.stringify(o)}`:"An unknown error has occured.";throw new Error(nt)}}function parse$3(o){if(o=String(o),o.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const et=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!et)return NaN;const tt=parseFloat(et[1]),nt=(et[2]||"ms").toLowerCase();switch(nt){case"years":case"year":case"yrs":case"yr":case"y":return tt*y;case"weeks":case"week":case"w":return tt*w;case"days":case"day":case"d":return tt*d;case"hours":case"hour":case"hrs":case"hr":case"h":return tt*h;case"minutes":case"minute":case"mins":case"min":case"m":return tt*m;case"seconds":case"second":case"secs":case"sec":case"s":return tt*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return tt;default:throw new Error(`The unit ${nt} was matched, but no matching case exists.`)}}function fmtShort(o){const et=Math.abs(o);return et>=d?`${Math.round(o/d)}d`:et>=h?`${Math.round(o/h)}h`:et>=m?`${Math.round(o/m)}m`:et>=s?`${Math.round(o/s)}s`:`${o}ms`}function fmtLong(o){const et=Math.abs(o);return et>=d?plural(o,et,d,"day"):et>=h?plural(o,et,h,"hour"):et>=m?plural(o,et,m,"minute"):et>=s?plural(o,et,s,"second"):`${o} ms`}function plural(o,et,tt,nt){const rt=et>=tt*1.5;return`${Math.round(o/tt)} ${nt}${rt?"s":""}`}function isError$1(o){return typeof o=="object"&&o!==null&&"message"in o}function setup(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=ms,tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),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=nt,pt.destroy=tt.destroy,Object.defineProperty(pt,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(ft!==tt.namespaces&&(ft=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(pt),pt}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),ft=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=31||typeof navigator<"u"&&((rt=navigator.userAgent)==null?void 0:rt.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+ms(this.diff),!this.useColors)return;const et="color: "+this.color;o.splice(1,0,et,"color: inherit");let tt=0,nt=0;o[0].replace(/%[a-zA-Z%]/g,rt=>{rt!=="%%"&&(tt++,rt==="%c"&&(nt=tt))}),o.splice(nt,0,et)}const log$a=console.debug??console.log??(()=>{});function save(o){try{o?storage==null||storage.setItem("debug",o):storage==null||storage.removeItem("debug")}catch{}}function load$1(){let o;try{o=storage==null?void 0:storage.getItem("debug")}catch{}return!o&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(o=define_globalThis_process_env_default.DEBUG),o}function localstorage(){try{return localStorage}catch{}}function setupFormatters(o){o.j=function(et){try{return JSON.stringify(et)}catch(tt){return"[UnexpectedJSONParseError]: "+tt.message}}}const weald=setup({formatArgs,save,load:load$1,useColors,setupFormatters,colors,storage,log:log$a});weald.formatters.b=o=>o==null?"undefined":base58btc.baseEncode(o);weald.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);weald.formatters.m=o=>o==null?"undefined":base64$2.baseEncode(o);weald.formatters.p=o=>o==null?"undefined":o.toString();weald.formatters.c=o=>o==null?"undefined":o.toString();weald.formatters.k=o=>o==null?"undefined":o.toString();weald.formatters.a=o=>o==null?"undefined":o.toString();weald.formatters.e=o=>o==null?"undefined":notEmpty(o.stack)??notEmpty(o.message)??o.toString();function createDisabledLogger(o){const et=()=>{};return et.enabled=!1,et.color="",et.diff=0,et.log=()=>{},et.namespace=o,et.destroy=()=>!0,et.extend=()=>et,et}function defaultLogger(){return{forComponent(o){return logger$2(o)}}}function logger$2(o){let et=createDisabledLogger(`${o}:trace`);return weald.enabled(`${o}:trace`)&&weald.names.map(tt=>tt.toString()).find(tt=>tt.includes(":trace"))!=null&&(et=weald(`${o}:trace`)),Object.assign(weald(o),{error:weald(`${o}:error`),trace:et})}function notEmpty(o){if(o!=null&&(o=o.trim(),o.length!==0))return o}function mapIterable(o,et){const tt={[Symbol.iterator]:()=>tt,next:()=>{const nt=o.next(),rt=nt.value;return nt.done===!0||rt==null?{done:!0,value:void 0}:{done:!1,value:et(rt)}}};return tt}function peerIdFromString(o){const et=decode$6(base58btc.decode(`z${o}`));return peerIdFromMultihash(et)}class PeerMap{constructor(et){Ct(this,"map");if(this.map=new Map,et!=null)for(const[tt,nt]of et.entries())this.map.set(tt.toString(),{key:tt,value:nt})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(et){return this.map.delete(et.toString())}entries(){return mapIterable(this.map.entries(),et=>[et[1].key,et[1].value])}forEach(et){this.map.forEach((tt,nt)=>{et(tt.value,tt.key,this)})}get(et){var tt;return(tt=this.map.get(et.toString()))==null?void 0:tt.value}has(et){return this.map.has(et.toString())}set(et,tt){this.map.set(et.toString(),{key:et,value:tt})}keys(){return mapIterable(this.map.values(),et=>et.key)}values(){return mapIterable(this.map.values(),et=>et.value)}get size(){return this.map.size}}class PeerSet{constructor(et){Ct(this,"set");if(this.set=new Set,et!=null)for(const tt of et)this.set.add(tt.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(et){this.set.add(et.toString())}clear(){this.set.clear()}delete(et){this.set.delete(et.toString())}entries(){return mapIterable(this.set.entries(),et=>{const tt=peerIdFromString(et[0]);return[tt,tt]})}forEach(et){this.set.forEach(tt=>{const nt=peerIdFromString(tt);et(nt,nt,this)})}has(et){return this.set.has(et.toString())}values(){return mapIterable(this.set.values(),et=>peerIdFromString(et))}intersection(et){const tt=new PeerSet;for(const nt of et)this.has(nt)&&tt.add(nt);return tt}difference(et){const tt=new PeerSet;for(const nt of this)et.has(nt)||tt.add(nt);return tt}union(et){const tt=new PeerSet;for(const nt of et)tt.add(nt);for(const nt of this)tt.add(nt);return tt}}var murmurHash3js={exports:{}};(function(o,et){(function(tt,nt){var rt={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function ot(pt){if(!Array.isArray(pt)&&!ArrayBuffer.isView(pt))return!1;for(var yt=0;yt255)return!1;return!0}function it(pt,yt){return(pt&65535)*yt+(((pt>>>16)*yt&65535)<<16)}function st(pt,yt){return pt<>>32-yt}function at(pt){return pt^=pt>>>16,pt=it(pt,2246822507),pt^=pt>>>13,pt=it(pt,3266489909),pt^=pt>>>16,pt}function ct(pt,yt){pt=[pt[0]>>>16,pt[0]&65535,pt[1]>>>16,pt[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=pt[3]+yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=pt[2]+yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=pt[1]+yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=pt[0]+yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function lt(pt,yt){pt=[pt[0]>>>16,pt[0]&65535,pt[1]>>>16,pt[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=pt[3]*yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=pt[2]*yt[3],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[2]+=pt[3]*yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=pt[1]*yt[3],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=pt[2]*yt[2],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=pt[3]*yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=pt[0]*yt[3]+pt[1]*yt[2]+pt[2]*yt[1]+pt[3]*yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function dt(pt,yt){return yt%=64,yt===32?[pt[1],pt[0]]:yt<32?[pt[0]<>>32-yt,pt[1]<>>32-yt]:(yt-=32,[pt[1]<>>32-yt,pt[0]<>>32-yt])}function ht(pt,yt){return yt%=64,yt===0?pt:yt<32?[pt[0]<>>32-yt,pt[1]<>>1]),pt=lt(pt,[4283543511,3981806797]),pt=ft(pt,[0,pt[0]>>>1]),pt=lt(pt,[3301882366,444984403]),pt=ft(pt,[0,pt[0]>>>1]),pt}rt.x86.hash32=function(pt,yt){if(rt.inputValidation&&!ot(pt))return nt;yt=yt||0;for(var gt=pt.length%4,xt=pt.length-gt,vt=yt,bt=0,Et=3432918353,wt=461845907,kt=0;kt>>0},rt.x86.hash128=function(pt,yt){if(rt.inputValidation&&!ot(pt))return nt;yt=yt||0;for(var gt=pt.length%16,xt=pt.length-gt,vt=yt,bt=yt,Et=yt,wt=yt,kt=0,It=0,Rt=0,$t=0,Nt=597399067,Mt=2869860233,Bt=951274213,zt=2716044179,Ft=0;Ft>>0).toString(16)).slice(-8)+("00000000"+(bt>>>0).toString(16)).slice(-8)+("00000000"+(Et>>>0).toString(16)).slice(-8)+("00000000"+(wt>>>0).toString(16)).slice(-8)},rt.x64.hash128=function(pt,yt){if(rt.inputValidation&&!ot(pt))return nt;yt=yt||0;for(var gt=pt.length%16,xt=pt.length-gt,vt=[0,yt],bt=[0,yt],Et=[0,0],wt=[0,0],kt=[2277735313,289559509],It=[1291169091,658871167],Rt=0;Rt>>0).toString(16)).slice(-8)+("00000000"+(vt[1]>>>0).toString(16)).slice(-8)+("00000000"+(bt[0]>>>0).toString(16)).slice(-8)+("00000000"+(bt[1]>>>0).toString(16)).slice(-8)},o.exports&&(et=o.exports=rt),et.murmurHash3=rt})()})(murmurHash3js,murmurHash3js.exports);const MAX_FINGERPRINT_SIZE=64;class Fingerprint{constructor(et,tt,nt,rt=2){Ct(this,"fp");Ct(this,"h");Ct(this,"seed");if(rt>MAX_FINGERPRINT_SIZE)throw new TypeError("Invalid Fingerprint Size");const ot=tt.hashV(et,nt),it=alloc$2(rt);for(let st=0;stet.equals(tt))}add(et){if(!(et instanceof Fingerprint))throw new TypeError("Invalid Fingerprint");for(let tt=0;ttet.equals(nt));return tt>-1?(this.contents[tt]=null,!0):!1}}const FNV_PRIMES={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},FNV_OFFSETS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},cachedEncoder=new globalThis.TextEncoder;function fnv1aUint8Array(o,et){const tt=FNV_PRIMES[et];let nt=FNV_OFFSETS[et];for(let rt=0;rt0;){const it=cachedEncoder.encodeInto(ot,tt);ot=ot.slice(it.read);for(let st=0;stNumber(fnv1a$1(o,{size:32})),hashV:(o,et)=>numberToBuffer(fnv1a.hash(o,et))};function numberToBuffer(o){let et=o.toString(16);return et.length%2===1&&(et=`0${et}`),fromString(et,"base16")}const maxCuckooCount=500;class CuckooFilter{constructor(et){Ct(this,"bucketSize");Ct(this,"filterSize");Ct(this,"fingerprintSize");Ct(this,"buckets");Ct(this,"count");Ct(this,"hash");Ct(this,"seed");this.filterSize=et.filterSize,this.bucketSize=et.bucketSize??4,this.fingerprintSize=et.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10))}add(et){typeof et=="string"&&(et=fromString(et));const tt=new Fingerprint(et,this.hash,this.seed,this.fingerprintSize),nt=this.hash.hash(et,this.seed)%this.filterSize,rt=(nt^tt.hash())%this.filterSize;if(this.buckets[nt]==null&&(this.buckets[nt]=new Bucket(this.bucketSize)),this.buckets[rt]==null&&(this.buckets[rt]=new Bucket(this.bucketSize)),this.buckets[nt].add(tt)||this.buckets[rt].add(tt))return this.count++,!0;const ot=[nt,rt];let it=ot[getRandomInt(0,ot.length-1)];this.buckets[it]==null&&(this.buckets[it]=new Bucket(this.bucketSize));for(let st=0;st.002?2:o>1e-5?4:8}function optimize(o,et=.001){const tt=calculateBucketSize(et),nt=MAX_LOAD[tt],rt=Math.round(o/nt),ot=Math.min(Math.ceil(Math.log2(1/et)+Math.log2(2*tt)),MAX_FINGERPRINT_SIZE);return{filterSize:rt,bucketSize:tt,fingerprintSize:ot}}class ScalableCuckooFilter{constructor(et){Ct(this,"filterSize");Ct(this,"bucketSize");Ct(this,"fingerprintSize");Ct(this,"scale");Ct(this,"filterSeries");Ct(this,"hash");Ct(this,"seed");this.bucketSize=et.bucketSize??4,this.filterSize=et.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=et.fingerprintSize??2,this.scale=et.scale??2,this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10)),this.filterSeries=[new CuckooFilter({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(et){if(typeof et=="string"&&(et=fromString(et)),this.has(et))return!0;let tt=this.filterSeries.find(nt=>nt.reliable);if(tt==null){const nt=this.filterSize*Math.pow(this.scale,this.filterSeries.length);tt=new CuckooFilter({filterSize:nt,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(tt)}return tt.add(et)}has(et){typeof et=="string"&&(et=fromString(et));for(let tt=0;ttet+tt.count,0)}}function createScalableCuckooFilter(o,et=.001,tt){return new ScalableCuckooFilter({...optimize(o,et)})}const peerIdSymbol=Symbol.for("@libp2p/peer-id");function isPeerId(o){return!!(o!=null&&o[peerIdSymbol])}class InvalidParametersError extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}}Ct(InvalidParametersError,"name","InvalidParametersError");const events={},observable=o=>{o.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)}),o.port!=null&&o.port.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)})};observable.addEventListener=(o,et)=>{events[o]==null&&(events[o]=[]),events[o].push(et)};observable.removeEventListener=(o,et)=>{events[o]!=null&&(events[o]=events[o].filter(tt=>tt===et))};observable.dispatchEvent=function(o,et,tt){events[o]!=null&&events[o].forEach(nt=>nt(et,tt))};const WORKER_REQUEST_READ_LOCK="lock:worker:request-read",WORKER_RELEASE_READ_LOCK="lock:worker:release-read",MASTER_GRANT_READ_LOCK="lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK="lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK="lock:worker:release-write",MASTER_GRANT_WRITE_LOCK="lock:master:grant-write",nanoid=(o=21)=>Math.random().toString().substring(2),handleWorkerLockRequest=(o,et,tt,nt,rt)=>(ot,it)=>{if(it.data.type!==tt)return;const st={type:it.data.type,name:it.data.name,identifier:it.data.identifier};o.dispatchEvent(new MessageEvent(et,{data:{name:st.name,handler:async()=>{ot.postMessage({type:rt,name:st.name,identifier:st.identifier}),await new Promise(at=>{const ct=lt=>{if((lt==null?void 0:lt.data)==null)return;const dt={type:lt.data.type,name:lt.data.name,identifier:lt.data.identifier};dt.type===nt&&dt.identifier===st.identifier&&(ot.removeEventListener("message",ct),at())};ot.addEventListener("message",ct)})}}}))},makeWorkerLockRequest=(o,et,tt,nt)=>async()=>{const rt=nanoid();return globalThis.postMessage({type:et,identifier:rt,name:o}),new Promise(ot=>{const it=st=>{if((st==null?void 0:st.data)==null)return;const at={type:st.data.type,identifier:st.data.identifier};at.type===tt&&at.identifier===rt&&(globalThis.removeEventListener("message",it),ot(()=>{globalThis.postMessage({type:nt,identifier:rt,name:o})}))};globalThis.addEventListener("message",it)})},defaultOptions$4={singleProcess:!1},impl=o=>{if(o=Object.assign({},defaultOptions$4,o),!!globalThis.document||o.singleProcess){const tt=new EventTarget;return observable.addEventListener("message",handleWorkerLockRequest(tt,"requestReadLock",WORKER_REQUEST_READ_LOCK,WORKER_RELEASE_READ_LOCK,MASTER_GRANT_READ_LOCK)),observable.addEventListener("message",handleWorkerLockRequest(tt,"requestWriteLock",WORKER_REQUEST_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK)),tt}return{isWorker:!0,readLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_READ_LOCK,MASTER_GRANT_READ_LOCK,WORKER_RELEASE_READ_LOCK),writeLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK)}},mutexes={};let implementation;async function createReleaseable(o,et){let tt;const nt=new Promise(rt=>{tt=rt});return o.add(async()=>pTimeout((async()=>{await new Promise(rt=>{tt(()=>{rt()})})})(),{milliseconds:et.timeout})),nt}const createMutex=(o,et)=>{if(implementation.isWorker===!0)return{readLock:implementation.readLock(o,et),writeLock:implementation.writeLock(o,et)};const tt=new PQueue({concurrency:1});let nt;return{async readLock(){if(nt!=null)return createReleaseable(nt,et);nt=new PQueue({concurrency:et.concurrency,autoStart:!1});const rt=nt,ot=createReleaseable(nt,et);return tt.add(async()=>{rt.start(),await rt.onIdle().then(()=>{nt===rt&&(nt=null)})}),ot},async writeLock(){return nt=null,createReleaseable(tt,et)}}},defaultOptions$3={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function createMortice(o){const et=Object.assign({},defaultOptions$3,o);return implementation==null&&(implementation=impl(et),implementation.isWorker!==!0&&(implementation.addEventListener("requestReadLock",tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].readLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}),implementation.addEventListener("requestWriteLock",async tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].writeLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}))),mutexes[et.name]==null&&(mutexes[et.name]=createMutex(et.name,et)),mutexes[et.name]}var Peer;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&rt.value.byteLength>0&&(ot.uint32(18),ot.bytes(rt.value)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={key:"",value:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.Peer$metadataEntry||(o.Peer$metadataEntry={})),function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&(ot.uint32(18),Tag.codec().encode(rt.value,ot)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={key:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=Tag.codec().decode(rt,rt.uint32(),{limits:(ct=it.limits)==null?void 0:ct.value});break}default:{rt.skipType(lt&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)}(o.Peer$tagsEntry||(o.Peer$tagsEntry={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(10),Address.codec().encode(ot,nt);if(tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(18),nt.string(ot);if(tt.publicKey!=null&&(nt.uint32(34),nt.bytes(tt.publicKey)),tt.peerRecordEnvelope!=null&&(nt.uint32(42),nt.bytes(tt.peerRecordEnvelope)),tt.metadata!=null&&tt.metadata.size!==0)for(const[ot,it]of tt.metadata.entries())nt.uint32(50),o.Peer$metadataEntry.codec().encode({key:ot,value:it},nt);if(tt.tags!=null&&tt.tags.size!==0)for(const[ot,it]of tt.tags.entries())nt.uint32(58),o.Peer$tagsEntry.codec().encode({key:ot,value:it},nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at,ct,lt,dt,ht;const ot={addresses:[],protocols:[],metadata:new Map,tags:new Map},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(Address.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}case 2:{if(((ct=rt.limits)==null?void 0:ct.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 4:{ot.publicKey=tt.bytes();break}case 5:{ot.peerRecordEnvelope=tt.bytes();break}case 6:{if(((lt=rt.limits)==null?void 0:lt.metadata)!=null&&ot.metadata.size===rt.limits.metadata)throw new MaxSizeError('Decode error - map field "metadata" had too many elements');const mt=o.Peer$metadataEntry.codec().decode(tt,tt.uint32());ot.metadata.set(mt.key,mt.value);break}case 7:{if(((dt=rt.limits)==null?void 0:dt.tags)!=null&&ot.tags.size===rt.limits.tags)throw new MaxSizeError('Decode error - map field "tags" had too many elements');const mt=o.Peer$tagsEntry.codec().decode(tt,tt.uint32(),{limits:{value:(ht=rt.limits)==null?void 0:ht.tags$value}});ot.tags.set(mt.key,mt.value);break}default:{tt.skipType(ft&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Peer||(Peer={}));var Address;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.multiaddr!=null&&tt.multiaddr.byteLength>0&&(nt.uint32(10),nt.bytes(tt.multiaddr)),tt.isCertified!=null&&(nt.uint32(16),nt.bool(tt.isCertified)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={multiaddr:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.multiaddr=tt.bytes();break}case 2:{ot.isCertified=tt.bool();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Address||(Address={}));var Tag;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.value!=null&&tt.value!==0&&(nt.uint32(8),nt.uint32(tt.value)),tt.expiry!=null&&(nt.uint32(16),nt.uint64(tt.expiry)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={value:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.value=tt.uint32();break}case 2:{ot.expiry=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Tag||(Tag={}));function bytesToPeer(o,et){const tt=Peer.decode(et);if(tt.publicKey!=null&&o.publicKey==null){const ot=publicKeyFromProtobuf(tt.publicKey);o=peerIdFromPublicKey(ot)}const nt=new Map,rt=BigInt(Date.now());for(const[ot,it]of tt.tags.entries())it.expiry!=null&&it.expiry({multiaddr:multiaddr(ot),isCertified:it??!1})),metadata:tt.metadata,peerRecordEnvelope:tt.peerRecordEnvelope??void 0,tags:nt}}const pathSepS="/",pathSepB=new TextEncoder().encode(pathSepS),pathSep=pathSepB[0];class Key{constructor(et,tt){Ct(this,"_buf");if(typeof et=="string")this._buf=fromString(et);else if(et instanceof Uint8Array)this._buf=et;else throw new Error("Invalid key, should be String of Uint8Array");if(tt==null&&(tt=!0),tt&&this.clean(),this._buf.byteLength===0||this._buf[0]!==pathSep)throw new Error("Invalid key")}toString(et="utf8"){return toString$8(this._buf,et)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(et){return new Key(et.join(pathSepS))}static random(){return new Key(Math.random().toString().substring(2))}static asKey(et){return et instanceof Uint8Array||typeof et=="string"?new Key(et):typeof et.uint8Array=="function"?new Key(et.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=pathSepB),this._buf[0]!==pathSep){const et=new Uint8Array(this._buf.byteLength+1);et.fill(pathSep,0,1),et.set(this._buf,1),this._buf=et}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===pathSep;)this._buf=this._buf.subarray(0,-1)}less(et){const tt=this.list(),nt=et.list();for(let rt=0;rtit)return!1}return tt.lengthtt.namespaces()))])}}function namespaceType(o){const et=o.split(":");return et.length<2?"":et.slice(0,-1).join(":")}function namespaceValue(o){const et=o.split(":");return et[et.length-1]}function flatten(o){return[].concat(...o)}const NAMESPACE_COMMON="/peers/";function peerIdToDatastoreKey(o){if(!isPeerId(o)||o.type==null)throw new InvalidParametersError("Invalid PeerId");const et=o.toCID().toString();return new Key(`${NAMESPACE_COMMON}${et}`)}async function dedupeFilterAndSortAddresses(o,et,tt){const nt=new Map;for(const rt of tt){if(rt==null)continue;if(rt.multiaddr instanceof Uint8Array&&(rt.multiaddr=multiaddr(rt.multiaddr)),!isMultiaddr(rt.multiaddr))throw new InvalidParametersError("Multiaddr was invalid");if(!await et(o,rt.multiaddr))continue;const ot=rt.isCertified??!1,it=rt.multiaddr.toString(),st=nt.get(it);st!=null?rt.isCertified=st.isCertified||ot:nt.set(it,{multiaddr:rt.multiaddr,isCertified:ot})}return[...nt.values()].sort((rt,ot)=>rt.multiaddr.toString().localeCompare(ot.multiaddr.toString())).map(({isCertified:rt,multiaddr:ot})=>({isCertified:rt,multiaddr:ot.bytes}))}async function toPeerPB(o,et,tt,nt){if(et==null)throw new InvalidParametersError("Invalid PeerData");if(et.publicKey!=null&&o.publicKey!=null&&!et.publicKey.equals(o.publicKey))throw new InvalidParametersError("publicKey bytes do not match peer id publicKey bytes");const rt=nt.existingPeer;if(rt!=null&&!o.equals(rt.id))throw new InvalidParametersError("peer id did not match existing peer id");let ot=(rt==null?void 0:rt.addresses)??[],it=new Set((rt==null?void 0:rt.protocols)??[]),st=(rt==null?void 0:rt.metadata)??new Map,at=(rt==null?void 0:rt.tags)??new Map,ct=rt==null?void 0:rt.peerRecordEnvelope;if(tt==="patch"){if((et.multiaddrs!=null||et.addresses!=null)&&(ot=[],et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses)),et.protocols!=null&&(it=new Set(et.protocols)),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);st=createSortedMap(ht,{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags);at=createSortedMap(ht,{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}if(tt==="merge"){if(et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses),et.protocols!=null&&(it=new Set([...it,...et.protocols])),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);for(const[ft,mt]of ht)mt==null?st.delete(ft):st.set(ft,mt);st=createSortedMap([...st.entries()],{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags),ft=new Map(at);for(const[mt,pt]of ht)pt==null?ft.delete(mt):ft.set(mt,pt);at=createSortedMap([...ft.entries()],{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}let lt;(rt==null?void 0:rt.id.publicKey)!=null?lt=publicKeyToProtobuf(rt.id.publicKey):et.publicKey!=null?lt=publicKeyToProtobuf(et.publicKey):o.publicKey!=null&&(lt=publicKeyToProtobuf(o.publicKey));const dt={addresses:await dedupeFilterAndSortAddresses(o,nt.addressFilter??(async()=>!0),ot),protocols:[...it.values()].sort((ht,ft)=>ht.localeCompare(ft)),metadata:st,tags:at,publicKey:lt,peerRecordEnvelope:ct};return o.type!=="RSA"&&delete dt.publicKey,dt}function createSortedMap(o,et){var nt;const tt=new Map;for(const[rt,ot]of o)ot!=null&&et.validate(rt,ot);for(const[rt,ot]of o.sort(([it],[st])=>it.localeCompare(st)))ot!=null&&tt.set(rt,((nt=et.map)==null?void 0:nt.call(et,rt,ot))??ot);return tt}function validateMetadata(o,et){if(typeof o!="string")throw new InvalidParametersError("Metadata key must be a string");if(!(et instanceof Uint8Array))throw new InvalidParametersError("Metadata value must be a Uint8Array")}function validateTag(o,et){if(typeof o!="string")throw new InvalidParametersError("Tag name must be a string");if(et.value!=null){if(parseInt(`${et.value}`,10)!==et.value)throw new InvalidParametersError("Tag value must be an integer");if(et.value<0||et.value>100)throw new InvalidParametersError("Tag value must be between 0-100")}if(et.ttl!=null){if(parseInt(`${et.ttl}`,10)!==et.ttl)throw new InvalidParametersError("Tag ttl must be an integer");if(et.ttl<0)throw new InvalidParametersError("Tag ttl must be between greater than 0")}}function mapTag(o,et){let tt;return et.expiry!=null&&(tt=et.expiry),et.ttl!=null&&(tt=BigInt(Date.now()+Number(et.ttl))),{value:et.value??0,expiry:tt}}function decodePeer(o,et){const tt=o.toString().split("/")[2],nt=CID.parse(tt,base32$2),rt=peerIdFromCID(nt);return bytesToPeer(rt,et)}function mapQuery(o){return o==null?{}:{prefix:NAMESPACE_COMMON,filters:(o.filters??[]).map(et=>({key:tt,value:nt})=>et(decodePeer(tt,nt))),orders:(o.orders??[]).map(et=>(tt,nt)=>et(decodePeer(tt.key,tt.value),decodePeer(nt.key,nt.value)))}}var er,es,ts;class PersistentStore{constructor(et,tt={}){pn(this,er);Ct(this,"peerId");Ct(this,"datastore");Ct(this,"lock");Ct(this,"addressFilter");this.peerId=et.peerId,this.datastore=et.datastore,this.addressFilter=tt.addressFilter,this.lock=createMortice({name:"peer-store",singleProcess:!0})}async has(et){return this.datastore.has(peerIdToDatastoreKey(et))}async delete(et){if(this.peerId.equals(et))throw new InvalidParametersError("Cannot delete self peer");await this.datastore.delete(peerIdToDatastoreKey(et))}async load(et){const tt=await this.datastore.get(peerIdToDatastoreKey(et));return bytesToPeer(et,tt)}async save(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter});return gn(this,er,ts).call(this,et,ot,nt,rt)}async patch(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async merge(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"merge",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async*all(et){for await(const{key:tt,value:nt}of this.datastore.query(mapQuery(et??{}))){const rt=decodePeer(tt,nt);rt.id.equals(this.peerId)||(yield rt)}}}er=new WeakSet,es=async function(et){try{const tt=await this.datastore.get(peerIdToDatastoreKey(et)),nt=bytesToPeer(et,tt);return{existingBuf:tt,existingPeer:nt}}catch(tt){if(tt.name!=="NotFoundError")throw tt}return{}},ts=async function(et,tt,nt,rt){const ot=Peer.encode(tt);return nt!=null&&equals(ot,nt)?{peer:bytesToPeer(et,ot),previous:rt,updated:!1}:(await this.datastore.put(peerIdToDatastoreKey(et),ot),{peer:bytesToPeer(et,ot),previous:rt,updated:!0})};var Ml,eo,ns;Ml=Symbol.toStringTag;class PersistentPeerStore{constructor(et,tt={}){pn(this,eo);Ct(this,"store");Ct(this,"events");Ct(this,"peerId");Ct(this,"log");Ct(this,Ml,"@libp2p/peer-store");this.log=et.logger.forComponent("libp2p:peer-store"),this.events=et.events,this.peerId=et.peerId,this.store=new PersistentStore(et,tt)}async forEach(et,tt){this.log.trace("forEach await read lock");const nt=await this.store.lock.readLock();this.log.trace("forEach got read lock");try{for await(const rt of this.store.all(tt))et(rt)}finally{this.log.trace("forEach release read lock"),nt()}}async all(et){this.log.trace("all await read lock");const tt=await this.store.lock.readLock();this.log.trace("all got read lock");try{return await all$2(this.store.all(et))}finally{this.log.trace("all release read lock"),tt()}}async delete(et){this.log.trace("delete await write lock");const tt=await this.store.lock.writeLock();this.log.trace("delete got write lock");try{await this.store.delete(et)}finally{this.log.trace("delete release write lock"),tt()}}async has(et){this.log.trace("has await read lock");const tt=await this.store.lock.readLock();this.log.trace("has got read lock");try{return await this.store.has(et)}finally{this.log.trace("has release read lock"),tt()}}async get(et){this.log.trace("get await read lock");const tt=await this.store.lock.readLock();this.log.trace("get got read lock");try{return await this.store.load(et)}finally{this.log.trace("get release read lock"),tt()}}async save(et,tt){this.log.trace("save await write lock");const nt=await this.store.lock.writeLock();this.log.trace("save got write lock");try{const rt=await this.store.save(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("save release write lock"),nt()}}async patch(et,tt){this.log.trace("patch await write lock");const nt=await this.store.lock.writeLock();this.log.trace("patch got write lock");try{const rt=await this.store.patch(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("patch release write lock"),nt()}}async merge(et,tt){this.log.trace("merge await write lock");const nt=await this.store.lock.writeLock();this.log.trace("merge got write lock");try{const rt=await this.store.merge(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("merge release write lock"),nt()}}async consumePeerRecord(et,tt){const nt=await RecordEnvelope.openAndCertify(et,PeerRecord.DOMAIN),rt=peerIdFromCID(nt.publicKey.toCID());if((tt==null?void 0:tt.equals(rt))===!1)return this.log("envelope peer id was not the expected peer id - expected: %p received: %p",tt,rt),!1;const ot=PeerRecord.createFromProtobuf(nt.payload);let it;try{it=await this.get(rt)}catch(st){if(st.name!=="NotFoundError")throw st}if((it==null?void 0:it.peerRecordEnvelope)!=null){const st=await RecordEnvelope.createFromProtobuf(it.peerRecordEnvelope),at=PeerRecord.createFromProtobuf(st.payload);if(at.seqNumber>=ot.seqNumber)return this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",at.seqNumber,ot.seqNumber),!1}return await this.patch(ot.peerId,{peerRecordEnvelope:et,addresses:ot.multiaddrs.map(st=>({isCertified:!0,multiaddr:st}))}),!0}}eo=new WeakSet,ns=function(et,tt){tt.updated&&(this.peerId.equals(et)?this.events.safeDispatchEvent("self:peer:update",{detail:tt}):this.events.safeDispatchEvent("peer:update",{detail:tt}))};function persistentPeerStore(o,et={}){return new PersistentPeerStore(o,et)}const Nr=class Nr extends Error{constructor(tt="Not Found"){super(tt);Ct(this,"name",Nr.name);Ct(this,"code",Nr.code)}};Ct(Nr,"name","NotFoundError"),Ct(Nr,"code","ERR_NOT_FOUND");let NotFoundError=Nr;function peekable(o){const[et,tt]=o[Symbol.asyncIterator]!=null?[o[Symbol.asyncIterator](),Symbol.asyncIterator]:[o[Symbol.iterator](),Symbol.iterator],nt=[];return{peek:()=>et.next(),push:rt=>{nt.push(rt)},next:()=>nt.length>0?{done:!1,value:nt.shift()}:et.next(),[tt](){return this}}}function isAsyncIterable$2(o){return o[Symbol.asyncIterator]!=null}function filter(o,et){let tt=0;if(isAsyncIterable$2(o))return async function*(){for await(const at of o)await et(at,tt++)&&(yield at)}();const nt=peekable(o),{value:rt,done:ot}=nt.next();if(ot===!0)return function*(){}();const it=et(rt,tt++);if(typeof it.then=="function")return async function*(){await it&&(yield rt);for await(const at of nt)await et(at,tt++)&&(yield at)}();const st=et;return function*(){it===!0&&(yield rt);for(const at of nt)st(at,tt++)&&(yield at)}()}function isAsyncIterable$1(o){return o[Symbol.asyncIterator]!=null}function sort(o,et){return isAsyncIterable$1(o)?async function*(){yield*(await all$2(o)).sort(et)}():function*(){yield*all$2(o).sort(et)}()}function isAsyncIterable(o){return o[Symbol.asyncIterator]!=null}function take(o,et){return isAsyncIterable(o)?async function*(){let tt=0;if(!(et<1)){for await(const nt of o)if(yield nt,tt++,tt===et)return}}():function*(){let tt=0;if(!(et<1)){for(const nt of o)if(yield nt,tt++,tt===et)return}}()}class BaseDatastore{put(et,tt,nt){return Promise.reject(new Error(".put is not implemented"))}get(et,tt){return Promise.reject(new Error(".get is not implemented"))}has(et,tt){return Promise.reject(new Error(".has is not implemented"))}delete(et,tt){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(et,tt={}){for await(const{key:nt,value:rt}of et)await this.put(nt,rt,tt),yield nt}async*getMany(et,tt={}){for await(const nt of et)yield{key:nt,value:await this.get(nt,tt)}}async*deleteMany(et,tt={}){for await(const nt of et)await this.delete(nt,tt),yield nt}batch(){let et=[],tt=[];return{put(nt,rt){et.push({key:nt,value:rt})},delete(nt){tt.push(nt)},commit:async nt=>{await drain(this.putMany(et,nt)),et=[],await drain(this.deleteMany(tt,nt)),tt=[]}}}async*_all(et,tt){throw new Error("._all is not implemented")}async*_allKeys(et,tt){throw new Error("._allKeys is not implemented")}query(et,tt){let nt=this._all(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.key.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){let rt=0;const ot=et.offset;nt=filter(nt,()=>rt++>=ot)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}queryKeys(et,tt){let nt=this._allKeys(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){const rt=et.offset;let ot=0;nt=filter(nt,()=>ot++>=rt)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}}class MemoryDatastore extends BaseDatastore{constructor(){super();Ct(this,"data");this.data=new Map}put(tt,nt){return this.data.set(tt.toString(),nt),tt}get(tt){const nt=this.data.get(tt.toString());if(nt==null)throw new NotFoundError;return nt}has(tt){return this.data.has(tt.toString())}delete(tt){this.data.delete(tt.toString())}*_all(){for(const[tt,nt]of this.data.entries())yield{key:new Key(tt),value:nt}}*_allKeys(){for(const tt of this.data.keys())yield new Key(tt)}}function debounce(o,et){let tt;return function(){const nt=function(){tt=void 0,o()};clearTimeout(tt),tt=setTimeout(nt,et)}}const defaultAddressFilter=o=>o;function stripPeerId(o,et){const tt=o.getPeerId();return tt!=null&&peerIdFromString$1(tt).equals(et)&&(o=o.decapsulate(multiaddr(`/p2p/${et.toString()}`))),o}var Bl;Bl=Symbol.toStringTag;class DefaultAddressManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"listen");Ct(this,"announce");Ct(this,"observed");Ct(this,"announceFilter");Ct(this,Bl,"@libp2p/address-manager");const{listen:nt=[],announce:rt=[]}=tt;this.components=et,this.log=et.logger.forComponent("libp2p:address-manager"),this.listen=nt.map(ot=>ot.toString()),this.announce=new Set(rt.map(ot=>ot.toString())),this.observed=new Map,this.announceFilter=tt.announceFilter??defaultAddressFilter,this._updatePeerStoreAddresses=debounce(this._updatePeerStoreAddresses.bind(this),1e3),et.events.addEventListener("transport:listening",()=>{this._updatePeerStoreAddresses()}),et.events.addEventListener("transport:close",()=>{this._updatePeerStoreAddresses()})}_updatePeerStoreAddresses(){const et=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter(([tt,nt])=>nt.confident).map(([tt])=>multiaddr(tt))).map(tt=>tt.getPeerId()===this.components.peerId.toString()?tt.decapsulate(`/p2p/${this.components.peerId.toString()}`):tt);this.components.peerStore.patch(this.components.peerId,{multiaddrs:et}).catch(tt=>{this.log.error("error updating addresses",tt)})}getListenAddrs(){return Array.from(this.listen).map(et=>multiaddr(et))}getAnnounceAddrs(){return Array.from(this.announce).map(et=>multiaddr(et))}getObservedAddrs(){return Array.from(this.observed).map(([et])=>multiaddr(et))}addObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.has(tt)||this.observed.set(tt,{confident:!1})}confirmObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString(),rt=(this.observed.get(tt)??{confident:!1}).confident;this.observed.set(tt,{confident:!0}),rt||this._updatePeerStoreAddresses()}removeObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.delete(tt)}getAddresses(){let et=this.getAnnounceAddrs().map(nt=>nt.toString());et.length===0&&(et=this.components.transportManager.getAddrs().map(nt=>nt.toString())),et=et.concat(Array.from(this.observed).filter(([nt,rt])=>rt.confident).map(([nt])=>nt));const tt=new Set(et);return this.announceFilter(Array.from(tt).map(nt=>multiaddr(nt))).map(nt=>{var rt;return((rt=nt.protos().pop())==null?void 0:rt.path)===!0||nt.getPeerId()===this.components.peerId.toString()?nt:nt.encapsulate(`/p2p/${this.components.peerId.toString()}`)})}}var messages;(function(o){o.NOT_STARTED_YET="The libp2p node is not started yet",o.NOT_FOUND="Not found"})(messages||(messages={}));class MissingServiceError extends Error{constructor(et="Missing service"){super(et),this.name="MissingServiceError"}}class UnmetServiceDependenciesError extends Error{constructor(et="Unmet service dependencies"){super(et),this.name="UnmetServiceDependenciesError"}}class NoContentRoutersError extends Error{constructor(et="No content routers available"){super(et),this.name="NoContentRoutersError"}}class NoPeerRoutersError extends Error{constructor(et="No peer routers available"){super(et),this.name="NoPeerRoutersError"}}class QueriedForSelfError extends Error{constructor(et="Should not try to find self"){super(et),this.name="QueriedForSelfError"}}class UnhandledProtocolError extends Error{constructor(et="Unhandled protocol error"){super(et),this.name="UnhandledProtocolError"}}class DuplicateProtocolHandlerError extends Error{constructor(et="Duplicate protocol handler error"){super(et),this.name="DuplicateProtocolHandlerError"}}class DialDeniedError extends Error{constructor(et="Dial denied error"){super(et),this.name="DialDeniedError"}}class NoValidAddressesError extends Error{constructor(et="No valid addresses"){super(et),this.name="NoValidAddressesError"}}class ConnectionInterceptedError extends Error{constructor(et="Connection intercepted"){super(et),this.name="ConnectionInterceptedError"}}class ConnectionDeniedError extends Error{constructor(et="Connection denied"){super(et),this.name="ConnectionDeniedError"}}class MuxerUnavailableError extends Error{constructor(et="Stream is not multiplexed"){super(et),this.name="MuxerUnavailableError"}}class EncryptionFailedError extends Error{constructor(et="Encryption failed"){super(et),this.name="EncryptionFailedError"}}class TransportUnavailableError extends Error{constructor(et="Transport unavailable"){super(et),this.name="TransportUnavailableError"}}class DefaultComponents{constructor(et={}){Ct(this,"components",{});Ct(this,"_started",!1);this.components={};for(const[tt,nt]of Object.entries(et))this.components[tt]=nt;this.components.logger==null&&(this.components.logger=defaultLogger())}isStarted(){return this._started}async _invokeStartableMethod(et){await Promise.all(Object.values(this.components).filter(tt=>isStartable(tt)).map(async tt=>{var nt;await((nt=tt[et])==null?void 0:nt.call(tt))}))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}const OPTIONAL_SERVICES=["metrics","connectionProtector","dns"],NON_SERVICE_PROPERTIES=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];function defaultComponents(o={}){const et=new DefaultComponents(o);return new Proxy(et,{get(nt,rt,ot){if(typeof rt=="string"&&!NON_SERVICE_PROPERTIES.includes(rt)){const it=et.components[rt];if(it==null&&!OPTIONAL_SERVICES.includes(rt))throw new MissingServiceError(`${rt} not set`);return it}return Reflect.get(nt,rt,ot)},set(nt,rt,ot){return typeof rt=="string"?et.components[rt]=ot:Reflect.set(nt,rt,ot),!0}})}function checkServiceDependencies(o){const et={};for(const tt of Object.values(o.components))for(const nt of getServiceCapabilities(tt))et[nt]=!0;for(const tt of Object.values(o.components))for(const nt of getServiceDependencies(tt))if(et[nt]!==!0)throw new UnmetServiceDependenciesError(`Service "${getServiceName(tt)}" required capability "${nt}" but it was not provided by any component, you may need to add additional configuration when creating your node.`)}function getServiceCapabilities(o){return Array.isArray(o==null?void 0:o[serviceCapabilities])?o[serviceCapabilities]:[]}function getServiceDependencies(o){return Array.isArray(o==null?void 0:o[serviceDependencies])?o[serviceDependencies]:[]}function getServiceName(o){return(o==null?void 0:o[Symbol.toStringTag])??(o==null?void 0:o.toString())??"unknown"}function connectionGater(o={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async et=>{const tt=et.stringTuples();return tt[0][0]===4||tt[0][0]===41?!!isPrivateIp(`${tt[0][1]}`):!1},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...o}}function getPeerAddress(o){if(isPeerId$1(o))return{peerId:o,multiaddrs:[]};Array.isArray(o)||(o=[o]);let et;if(o.length>0){const tt=o[0].getPeerId();et=tt==null?void 0:peerIdFromString$1(tt),o.forEach(nt=>{if(!isMultiaddr(nt))throw new InvalidMultiaddrError("Invalid multiaddr");const rt=nt.getPeerId();if(rt==null){if(et!=null)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}else{const ot=peerIdFromString$1(rt);if((et==null?void 0:et.equals(ot))!==!0)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}})}return{peerId:et,multiaddrs:o}}const DEFAULT_CLOSABLE_PROTOCOLS=["/ipfs/id/1.0.0","/ipfs/id/push/1.0.0","/libp2p/autonat/1.0.0","/libp2p/dcutr"];async function safelyCloseConnectionIfUnused(o,et){var rt;const tt=((rt=o==null?void 0:o.streams)==null?void 0:rt.map(ot=>ot.protocol))??[],nt=(et==null?void 0:et.closableProtocols)??DEFAULT_CLOSABLE_PROTOCOLS;if(!(tt.filter(ot=>ot!=null&&!nt.includes(ot)).length>0))try{await(o==null?void 0:o.close(et))}catch(ot){o==null||o.abort(ot)}}const DIAL_TIMEOUT=5e3,UPGRADE_TIMEOUT=3e3,PROTOCOL_NEGOTIATION_TIMEOUT=2e3,MAX_PEER_ADDRS_TO_DIAL=25,INBOUND_CONNECTION_THRESHOLD=5,MAX_INCOMING_PENDING_CONNECTIONS=10,MAX_PARALLEL_RECONNECTS=5,LAST_DIAL_FAILURE_KEY="last-dial-failure",LAST_DIAL_SUCCESS_KEY="last-dial-success",MAX_DIAL_QUEUE_LENGTH=500,MAX_CONNECTIONS=100,MAX_PARALLEL_DIALS=50,defaultOptions$2={maxConnections:MAX_CONNECTIONS,allow:[]};class ConnectionPruner{constructor(et,tt={}){Ct(this,"maxConnections");Ct(this,"connectionManager");Ct(this,"peerStore");Ct(this,"allow");Ct(this,"events");Ct(this,"log");this.maxConnections=tt.maxConnections??defaultOptions$2.maxConnections,this.allow=tt.allow??defaultOptions$2.allow,this.connectionManager=et.connectionManager,this.peerStore=et.peerStore,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager:connection-pruner"),this.maybePruneConnections=this.maybePruneConnections.bind(this)}start(){this.events.addEventListener("connection:open",this.maybePruneConnections)}stop(){this.events.removeEventListener("connection:open",this.maybePruneConnections)}maybePruneConnections(){this._maybePruneConnections().catch(et=>{this.log.error("error while pruning connections %e",et)})}async _maybePruneConnections(){const et=this.connectionManager.getConnections(),tt=et.length;if(this.log("checking max connections limit %d/%d",tt,this.maxConnections),tt<=this.maxConnections)return;const nt=new PeerMap;for(const st of et){const at=st.remotePeer;if(!nt.has(at)){nt.set(at,0);try{const ct=await this.peerStore.get(at);nt.set(at,[...ct.tags.values()].reduce((lt,dt)=>lt+dt.value,0))}catch(ct){ct.name!=="NotFoundError"&&this.log.error("error loading peer tags",ct)}}}const rt=this.sortConnections(et,nt),ot=Math.max(tt-this.maxConnections,0),it=[];for(const st of rt)if(this.log("too many connections open - closing a connection to %p",st.remotePeer),this.allow.some(ct=>st.remoteAddr.toString().startsWith(ct.toString()))||it.push(st),it.length===ot)break;await Promise.all(it.map(async st=>{await safelyCloseConnectionIfUnused(st,{signal:AbortSignal.timeout(1e3)})})),this.events.safeDispatchEvent("connection:prune",{detail:it})}sortConnections(et,tt){return et.sort((nt,rt)=>{const ot=nt.timeline.open,it=rt.timeline.open;return otit?-1:0}).sort((nt,rt)=>nt.direction==="outbound"&&rt.direction==="inbound"?1:nt.direction==="inbound"&&rt.direction==="outbound"?-1:0).sort((nt,rt)=>nt.streams.length>rt.streams.length?1:nt.streams.length{const ot=tt.get(nt.remotePeer)??0,it=tt.get(rt.remotePeer)??0;return ot>it?1:ot{function st(){tt==null||tt.removeEventListener("abort",lt),o.removeEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.removeEventListener(nt.errorEvent,ct)}const at=dt=>{var ht;try{if(((ht=nt==null?void 0:nt.filter)==null?void 0:ht.call(nt,dt))===!1)return}catch(ft){st(),it(ft);return}st(),ot(dt)},ct=dt=>{st(),it(dt.detail)},lt=()=>{st(),it(rt)};tt==null||tt.addEventListener("abort",lt),o.addEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.addEventListener(nt.errorEvent,ct)})}class JobRecipient{constructor(et){Ct(this,"deferred");Ct(this,"signal");var tt;this.signal=et,this.deferred=pDefer(),this.onAbort=this.onAbort.bind(this),(tt=this.signal)==null||tt.addEventListener("abort",this.onAbort)}onAbort(){var et;this.deferred.reject(((et=this.signal)==null?void 0:et.reason)??new AbortError$6)}cleanup(){var et;(et=this.signal)==null||et.removeEventListener("abort",this.onAbort)}}function randomId(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}class Job{constructor(et,tt){Ct(this,"id");Ct(this,"fn");Ct(this,"options");Ct(this,"recipients");Ct(this,"status");Ct(this,"timeline");Ct(this,"controller");this.id=randomId(),this.status="queued",this.fn=et,this.options=tt,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,setMaxListeners$2(1/0,this.controller.signal),this.onAbort=this.onAbort.bind(this)}abort(et){this.controller.abort(et)}onAbort(){this.recipients.reduce((tt,nt)=>{var rt;return tt&&((rt=nt.signal)==null?void 0:rt.aborted)===!0},!0)&&(this.controller.abort(new AbortError$6),this.cleanup())}async join(et={}){var nt;const tt=new JobRecipient(et.signal);return this.recipients.push(tt),(nt=et.signal)==null||nt.addEventListener("abort",this.onAbort),tt.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();const et=await raceSignal(this.fn({...this.options??{},signal:this.controller.signal}),this.controller.signal);this.recipients.forEach(tt=>{tt.deferred.resolve(et)}),this.status="complete"}catch(et){this.recipients.forEach(tt=>{tt.deferred.reject(et)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(et=>{var tt;et.cleanup(),(tt=et.signal)==null||tt.removeEventListener("abort",this.onAbort)})}}class Queue extends TypedEventEmitter$1{constructor(tt={}){var nt;super();Ct(this,"concurrency");Ct(this,"maxSize");Ct(this,"queue");Ct(this,"pending");Ct(this,"sort");this.concurrency=tt.concurrency??Number.POSITIVE_INFINITY,this.maxSize=tt.maxSize??Number.POSITIVE_INFINITY,this.pending=0,tt.metricName!=null&&((nt=tt.metrics)==null||nt.registerMetricGroup(tt.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})})),this.sort=tt.sort,this.queue=[]}tryToStartAnother(){if(this.size===0)return queueMicrotask(()=>{this.safeDispatchEvent("empty")}),this.running===0&&queueMicrotask(()=>{this.safeDispatchEvent("idle")}),!1;if(this.pending{for(let nt=0;nt(this.safeDispatchEvent("completed",{detail:it}),this.safeDispatchEvent("success",{detail:{job:rt,result:it}}),it)).catch(it=>{if(rt.status==="queued"){for(let st=0;st{tt.abort(new AbortError$6)}),this.clear()}async onEmpty(tt){this.size!==0&&await raceEvent(this,"empty",tt==null?void 0:tt.signal)}async onSizeLessThan(tt,nt){this.sizethis.size{ht!=null?this.abort():this.clear(),nt.end(ht)},ot=ht=>{ht.detail!=null&&nt.push(ht.detail)},it=ht=>{rt(ht.detail)},st=()=>{rt()},at=()=>{rt(new AbortError$6("Queue aborted"))};this.addEventListener("completed",ot),this.addEventListener("error",it),this.addEventListener("idle",st),(lt=tt==null?void 0:tt.signal)==null||lt.addEventListener("abort",at);try{yield*nt}finally{this.removeEventListener("completed",ot),this.removeEventListener("error",it),this.removeEventListener("idle",st),(dt=tt==null?void 0:tt.signal)==null||dt.removeEventListener("abort",at),rt()}}}class PriorityQueue extends Queue{constructor(et={}){super({...et,sort:(tt,nt)=>tt.options.priority>nt.options.priority?-1:tt.options.priorityrt.toString())),nt}const defaultOptions$1={maxParallelDials:MAX_PARALLEL_DIALS,maxDialQueueLength:MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:MAX_PEER_ADDRS_TO_DIAL,dialTimeout:DIAL_TIMEOUT,resolvers:{dnsaddr:dnsaddrResolver}};class DialQueue{constructor(et,tt={}){Ct(this,"queue");Ct(this,"components");Ct(this,"addressSorter");Ct(this,"maxPeerAddrsToDial");Ct(this,"maxDialQueueLength");Ct(this,"dialTimeout");Ct(this,"shutDownController");Ct(this,"connections");Ct(this,"log");this.addressSorter=tt.addressSorter,this.maxPeerAddrsToDial=tt.maxPeerAddrsToDial??defaultOptions$1.maxPeerAddrsToDial,this.maxDialQueueLength=tt.maxDialQueueLength??defaultOptions$1.maxDialQueueLength,this.dialTimeout=tt.dialTimeout??defaultOptions$1.dialTimeout,this.connections=tt.connections??new PeerMap,this.log=et.logger.forComponent("libp2p:connection-manager:dial-queue"),this.components=et,this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal);for(const[nt,rt]of Object.entries(tt.resolvers??{}))resolvers$1.set(nt,rt);this.queue=new PriorityQueue({concurrency:tt.maxParallelDials??defaultOptions$1.maxParallelDials,metricName:"libp2p_dial_queue",metrics:et.metrics}),this.queue.addEventListener("error",nt=>{nt.detail.name!==AbortError$4.name&&this.log.error("error in dial queue - %e",nt.detail)})}start(){this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal)}stop(){this.shutDownController.abort(),this.queue.abort()}async dial(et,tt={}){var st,at,ct;const{peerId:nt,multiaddrs:rt}=getPeerAddress(et),ot=Array.from(this.connections.values()).flat().find(lt=>tt.force===!0?!1:lt.remotePeer.equals(nt)?!0:rt.find(dt=>dt.equals(lt.remoteAddr)));if((ot==null?void 0:ot.status)==="open")return this.log("already connected to %a",ot.remoteAddr),(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ot;const it=this.queue.queue.find(lt=>{if((nt==null?void 0:nt.equals(lt.options.peerId))===!0)return!0;const dt=lt.options.multiaddrs;if(dt==null)return!1;for(const ht of rt)if(dt.has(ht.toString()))return!0;return!1});if(it!=null){this.log("joining existing dial target for %p",nt);for(const lt of rt)it.options.multiaddrs.add(lt.toString());return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dial-queue:already-in-dial-queue")),it.join(tt)}if(this.queue.size>=this.maxDialQueueLength)throw new DialError("Dial queue is full");return this.log("creating dial target for %p",nt,rt.map(lt=>lt.toString())),(ct=tt.onProgress)==null||ct.call(tt,new CustomProgressEvent("dial-queue:add-to-dial-queue")),this.queue.add(async lt=>{var ft,mt;(ft=lt==null?void 0:lt.onProgress)==null||ft.call(lt,new CustomProgressEvent("dial-queue:start-dial"));const dt=this.createDialAbortController(lt==null?void 0:lt.signal);let ht;try{ht=await this.calculateMultiaddrs(nt,lt==null?void 0:lt.multiaddrs,{...lt,signal:dt}),(mt=lt==null?void 0:lt.onProgress)==null||mt.call(lt,new CustomProgressEvent("dial-queue:calculated-addresses",ht)),ht.map(({multiaddr:pt})=>pt.toString()).forEach(pt=>{lt==null||lt.multiaddrs.add(pt)})}catch(pt){throw dt.clear(),pt}try{let pt=0;const yt=[];for(const gt of ht){if(pt===this.maxPeerAddrsToDial)throw this.log("dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others",pt,nt),new DialError("Peer had more than maxPeerAddrsToDial");pt++;try{const xt=await this.components.transportManager.dial(gt.multiaddr,{...lt,signal:dt});this.log("dial to %a succeeded",gt.multiaddr);try{await this.components.peerStore.merge(xt.remotePeer,{multiaddrs:[xt.remoteAddr],metadata:{[LAST_DIAL_SUCCESS_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}return xt}catch(xt){if(this.log.error("dial failed to %a",gt.multiaddr,xt),nt!=null)try{await this.components.peerStore.merge(nt,{metadata:{[LAST_DIAL_FAILURE_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}if(dt.aborted)throw new TimeoutError$2(xt.message);yt.push(xt)}}throw yt.length===1?yt[0]:new AggregateError(yt,"All multiaddr dials failed")}finally{dt.clear()}},{peerId:nt,priority:tt.priority??DEFAULT_DIAL_PRIORITY,multiaddrs:new Set(rt.map(lt=>lt.toString())),signal:tt.signal,onProgress:tt.onProgress})}createDialAbortController(et){const tt=anySignal([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,et]);return setMaxListeners(1/0,tt),tt}async calculateMultiaddrs(et,tt=new Set,nt={}){var dt,ht;const rt=[...tt].map(ft=>({multiaddr:multiaddr(ft),isCertified:!1}));if(et!=null){if(this.components.peerId.equals(et))throw new DialError("Tried to dial self");if(await((ht=(dt=this.components.connectionGater).denyDialPeer)==null?void 0:ht.call(dt,et))===!0)throw new DialDeniedError("The dial request is blocked by gater.allowDialPeer");if(rt.length===0){this.log("loading multiaddrs for %p",et);try{const ft=await this.components.peerStore.get(et);rt.push(...ft.addresses),this.log("loaded multiaddrs for %p",et,rt.map(({multiaddr:mt})=>mt.toString()))}catch(ft){if(ft.name!=="NotFoundError")throw ft}}if(rt.length===0){this.log("looking up multiaddrs for %p in the peer routing",et);try{const ft=await this.components.peerRouting.findPeer(et);this.log("found multiaddrs for %p in the peer routing",et,rt.map(({multiaddr:mt})=>mt.toString())),rt.push(...ft.multiaddrs.map(mt=>({multiaddr:mt,isCertified:!1})))}catch(ft){ft.name!=="NoPeerRoutersError"&&this.log.error("looking up multiaddrs for %p in the peer routing failed",et,ft)}}}let ot=(await Promise.all(rt.map(async ft=>{const mt=await resolveMultiaddrs(ft.multiaddr,{dns:this.components.dns,...nt,log:this.log});return mt.length===1&&mt[0].equals(ft.multiaddr)?ft:mt.map(pt=>({multiaddr:pt,isCertified:!1}))}))).flat();if(et!=null){const ft=`/p2p/${et.toString()}`;ot=ot.map(mt=>{const pt=mt.multiaddr.protos().pop();return(pt==null?void 0:pt.path)===!0?mt:mt.multiaddr.getPeerId()==null?{multiaddr:mt.multiaddr.encapsulate(ft),isCertified:mt.isCertified}:mt})}const it=ot.filter(ft=>{if(this.components.transportManager.dialTransportForMultiaddr(ft.multiaddr)==null)return!1;const mt=ft.multiaddr.getPeerId();return et!=null&&mt!=null?et.equals(mt):!0}),st=new Map;for(const ft of it){const mt=ft.multiaddr.toString(),pt=st.get(mt);if(pt!=null){pt.isCertified=pt.isCertified||ft.isCertified||!1;continue}st.set(mt,ft)}const at=[...st.values()];if(at.length===0)throw new NoValidAddressesError("The dial request has no valid addresses");const ct=[];for(const ft of at)this.components.connectionGater.denyDialMultiaddr!=null&&await this.components.connectionGater.denyDialMultiaddr(ft.multiaddr)||ct.push(ft);const lt=this.addressSorter==null?defaultAddressSorter(ct):ct.sort(this.addressSorter);if(lt.length===0)throw new DialDeniedError("The connection gater denied all addresses in the dial request");return this.log.trace("addresses for %p before filtering",et??"unknown peer",ot.map(({multiaddr:ft})=>ft.toString())),this.log.trace("addresses for %p after filtering",et??"unknown peer",lt.map(({multiaddr:ft})=>ft.toString())),lt}async isDialable(et,tt={}){Array.isArray(et)||(et=[et]);try{const nt=await this.calculateMultiaddrs(void 0,new Set(et.map(rt=>rt.toString())),tt);return tt.runOnLimitedConnection===!1?nt.find(rt=>!Circuit.matches(rt.multiaddr))!=null:!0}catch(nt){this.log.trace("error calculating if multiaddr(s) were dialable",nt)}return!1}}class PeerQueue extends Queue{has(et){return this.find(et)!=null}find(et){return this.queue.find(tt=>et.equals(tt.options.peerId))}}var retry$2={};function RetryOperation(o,et){typeof et=="boolean"&&(et={forever:et}),this._originalTimeouts=JSON.parse(JSON.stringify(o)),this._timeouts=o,this._options=et||{},this._maxRetryTime=et&&et.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(o){if(this._timeout&&clearTimeout(this._timeout),!o)return!1;var et=new Date().getTime();if(o&&et-this._operationStart>=this._maxRetryTime)return this._errors.push(o),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(o);var tt=this._timeouts.shift();if(tt===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),tt=this._cachedTimeouts.slice(-1);else return!1;var nt=this;return this._timer=setTimeout(function(){nt._attempts++,nt._operationTimeoutCb&&(nt._timeout=setTimeout(function(){nt._operationTimeoutCb(nt._attempts)},nt._operationTimeout),nt._options.unref&&nt._timeout.unref()),nt._fn(nt._attempts)},tt),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(o,et){this._fn=o,et&&(et.timeout&&(this._operationTimeout=et.timeout),et.cb&&(this._operationTimeoutCb=et.cb));var tt=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){tt._operationTimeoutCb()},tt._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(o){console.log("Using RetryOperation.try() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=function(o){console.log("Using RetryOperation.start() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var o={},et=null,tt=0,nt=0;nt=tt&&(et=rt,tt=it)}return et};(function(o){var et=retry_operation;o.operation=function(tt){var nt=o.timeouts(tt);return new et(nt,{forever:tt&&(tt.forever||tt.retries===1/0),unref:tt&&tt.unref,maxRetryTime:tt&&tt.maxRetryTime})},o.timeouts=function(tt){if(tt instanceof Array)return[].concat(tt);var nt={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var rt in tt)nt[rt]=tt[rt];if(nt.minTimeout>nt.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var ot=[],it=0;itobjectToString.call(o)==="[object Error]",errorMessages=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function isNetworkError(o){return o&&isError(o)&&o.name==="TypeError"&&typeof o.message=="string"?o.message==="Load failed"?o.stack===void 0:errorMessages.has(o.message):!1}let AbortError$1=class extends Error{constructor(et){super(),et instanceof Error?(this.originalError=et,{message:et}=et):(this.originalError=new Error(et),this.originalError.stack=this.stack),this.name="AbortError",this.message=et}};const decorateErrorWithCounts=(o,et,tt)=>{const nt=tt.retries-(et-1);return o.attemptNumber=et,o.retriesLeft=nt,o};async function pRetry(o,et){return new Promise((tt,nt)=>{et={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...et};const rt=retry$1.operation(et),ot=()=>{var st;rt.stop(),nt((st=et.signal)==null?void 0:st.reason)};et.signal&&!et.signal.aborted&&et.signal.addEventListener("abort",ot,{once:!0});const it=()=>{var st;(st=et.signal)==null||st.removeEventListener("abort",ot),rt.stop()};rt.attempt(async st=>{try{const at=await o(st);it(),tt(at)}catch(at){try{if(!(at instanceof Error))throw new TypeError(`Non-error was thrown: "${at}". You should only throw errors.`);if(at instanceof AbortError$1)throw at.originalError;if(at instanceof TypeError&&!isNetworkError(at))throw at;if(decorateErrorWithCounts(at,st,et),await et.shouldRetry(at)||(rt.stop(),nt(at)),await et.onFailedAttempt(at),!rt.retry(at))throw rt.mainError()}catch(ct){decorateErrorWithCounts(ct,st,et),it(),nt(ct)}}})})}class ReconnectQueue{constructor(et,tt={}){Ct(this,"log");Ct(this,"queue");Ct(this,"started");Ct(this,"peerStore");Ct(this,"retries");Ct(this,"retryInterval");Ct(this,"backoffFactor");Ct(this,"connectionManager");Ct(this,"events");this.log=et.logger.forComponent("libp2p:reconnect-queue"),this.peerStore=et.peerStore,this.connectionManager=et.connectionManager,this.queue=new PeerQueue({concurrency:tt.maxParallelReconnects??MAX_PARALLEL_RECONNECTS,metricName:"libp2p_reconnect_queue",metrics:et.metrics}),this.started=!1,this.retries=tt.retries??5,this.backoffFactor=tt.backoffFactor,this.retryInterval=tt.retryInterval,this.events=et.events,et.events.addEventListener("peer:disconnect",nt=>{this.maybeReconnect(nt.detail).catch(rt=>{this.log.error("failed to maybe reconnect to %p - %e",nt.detail,rt)})})}async maybeReconnect(et){if(!this.started)return;const tt=await this.peerStore.get(et);hasKeepAliveTag(tt)&&(this.queue.has(et)||this.queue.add(async nt=>{await pRetry(async rt=>{if(this.started)try{await this.connectionManager.openConnection(et,{signal:nt==null?void 0:nt.signal})}catch(ot){throw this.log("reconnecting to %p attempt %d of %d failed - %e",et,rt,this.retries,ot),ot}},{signal:nt==null?void 0:nt.signal,retries:this.retries,factor:this.backoffFactor,minTimeout:this.retryInterval})},{peerId:et}).catch(async nt=>{this.log.error("failed to reconnect to %p - %e",et,nt);const rt={};[...tt.tags.keys()].forEach(ot=>{ot.startsWith(KEEP_ALIVE)&&(rt[ot]=void 0)}),await this.peerStore.merge(et,{tags:rt}),this.events.safeDispatchEvent("peer:reconnect-failure",{detail:et})}).catch(async nt=>{this.log.error("failed to remove keep-alive tag from %p - %e",et,nt)}))}start(){this.started=!0}async afterStart(){Promise.resolve().then(async()=>{const et=await this.peerStore.all({filters:[tt=>hasKeepAliveTag(tt)]});await Promise.all(et.map(async tt=>{await this.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error(nt)})}))}).catch(et=>{this.log.error(et)})}stop(){this.started=!1,this.queue.abort()}}function hasKeepAliveTag(o){for(const et of o.tags.keys())if(et.startsWith(KEEP_ALIVE))return!0;return!1}const DEFAULT_DIAL_PRIORITY=50,defaultOptions={maxConnections:MAX_CONNECTIONS,inboundConnectionThreshold:INBOUND_CONNECTION_THRESHOLD,maxIncomingPendingConnections:MAX_INCOMING_PENDING_CONNECTIONS};var Dl;Dl=Symbol.toStringTag;class DefaultConnectionManager{constructor(et,tt={}){Ct(this,"started");Ct(this,"connections");Ct(this,"allow");Ct(this,"deny");Ct(this,"maxIncomingPendingConnections");Ct(this,"incomingPendingConnections");Ct(this,"outboundPendingConnections");Ct(this,"maxConnections");Ct(this,"dialQueue");Ct(this,"reconnectQueue");Ct(this,"connectionPruner");Ct(this,"inboundConnectionRateLimiter");Ct(this,"peerStore");Ct(this,"metrics");Ct(this,"events");Ct(this,"log");Ct(this,"peerId");Ct(this,Dl,"@libp2p/connection-manager");if(this.maxConnections=tt.maxConnections??defaultOptions.maxConnections,this.maxConnections<1)throw new InvalidParametersError$1("Connection Manager maxConnections must be greater than 0");this.connections=new PeerMap,this.started=!1,this.peerId=et.peerId,this.peerStore=et.peerStore,this.metrics=et.metrics,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager"),this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.allow=(tt.allow??[]).map(nt=>multiaddr(nt)),this.deny=(tt.deny??[]).map(nt=>multiaddr(nt)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=tt.maxIncomingPendingConnections??defaultOptions.maxIncomingPendingConnections,this.outboundPendingConnections=0,this.inboundConnectionRateLimiter=new RateLimiter({points:tt.inboundConnectionThreshold??defaultOptions.inboundConnectionThreshold,duration:1}),this.connectionPruner=new ConnectionPruner({connectionManager:this,peerStore:et.peerStore,events:et.events,logger:et.logger},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new DialQueue(et,{addressSorter:tt.addressSorter,maxParallelDials:tt.maxParallelDials??MAX_PARALLEL_DIALS,maxDialQueueLength:tt.maxDialQueueLength??MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:tt.maxPeerAddrsToDial??MAX_PEER_ADDRS_TO_DIAL,dialTimeout:tt.dialTimeout??DIAL_TIMEOUT,resolvers:tt.resolvers??{dnsaddr:dnsaddrResolver},connections:this.connections}),this.reconnectQueue=new ReconnectQueue({events:et.events,peerStore:et.peerStore,logger:et.logger,connectionManager:this},{retries:tt.reconnectRetries,retryInterval:tt.reconnectRetryInterval,backoffFactor:tt.reconnectBackoffFactor,maxParallelReconnects:tt.maxParallelReconnects})}async start(){var et,tt,nt;(et=this.metrics)==null||et.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const rt={inbound:0,"inbound pending":this.incomingPendingConnections,outbound:0,"outbound pending":this.outboundPendingConnections};for(const ot of this.connections.values())for(const it of ot)rt[it.direction]++;return rt}}),(tt=this.metrics)==null||tt.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const rt={};for(const ot of this.connections.values())for(const it of ot)for(const st of it.streams){const at=`${st.direction} ${st.protocol??"unnegotiated"}`;rt[at]=(rt[at]??0)+1}return rt}}),(nt=this.metrics)==null||nt.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const rt={};for(const it of this.connections.values())for(const st of it){const at={};for(const ct of st.streams){const lt=`${ct.direction} ${ct.protocol??"unnegotiated"}`;at[lt]=(at[lt]??0)+1}for(const[ct,lt]of Object.entries(at))rt[ct]=rt[ct]??[],rt[ct].push(lt)}const ot={};for(let[it,st]of Object.entries(rt)){st=st.sort((ct,lt)=>ct-lt);const at=Math.floor(st.length*.9);ot[it]=st[at]}return ot}}),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),await start(this.dialQueue,this.reconnectQueue,this.connectionPruner),this.started=!0,this.log("started")}async stop(){this.events.removeEventListener("connection:open",this.onConnect),this.events.removeEventListener("connection:close",this.onDisconnect),await stop(this.reconnectQueue,this.dialQueue,this.connectionPruner);const et=[];for(const tt of this.connections.values())for(const nt of tt)et.push((async()=>{try{await nt.close()}catch(rt){this.log.error(rt)}})());this.log("closing %d connections",et.length),await Promise.all(et),this.connections.clear(),this.log("stopped")}onConnect(et){this._onConnect(et).catch(tt=>{this.log.error(tt)})}async _onConnect(et){const{detail:tt}=et;if(!this.started){await tt.close();return}if(tt.status!=="open")return;const nt=tt.remotePeer,rt=!this.connections.has(nt),ot=this.connections.get(nt)??[];ot.push(tt),this.connections.set(nt,ot),nt.publicKey!=null&&nt.type==="RSA"&&await this.peerStore.patch(nt,{publicKey:nt.publicKey}),rt&&this.events.safeDispatchEvent("peer:connect",{detail:tt.remotePeer})}onDisconnect(et){const{detail:tt}=et,nt=tt.remotePeer,ot=(this.connections.get(nt)??[]).filter(it=>it.id!==tt.id);this.connections.set(nt,ot),ot.length===0&&(this.log("onDisconnect remove all connections for peer %p",nt),this.connections.delete(nt),this.events.safeDispatchEvent("peer:disconnect",{detail:tt.remotePeer}))}getConnections(et){if(et!=null)return this.connections.get(et)??[];let tt=[];for(const nt of this.connections.values())tt=tt.concat(nt);return tt}getConnectionsMap(){return this.connections}async openConnection(et,tt={}){var nt,rt;if(!this.started)throw new NotStartedError("Not started");this.outboundPendingConnections++;try{(nt=tt.signal)==null||nt.throwIfAborted();const{peerId:ot}=getPeerAddress(et);if(this.peerId.equals(ot))throw new InvalidPeerIdError("Can not dial self");if(ot!=null&&tt.force!==!0){this.log("dial %p",ot);const ct=this.getConnections(ot).find(lt=>lt.limits==null);if(ct!=null)return this.log("had an existing non-limited connection to %p",ot),(rt=tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ct}const it=await this.dialQueue.dial(et,{...tt,priority:tt.priority??DEFAULT_DIAL_PRIORITY});if(it.status!=="open")throw new ConnectionClosedError("Remote closed connection during opening");let st=this.connections.get(it.remotePeer);st==null&&(st=[],this.connections.set(it.remotePeer,st));let at=!1;for(const ct of st)if(ct.id===it.id&&(at=!0),tt.force!==!0&&ct.id!==it.id&&ct.remoteAddr.equals(it.remoteAddr))return it.abort(new InvalidMultiaddrError("Duplicate multiaddr connection")),ct;return at||st.push(it),it}finally{this.outboundPendingConnections--}}async closeConnections(et,tt={}){const nt=this.connections.get(et)??[];await Promise.all(nt.map(async rt=>{try{await rt.close(tt)}catch(ot){rt.abort(ot)}}))}async acceptIncomingConnection(et){if(this.deny.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.log("connection from %a refused - connection remote address was in deny list",et.remoteAddr),!1;if(this.allow.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return this.log("connection from %a refused - incomingPendingConnections exceeded by host",et.remoteAddr),!1;if(et.remoteAddr.isThinWaistAddress()){const rt=et.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(rt,1)}catch{return this.log("connection from %a refused - inboundConnectionThreshold exceeded by host %s",et.remoteAddr,rt),!1}}return this.getConnections().length({id:tt.id,status:et[tt.status],peerId:tt.options.peerId,multiaddrs:[...tt.options.multiaddrs].map(nt=>multiaddr(nt))}))}async isDialable(et,tt={}){return this.dialQueue.isDialable(et,tt)}}class MovingAverage{constructor(et){Ct(this,"movingAverage");Ct(this,"variance");Ct(this,"deviation");Ct(this,"forecast");Ct(this,"timespan");Ct(this,"previousTime");this.timespan=et,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(et,tt){return 1-Math.exp(-(et-tt)/this.timespan)}push(et,tt=Date.now()){if(this.previousTime!=null){const nt=this.alpha(tt,this.previousTime),rt=et-this.movingAverage,ot=nt*rt;this.movingAverage=nt*et+(1-nt)*this.movingAverage,this.variance=(1-nt)*(this.variance+rt*ot),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+nt*rt}else this.movingAverage=et;this.previousTime=tt}}const DEFAULT_TIMEOUT_MULTIPLIER=1.2,DEFAULT_FAILURE_MULTIPLIER=2,DEFAULT_MIN_TIMEOUT=2e3;class AdaptiveTimeout{constructor(et={}){Ct(this,"success");Ct(this,"failure");Ct(this,"next");Ct(this,"metric");Ct(this,"timeoutMultiplier");Ct(this,"failureMultiplier");Ct(this,"minTimeout");var tt;this.success=new MovingAverage(et.interval??5e3),this.failure=new MovingAverage(et.interval??5e3),this.next=new MovingAverage(et.interval??5e3),this.failureMultiplier=et.failureMultiplier??DEFAULT_FAILURE_MULTIPLIER,this.timeoutMultiplier=et.timeoutMultiplier??DEFAULT_TIMEOUT_MULTIPLIER,this.minTimeout=et.minTimeout??DEFAULT_MIN_TIMEOUT,et.metricName!=null&&(this.metric=(tt=et.metrics)==null?void 0:tt.registerMetricGroup(et.metricName))}getTimeoutSignal(et={}){const tt=Math.max(Math.round(this.next.movingAverage*(et.timeoutFactor??this.timeoutMultiplier)),this.minTimeout),nt=AbortSignal.timeout(tt),rt=anySignal([et.signal,nt]);return setMaxListeners$2(1/0,rt,nt),rt.start=Date.now(),rt.timeout=tt,rt}cleanUp(et){var nt,rt;const tt=Date.now()-et.start;et.aborted?(this.failure.push(tt),this.next.push(tt*this.failureMultiplier),(nt=this.metric)==null||nt.update({failureMovingAverage:this.failure.movingAverage,failureDeviation:this.failure.deviation,failureForecast:this.failure.forecast,failureVariance:this.failure.variance,failure:tt})):(this.success.push(tt),this.next.push(tt),(rt=this.metric)==null||rt.update({successMovingAverage:this.success.movingAverage,successDeviation:this.success.deviation,successForecast:this.success.forecast,successVariance:this.success.variance,success:tt}))}}const DEFAULT_PING_INTERVAL_MS=1e4,PROTOCOL_VERSION="1.0.0",PROTOCOL_NAME="ping",PROTOCOL_PREFIX="ipfs",PING_LENGTH=32,DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE=!0;var Fl,Ul;Ul=Symbol.toStringTag,Fl=serviceCapabilities;class ConnectionMonitor{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"log");Ct(this,"heartbeatInterval");Ct(this,"pingIntervalMs");Ct(this,"abortController");Ct(this,"timeout");Ct(this,"abortConnectionOnPingFailure");Ct(this,Ul,"@libp2p/connection-monitor");Ct(this,Fl,["@libp2p/connection-monitor"]);this.components=et,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`,this.log=et.logger.forComponent("libp2p:connection-monitor"),this.pingIntervalMs=tt.pingInterval??DEFAULT_PING_INTERVAL_MS,this.abortConnectionOnPingFailure=tt.abortConnectionOnPingFailure??DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE,this.timeout=new AdaptiveTimeout({...tt.pingTimeout??{},metrics:et.metrics,metricName:"libp2p_connection_monitor_ping_time_milliseconds"})}start(){this.abortController=new AbortController,setMaxListeners(1/0,this.abortController.signal),this.heartbeatInterval=setInterval(()=>{this.components.connectionManager.getConnections().forEach(et=>{Promise.resolve().then(async()=>{var nt;let tt=Date.now();try{const rt=this.timeout.getTimeoutSignal({signal:(nt=this.abortController)==null?void 0:nt.signal}),ot=await et.newStream(this.protocol,{signal:rt,runOnLimitedConnection:!0}),it=byteStream(ot);tt=Date.now(),await Promise.all([it.write(randomBytes(PING_LENGTH),{signal:rt}),it.read(PING_LENGTH,{signal:rt})]),et.rtt=Date.now()-tt,await it.unwrap().close({signal:rt})}catch(rt){if(rt.name!=="UnsupportedProtocolError")throw rt;et.rtt=(Date.now()-tt)/2}}).catch(tt=>{this.log.error("error during heartbeat",tt),this.abortConnectionOnPingFailure?(this.log.error("aborting connection due to ping failure"),et.abort(tt)):this.log("connection ping failed, but not aborting due to abortConnectionOnPingFailure flag")})})},this.pingIntervalMs)}stop(){var et;(et=this.abortController)==null||et.abort(),this.heartbeatInterval!=null&&clearInterval(this.heartbeatInterval)}}var zl;zl=Symbol.toStringTag;class CompoundContentRouting{constructor(et,tt){Ct(this,"routers");Ct(this,"started");Ct(this,"components");Ct(this,zl,"@libp2p/content-routing");this.routers=tt.routers??[],this.started=!1,this.components=et}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");const nt=this,rt=new PeerSet;for await(const ot of merge$2(...nt.routers.map(it=>it.findProviders(et,tt))))ot!=null&&(ot.multiaddrs.length>0&&await this.components.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id)&&(rt.add(ot.id),yield ot))}async provide(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");await Promise.all(this.routers.map(async nt=>{await nt.provide(et,tt)}))}async put(et,tt,nt){if(!this.isStarted())throw new NotStartedError;await Promise.all(this.routers.map(async rt=>{await rt.put(et,tt,nt)}))}async get(et,tt){if(!this.isStarted())throw new NotStartedError;return Promise.any(this.routers.map(async nt=>nt.get(et,tt)))}}var Vl;Vl=Symbol.toStringTag;class DefaultPeerRouting{constructor(et,tt={}){Ct(this,"log");Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"routers");Ct(this,Vl,"@libp2p/peer-routing");this.log=et.logger.forComponent("libp2p:peer-routing"),this.peerId=et.peerId,this.peerStore=et.peerStore,this.routers=tt.routers??[]}async findPeer(et,tt){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");if(et.toString()===this.peerId.toString())throw new QueriedForSelfError("Should not try to find self");const nt=this,rt=merge$2(...this.routers.map(ot=>async function*(){try{yield await ot.findPeer(et,tt)}catch(it){nt.log.error(it)}}()));for await(const ot of rt)if(ot!=null)return ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),ot;throw new NotFoundError$1}async*getClosestPeers(et,tt={}){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");const nt=this,rt=createScalableCuckooFilter(1024);for await(const ot of parallel(async function*(){const it=merge$2(...nt.routers.map(st=>st.getClosestPeers(et,tt)));for await(let st of it)yield async()=>{if(st.multiaddrs.length===0)try{st=await nt.findPeer(st.id,{...tt,useCache:!1})}catch(at){nt.log.error("could not find peer multiaddrs",at);return}return st}}()))ot!=null&&(ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id.toMultihash().bytes)&&(rt.add(ot.id.toMultihash().bytes),yield ot))}}var Hl,Wl;class RandomWalk extends(Wl=TypedEventEmitter,Hl=Symbol.toStringTag,Wl){constructor(tt){super();Ct(this,"peerRouting");Ct(this,"log");Ct(this,"walking");Ct(this,"walkers");Ct(this,"shutdownController");Ct(this,"walkController");Ct(this,"needNext");Ct(this,Hl,"@libp2p/random-walk");this.log=tt.logger.forComponent("libp2p:random-walk"),this.peerRouting=tt.peerRouting,this.walkers=0,this.walking=!1,this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}start(){this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}stop(){this.shutdownController.abort()}async*walk(tt){var rt,ot;this.walking||this.startWalk(),this.walkers++;const nt=anySignal([this.shutdownController.signal,tt==null?void 0:tt.signal]);setMaxListeners(1/0,nt);try{for(;;)(rt=this.needNext)==null||rt.resolve(),this.needNext=pDefer(),yield(await raceEvent(this,"walk:peer",nt,{errorEvent:"walk:error"})).detail}finally{nt.clear(),this.walkers--,this.walkers===0&&((ot=this.walkController)==null||ot.abort(),this.walkController=void 0)}}startWalk(){this.walking=!0,this.walkController=new AbortController,setMaxListeners(1/0,this.walkController.signal);const tt=anySignal([this.walkController.signal,this.shutdownController.signal]);setMaxListeners(1/0,tt);const nt=Date.now();let rt=0;Promise.resolve().then(async()=>{for(this.log("start walk");this.walkers>0;)try{const ot=randomBytes(32);let it=Date.now();for await(const st of this.peerRouting.getClosestPeers(ot,{signal:tt}))tt.aborted&&this.log("aborting walk"),tt.throwIfAborted(),this.log("found peer %p after %dms for %d walkers",st.id,Date.now()-it,this.walkers),rt++,this.safeDispatchEvent("walk:peer",{detail:st}),this.walkers===1&&this.needNext!=null&&(this.log("wait for need next"),await raceSignal(this.needNext.promise,tt)),it=Date.now();this.log("walk iteration for %b and %d walkers finished, found %d peers",ot,this.walkers,rt)}catch(ot){this.log.error("randomwalk errored",ot),this.safeDispatchEvent("walk:error",{detail:ot})}this.log("no walkers left, ended walk")}).catch(ot=>{this.log.error("randomwalk errored",ot)}).finally(()=>{this.log("finished walk, found %d peers after %dms",rt,Date.now()-nt),this.walking=!1})}}const DEFAULT_MAX_INBOUND_STREAMS=32,DEFAULT_MAX_OUTBOUND_STREAMS=64;var Gl;Gl=Symbol.toStringTag;class DefaultRegistrar{constructor(et){Ct(this,"log");Ct(this,"topologies");Ct(this,"handlers");Ct(this,"components");Ct(this,Gl,"@libp2p/registrar");this.log=et.logger.forComponent("libp2p:registrar"),this.topologies=new Map,this.handlers=new Map,this.components=et,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onPeerIdentify=this._onPeerIdentify.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate),this.components.events.addEventListener("peer:identify",this._onPeerIdentify)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(et){const tt=this.handlers.get(et);if(tt==null)throw new UnhandledProtocolError(`No handler registered for protocol ${et}`);return tt}getTopologies(et){const tt=this.topologies.get(et);return tt==null?[]:[...tt.values()]}async handle(et,tt,nt){if(this.handlers.has(et))throw new DuplicateProtocolHandlerError(`Handler already registered for protocol ${et}`);const rt=mergeOptions$1.bind({ignoreUndefined:!0})({maxInboundStreams:DEFAULT_MAX_INBOUND_STREAMS,maxOutboundStreams:DEFAULT_MAX_OUTBOUND_STREAMS},nt);this.handlers.set(et,{handler:tt,options:rt}),await this.components.peerStore.merge(this.components.peerId,{protocols:[et]})}async unhandle(et){(Array.isArray(et)?et:[et]).forEach(nt=>{this.handlers.delete(nt)}),await this.components.peerStore.patch(this.components.peerId,{protocols:this.getProtocols()})}async register(et,tt){if(tt==null)throw new InvalidParametersError$1("invalid topology");const nt=`${(Math.random()*1e9).toString(36)}${Date.now()}`;let rt=this.topologies.get(et);return rt==null&&(rt=new Map,this.topologies.set(et,rt)),rt.set(nt,tt),nt}unregister(et){for(const[tt,nt]of this.topologies.entries())nt.has(et)&&(nt.delete(et),nt.size===0&&this.topologies.delete(tt))}_onDisconnect(et){const tt=et.detail;this.components.peerStore.get(tt).then(nt=>{var rt,ot,it;for(const st of nt.protocols){const at=this.topologies.get(st);if(at!=null)for(const ct of at.values())((rt=ct.filter)==null?void 0:rt.has(tt))!==!1&&((ot=ct.filter)==null||ot.remove(tt),(it=ct.onDisconnect)==null||it.call(ct,tt))}}).catch(nt=>{nt.name!=="NotFoundError"&&this.log.error("could not inform topologies of disconnecting peer %p",tt,nt)})}_onPeerUpdate(et){var ot,it,st;const{peer:tt,previous:nt}=et.detail,rt=((nt==null?void 0:nt.protocols)??[]).filter(at=>!tt.protocols.includes(at));for(const at of rt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())((ot=lt.filter)==null?void 0:ot.has(tt.id))!==!1&&((it=lt.filter)==null||it.remove(tt.id),(st=lt.onDisconnect)==null||st.call(lt,tt.id))}}_onPeerIdentify(et){var ot,it,st;const tt=et.detail.protocols,nt=et.detail.connection,rt=et.detail.peerId;for(const at of tt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())nt.limits!=null&<.notifyOnLimitedConnection!==!0||((ot=lt.filter)==null?void 0:ot.has(rt))!==!0&&((it=lt.filter)==null||it.add(rt),(st=lt.onConnect)==null||st.call(lt,rt,nt))}}}class TrackedMap extends Map{constructor(tt){super();Ct(this,"metric");const{name:nt,metrics:rt}=tt;this.metric=rt.registerMetric(nt),this.updateComponentMetric()}set(tt,nt){return super.set(tt,nt),this.updateComponentMetric(),this}delete(tt){const nt=super.delete(tt);return this.updateComponentMetric(),nt}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}function trackedMap(o){const{name:et,metrics:tt}=o;let nt;return tt!=null?nt=new TrackedMap({name:et,metrics:tt}):nt=new Map,nt}var Kl;Kl=Symbol.toStringTag;class DefaultTransportManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"transports");Ct(this,"listeners");Ct(this,"faultTolerance");Ct(this,"started");Ct(this,Kl,"@libp2p/transport-manager");this.log=et.logger.forComponent("libp2p:transports"),this.components=et,this.started=!1,this.transports=new Map,this.listeners=trackedMap({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=tt.faultTolerance??FaultTolerance.FATAL_ALL}add(et){const tt=et[Symbol.toStringTag];if(tt==null)throw new InvalidParametersError$1("Transport must have a valid tag");if(this.transports.has(tt))throw new InvalidParametersError$1(`There is already a transport with the tag ${tt}`);this.log("adding transport %s",tt),this.transports.set(tt,et),this.listeners.has(tt)||this.listeners.set(tt,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){const et=this.components.addressManager.getListenAddrs();await this.listen(et)}async stop(){const et=[];for(const[tt,nt]of this.listeners)for(this.log("closing listeners for %s",tt);nt.length>0;){const rt=nt.pop();rt!=null&&et.push(rt.close())}await Promise.all(et),this.log("all listeners closed");for(const tt of this.listeners.keys())this.listeners.set(tt,[]);this.started=!1}async dial(et,tt){var rt;const nt=this.dialTransportForMultiaddr(et);if(nt==null)throw new TransportUnavailableError(`No transport available for address ${String(et)}`);return(rt=tt==null?void 0:tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("transport-manager:selected-transport",nt[Symbol.toStringTag])),nt.dial(et,{...tt,upgrader:this.components.upgrader})}getAddrs(){let et=[];for(const tt of this.listeners.values())for(const nt of tt)et=[...et,...nt.getAddrs()];return et}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}dialTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.dialFilter([et]).length>0)return tt}listenTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.listenFilter([et]).length>0)return tt}async listen(et){if(!this.isStarted())throw new NotStartedError("Not started");if(et==null||et.length===0){this.log("no addresses were provided for listening, this node is dial only");return}const tt=[];for(const[nt,rt]of this.transports.entries()){const ot=rt.listenFilter(et),it=[];for(const ct of ot){this.log("creating listener for %s on %a",nt,ct);const lt=rt.createListener({upgrader:this.components.upgrader});let dt=this.listeners.get(nt)??[];dt==null&&(dt=[],this.listeners.set(nt,dt)),dt.push(lt),lt.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:lt})}),lt.addEventListener("close",()=>{const ht=dt.findIndex(ft=>ft===lt);dt.splice(ht,1),this.components.events.safeDispatchEvent("transport:close",{detail:lt})}),it.push(lt.listen(ct))}if(it.length===0){tt.push(nt);continue}if((await Promise.allSettled(it)).find(ct=>ct.status==="fulfilled")==null&&this.faultTolerance!==FaultTolerance.NO_FATAL)throw new NoValidAddressesError(`Transport (${nt}) could not listen on any available address`)}if(tt.length===this.transports.size){const nt=`no valid addresses were provided for transports [${tt.join(", ")}]`;if(this.faultTolerance===FaultTolerance.FATAL_ALL)throw new NoValidAddressesError(nt);this.log(`libp2p in dial mode only: ${nt}`)}}async remove(et){const tt=this.listeners.get(et)??[];this.log.trace("removing transport %s",et);const nt=[];for(this.log.trace("closing listeners for %s",et);tt.length>0;){const rt=tt.pop();rt!=null&&nt.push(rt.close())}await Promise.all(nt),this.transports.delete(et),this.listeners.delete(et)}async removeAll(){const et=[];for(const tt of this.transports.keys())et.push(this.remove(tt));await Promise.all(et)}}const PROTOCOL_ID="/multistream/1.0.0",MAX_PROTOCOL_LENGTH=1024;class UnsupportedProtocolError extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}}Ct(UnsupportedProtocolError,"name","UnsupportedProtocolError");class InvalidMessageError extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}}Ct(InvalidMessageError,"name","InvalidMessageError");const NewLine=fromString(` `);async function write$1(o,et,tt){await o.write(et,tt)}async function writeAll(o,et,tt){await o.writeV(et,tt)}async function read(o,et){const tt=await o.read(et);if(tt.byteLength===0||tt.get(tt.byteLength-1)!==NewLine[0])throw et.log.error("Invalid mss message - missing newline",tt),new InvalidMessageError("Missing newline");return tt.sublist(0,-1)}async function readString(o,et){const tt=await read(o,et);return toString$8(tt.subarray())}async function select(o,et,tt){if(et=Array.isArray(et)?[...et]:[et],et.length===1&&tt.negotiateFully===!1)return optimisticSelect(o,et[0],tt);const nt=lpStream(o,{...tt,maxDataLength:MAX_PROTOCOL_LENGTH}),rt=et.shift();if(rt==null)throw new Error("At least one protocol must be specified");tt.log.trace('select: write ["%s", "%s"]',PROTOCOL_ID,rt);const ot=fromString(`${PROTOCOL_ID} `),it=fromString(`${rt} `);await writeAll(nt,[ot,it],tt),tt.log.trace("select: reading multistream-select header");let st=await readString(nt,tt);if(tt.log.trace('select: read "%s"',st),st===PROTOCOL_ID&&(tt.log.trace("select: reading protocol response"),st=await readString(nt,tt),tt.log.trace('select: read "%s"',st)),st===rt)return{stream:nt.unwrap(),protocol:rt};for(const at of et){tt.log.trace('select: write "%s"',at),await write$1(nt,fromString(`${at} -`),tt),tt.log.trace("select: reading protocol response");const ct=await readString(nt,tt);if(tt.log.trace('select: read "%s" for "%s"',ct,at),ct===at)return{stream:nt.unwrap(),protocol:at}}throw new UnsupportedProtocolError("protocol selection failed")}function optimisticSelect(o,et,tt){const nt=o.sink.bind(o),rt=o.source;let ot=!1,it=!1;const st=pDefer();let at=!1,ct=!1;const lt=pDefer();let dt=!1,ht=!1;const pt=pDefer(),mt=lpStream({sink:nt,source:rt},{...tt,maxDataLength:MAX_PROTOCOL_LENGTH});o.sink=async xt=>{const{sink:vt}=mt.unwrap();await vt(async function*(){let bt=!1;for await(const Et of xt){if(ct&&await lt.promise,at)yield Et;else{ct=!0,tt.log.trace('optimistic: write ["%s", "%s", data(%d)] in sink',PROTOCOL_ID,et,Et.byteLength);const wt=`${et} +`),tt),tt.log.trace("select: reading protocol response");const ct=await readString(nt,tt);if(tt.log.trace('select: read "%s" for "%s"',ct,at),ct===at)return{stream:nt.unwrap(),protocol:at}}throw new UnsupportedProtocolError("protocol selection failed")}function optimisticSelect(o,et,tt){const nt=o.sink.bind(o),rt=o.source;let ot=!1,it=!1;const st=pDefer();let at=!1,ct=!1;const lt=pDefer();let dt=!1,ht=!1;const ft=pDefer(),mt=lpStream({sink:nt,source:rt},{...tt,maxDataLength:MAX_PROTOCOL_LENGTH});o.sink=async xt=>{const{sink:vt}=mt.unwrap();await vt(async function*(){let bt=!1;for await(const Et of xt){if(ct&&await lt.promise,at)yield Et;else{ct=!0,tt.log.trace('optimistic: write ["%s", "%s", data(%d)] in sink',PROTOCOL_ID,et,Et.byteLength);const wt=`${et} `;yield new Uint8ArrayList(Uint8Array.from([19]),fromString(`${PROTOCOL_ID} -`),encode$a(wt.length),fromString(wt),Et).subarray(),tt.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink',PROTOCOL_ID,et,Et.byteLength),at=!0,ct=!1,lt.resolve(),ft().catch(kt=>{tt.log.error("could not finish optimistic protocol negotiation of %s",et,kt)})}bt=!0}bt||await ft()}())};async function ft(){if(it){tt.log.trace("optimistic: already negotiating %s stream",et),await st.promise;return}it=!0;try{at||(tt.log.trace("optimistic: doing send protocol for %s stream",et),await yt()),dt||(tt.log.trace("optimistic: doing read protocol for %s stream",et),await gt())}finally{it=!1,ot=!0,st.resolve()}}async function yt(){if(ct){await lt.promise;return}ct=!0;try{tt.log.trace('optimistic: write ["%s", "%s", data] in source',PROTOCOL_ID,et),await mt.writeV([fromString(`${PROTOCOL_ID} +`),encode$a(wt.length),fromString(wt),Et).subarray(),tt.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink',PROTOCOL_ID,et,Et.byteLength),at=!0,ct=!1,lt.resolve(),pt().catch(kt=>{tt.log.error("could not finish optimistic protocol negotiation of %s",et,kt)})}bt=!0}bt||await pt()}())};async function pt(){if(it){tt.log.trace("optimistic: already negotiating %s stream",et),await st.promise;return}it=!0;try{at||(tt.log.trace("optimistic: doing send protocol for %s stream",et),await yt()),dt||(tt.log.trace("optimistic: doing read protocol for %s stream",et),await gt())}finally{it=!1,ot=!0,st.resolve()}}async function yt(){if(ct){await lt.promise;return}ct=!0;try{tt.log.trace('optimistic: write ["%s", "%s", data] in source',PROTOCOL_ID,et),await mt.writeV([fromString(`${PROTOCOL_ID} `),fromString(`${et} -`)]),tt.log.trace('optimistic: wrote ["%s", "%s", data] in source',PROTOCOL_ID,et)}finally{at=!0,ct=!1,lt.resolve()}}async function gt(){if(ht){await pt.promise;return}ht=!0;try{tt.log.trace("optimistic: reading multistream select header");let xt=await readString(mt,tt);if(tt.log.trace('optimistic: read multistream select header "%s"',xt),xt===PROTOCOL_ID&&(xt=await readString(mt,tt)),tt.log.trace('optimistic: read protocol "%s", expecting "%s"',xt,et),xt!==et)throw new UnsupportedProtocolError("protocol selection failed")}finally{dt=!0,ht=!1,pt.resolve()}}if(o.source=async function*(){await ft(),tt.log.trace('optimistic: reading data from "%s" stream',et),yield*mt.unwrap().source}(),o.closeRead!=null){const xt=o.closeRead.bind(o);o.closeRead=async vt=>{ot||await ft().catch(bt=>{tt.log.error("could not negotiate protocol before close read",bt)}),await xt(vt)}}if(o.closeWrite!=null){const xt=o.closeWrite.bind(o);o.closeWrite=async vt=>{ot||await ft().catch(bt=>{tt.log.error("could not negotiate protocol before close write",bt)}),await xt(vt)}}if(o.close!=null){const xt=o.close.bind(o);o.close=async vt=>{const bt=[];ct&&bt.push(lt.promise),ht&&bt.push(pt.promise),bt.length>0?await raceSignal(Promise.all(bt),vt==null?void 0:vt.signal):(ot=!0,it=!1,st.resolve()),await xt(vt)}}return{stream:o,protocol:et}}async function handle(o,et,tt){et=Array.isArray(et)?et:[et],tt.log.trace("handle: available protocols %s",et);const nt=lpStream(o,{...tt,maxDataLength:MAX_PROTOCOL_LENGTH,maxLengthLength:2});for(;;){tt.log.trace("handle: reading incoming string");const rt=await readString(nt,tt);if(tt.log.trace('handle: read "%s"',rt),rt===PROTOCOL_ID){tt.log.trace('handle: respond with "%s" for "%s"',PROTOCOL_ID,rt),await write$1(nt,fromString(`${PROTOCOL_ID} +`)]),tt.log.trace('optimistic: wrote ["%s", "%s", data] in source',PROTOCOL_ID,et)}finally{at=!0,ct=!1,lt.resolve()}}async function gt(){if(ht){await ft.promise;return}ht=!0;try{tt.log.trace("optimistic: reading multistream select header");let xt=await readString(mt,tt);if(tt.log.trace('optimistic: read multistream select header "%s"',xt),xt===PROTOCOL_ID&&(xt=await readString(mt,tt)),tt.log.trace('optimistic: read protocol "%s", expecting "%s"',xt,et),xt!==et)throw new UnsupportedProtocolError("protocol selection failed")}finally{dt=!0,ht=!1,ft.resolve()}}if(o.source=async function*(){await pt(),tt.log.trace('optimistic: reading data from "%s" stream',et),yield*mt.unwrap().source}(),o.closeRead!=null){const xt=o.closeRead.bind(o);o.closeRead=async vt=>{ot||await pt().catch(bt=>{tt.log.error("could not negotiate protocol before close read",bt)}),await xt(vt)}}if(o.closeWrite!=null){const xt=o.closeWrite.bind(o);o.closeWrite=async vt=>{ot||await pt().catch(bt=>{tt.log.error("could not negotiate protocol before close write",bt)}),await xt(vt)}}if(o.close!=null){const xt=o.close.bind(o);o.close=async vt=>{const bt=[];ct&&bt.push(lt.promise),ht&&bt.push(ft.promise),bt.length>0?await raceSignal(Promise.all(bt),vt==null?void 0:vt.signal):(ot=!0,it=!1,st.resolve()),await xt(vt)}}return{stream:o,protocol:et}}async function handle(o,et,tt){et=Array.isArray(et)?et:[et],tt.log.trace("handle: available protocols %s",et);const nt=lpStream(o,{...tt,maxDataLength:MAX_PROTOCOL_LENGTH,maxLengthLength:2});for(;;){tt.log.trace("handle: reading incoming string");const rt=await readString(nt,tt);if(tt.log.trace('handle: read "%s"',rt),rt===PROTOCOL_ID){tt.log.trace('handle: respond with "%s" for "%s"',PROTOCOL_ID,rt),await write$1(nt,fromString(`${PROTOCOL_ID} `),tt),tt.log.trace('handle: responded with "%s" for "%s"',PROTOCOL_ID,rt);continue}if(et.includes(rt))return tt.log.trace('handle: respond with "%s" for "%s"',rt,rt),await write$1(nt,fromString(`${rt} `),tt),tt.log.trace('handle: responded with "%s" for "%s"',rt,rt),{stream:nt.unwrap(),protocol:rt};if(rt==="ls"){const ot=new Uint8ArrayList(...et.map(it=>encode$5.single(fromString(`${it} `))),fromString(` `));tt.log.trace('handle: respond with "%s" for %s',et,rt),await write$1(nt,ot,tt),tt.log.trace('handle: responded with "%s" for %s',et,rt);continue}tt.log.trace('handle: respond with "na" for "%s"',rt),await write$1(nt,fromString(`na -`),tt),tt.log('handle: responded with "na" for "%s"',rt)}}const CLOSE_TIMEOUT=500;var Wl,Gl;Gl=Symbol.toStringTag,Wl=connectionSymbol;class ConnectionImpl{constructor(et){Ct(this,"id");Ct(this,"remoteAddr");Ct(this,"remotePeer");Ct(this,"direction");Ct(this,"timeline");Ct(this,"multiplexer");Ct(this,"encryption");Ct(this,"status");Ct(this,"limits");Ct(this,"log");Ct(this,"tags");Ct(this,"_newStream");Ct(this,"_close");Ct(this,"_abort");Ct(this,"_getStreams");Ct(this,Gl,"Connection");Ct(this,Wl,!0);const{remoteAddr:tt,remotePeer:nt,newStream:rt,close:ot,abort:it,getStreams:st}=et;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=tt,this.remotePeer=nt,this.direction=et.direction,this.status="open",this.timeline=et.timeline,this.multiplexer=et.multiplexer,this.encryption=et.encryption,this.limits=et.limits,this.log=et.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=rt,this._close=ot,this._abort=it,this._getStreams=st,this.tags=[]}get streams(){return this._getStreams()}async newStream(et,tt){if(this.status==="closing")throw new ConnectionClosingError("the connection is being closed");if(this.status==="closed")throw new ConnectionClosedError("the connection is closed");if(Array.isArray(et)||(et=[et]),this.limits!=null&&(tt==null?void 0:tt.runOnLimitedConnection)!==!0)throw new LimitedConnectionError("Cannot open protocol stream on limited connection");const nt=await this._newStream(et,tt);return nt.direction="outbound",nt}async close(et={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",et.signal==null){const tt=AbortSignal.timeout(CLOSE_TIMEOUT);setMaxListeners(1/0,tt),et={...et,signal:tt}}try{this.log.trace("closing underlying transport"),await this._close(et),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(tt){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,tt),this.abort(tt)}}}abort(et){this.status!=="closed"&&(this.log.error("aborting connection to %a due to error",this.remoteAddr,et),this.status="closing",this._abort(et),this.status="closed",this.timeline.close=Date.now())}}function createConnection(o){return new ConnectionImpl(o)}function findIncomingStreamLimit(o,et){try{const{options:tt}=et.getHandler(o);return tt.maxInboundStreams}catch(tt){if(tt.name!=="UnhandledProtocolError")throw tt}return DEFAULT_MAX_INBOUND_STREAMS}function findOutgoingStreamLimit(o,et,tt={}){try{const{options:nt}=et.getHandler(o);if(nt.maxOutboundStreams!=null)return nt.maxOutboundStreams}catch(nt){if(nt.name!=="UnhandledProtocolError")throw nt}return tt.maxOutboundStreams??DEFAULT_MAX_OUTBOUND_STREAMS}function countStreams(o,et,tt){let nt=0;return tt.streams.forEach(rt=>{rt.direction===et&&rt.protocol===o&&nt++}),nt}var Kl;Kl=Symbol.toStringTag;class DefaultUpgrader{constructor(et,tt){Ct(this,"components");Ct(this,"connectionEncrypters");Ct(this,"streamMuxers");Ct(this,"inboundUpgradeTimeout");Ct(this,"outboundUpgradeTimeout");Ct(this,"inboundStreamProtocolNegotiationTimeout");Ct(this,"outboundStreamProtocolNegotiationTimeout");Ct(this,"events");Ct(this,"metrics");Ct(this,Kl,"@libp2p/upgrader");var nt,rt;this.components=et,this.connectionEncrypters=new Map,tt.connectionEncrypters.forEach(ot=>{this.connectionEncrypters.set(ot.protocol,ot)}),this.streamMuxers=new Map,tt.streamMuxers.forEach(ot=>{this.streamMuxers.set(ot.protocol,ot)}),this.inboundUpgradeTimeout=tt.inboundUpgradeTimeout??UPGRADE_TIMEOUT,this.outboundUpgradeTimeout=tt.outboundUpgradeTimeout??UPGRADE_TIMEOUT,this.inboundStreamProtocolNegotiationTimeout=tt.inboundStreamProtocolNegotiationTimeout??PROTOCOL_NEGOTIATION_TIMEOUT,this.outboundStreamProtocolNegotiationTimeout=tt.outboundStreamProtocolNegotiationTimeout??PROTOCOL_NEGOTIATION_TIMEOUT,this.events=et.events,this.metrics={dials:(nt=et.metrics)==null?void 0:nt.registerCounterGroup("libp2p_connection_manager_dials_total"),errors:(rt=et.metrics)==null?void 0:rt.registerCounterGroup("libp2p_connection_manager_dial_errors_total")}}async shouldBlockConnection(et,...tt){const nt=this.components.connectionGater[et];if(nt==null)return;if(await nt.apply(this.components.connectionGater,tt)===!0)throw new ConnectionInterceptedError(`The multiaddr connection is blocked by gater.${et}`)}async upgradeInbound(et,tt={}){var nt,rt;try{if((nt=this.metrics.dials)==null||nt.increment({inbound:!0}),!await this.components.connectionManager.acceptIncomingConnection(et))throw new ConnectionDeniedError("connection denied");return await this.shouldBlockConnection("denyInboundConnection",et),await this._performUpgrade(et,"inbound",tt)}catch(ot){throw(rt=this.metrics.errors)==null||rt.increment({inbound:!0}),ot}finally{this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(et,tt={}){var nt,rt;try{(nt=this.metrics.dials)==null||nt.increment({outbound:!0});const ot=et.remoteAddr.getPeerId();let it;return ot!=null&&(it=peerIdFromString$1(ot),await this.shouldBlockConnection("denyOutboundConnection",it,et)),await this._performUpgrade(et,"outbound",tt)}catch(ot){throw(rt=this.metrics.errors)==null||rt.increment({outbound:!0}),ot}}async _performUpgrade(et,tt,nt){var ht,pt,mt;let rt,ot,it,st,at;const ct=AbortSignal.timeout(tt==="inbound"?this.inboundUpgradeTimeout:this.outboundUpgradeTimeout),lt=anySignal([ct,nt.signal]);setMaxListeners(1/0,ct,lt),nt.signal=lt,(ht=this.components.metrics)==null||ht.trackMultiaddrConnection(et),et.log.trace("starting the %s connection upgrade",tt);let dt=et;if((nt==null?void 0:nt.skipProtection)!==!0){const ft=this.components.connectionProtector;ft!=null&&(et.log("protecting the %s connection",tt),dt=await ft.protect(et,nt))}try{if(rt=dt,(nt==null?void 0:nt.skipEncryption)!==!0){(pt=nt==null?void 0:nt.onProgress)==null||pt.call(nt,new CustomProgressEvent(`upgrader:encrypt-${tt}-connection`)),{conn:rt,remotePeer:ot,protocol:at}=await(tt==="inbound"?this._encryptInbound(dt,{...nt,signal:lt}):this._encryptOutbound(dt,{...nt,signal:lt}));const ft={...dt,...rt};await this.shouldBlockConnection(tt==="inbound"?"denyInboundEncryptedConnection":"denyOutboundEncryptedConnection",ot,ft)}else{const ft=et.remoteAddr.getPeerId();if(ft==null)throw new InvalidMultiaddrError(`${tt} connection that skipped encryption must have a peer id`);const yt=peerIdFromString$1(ft);at="native",ot=yt}if(ot.equals(this.components.peerId)){const ft=new InvalidPeerIdError("Can not dial self");throw et.abort(ft),ft}if(it=rt,(nt==null?void 0:nt.muxerFactory)!=null)st=nt.muxerFactory;else if(this.streamMuxers.size>0){(mt=nt==null?void 0:nt.onProgress)==null||mt.call(nt,new CustomProgressEvent(`upgrader:multiplex-${tt}-connection`));const ft=await(tt==="inbound"?this._multiplexInbound({...dt,...rt},this.streamMuxers,nt):this._multiplexOutbound({...dt,...rt},this.streamMuxers,nt));st=ft.muxerFactory,it=ft.stream}}catch(ft){throw et.log.error("failed to upgrade inbound connection %s %a - %e",tt==="inbound"?"from":"to",et.remoteAddr,ft),ft}finally{lt.clear()}return await this.shouldBlockConnection(tt==="inbound"?"denyInboundUpgradedConnection":"denyOutboundUpgradedConnection",ot,et),et.log("successfully upgraded %s connection",tt),this._createConnection({cryptoProtocol:at,direction:tt,maConn:et,upgradedConn:it,muxerFactory:st,remotePeer:ot,limits:nt==null?void 0:nt.limits})}_createConnection(et){const{cryptoProtocol:tt,direction:nt,maConn:rt,upgradedConn:ot,remotePeer:it,muxerFactory:st,limits:at}=et;let ct,lt,dt;st!=null&&(ct=st.createStreamMuxer({direction:nt,onIncomingStream:mt=>{dt!=null&&Promise.resolve().then(async()=>{var Et;const ft=this.components.registrar.getProtocols(),yt=AbortSignal.timeout(this.inboundStreamProtocolNegotiationTimeout);setMaxListeners(1/0,yt);const{stream:gt,protocol:xt}=await handle(mt,ft,{signal:yt,log:mt.log,yieldBytes:!1});if(dt==null)return;dt.log("incoming stream opened on %s",xt);const vt=findIncomingStreamLimit(xt,this.components.registrar);if(countStreams(xt,"inbound",dt)===vt){const wt=new TooManyInboundProtocolStreamsError(`Too many inbound protocol streams for protocol "${xt}" - limit ${vt}`);throw mt.abort(wt),wt}mt.source=gt.source,mt.sink=gt.sink,mt.protocol=xt,gt.closeWrite!=null&&(mt.closeWrite=gt.closeWrite),gt.closeRead!=null&&(mt.closeRead=gt.closeRead),gt.close!=null&&(mt.close=gt.close),await this.components.peerStore.merge(it,{protocols:[xt]}),(Et=this.components.metrics)==null||Et.trackProtocolStream(mt,dt),this._onStream({connection:dt,stream:mt,protocol:xt})}).catch(async ft=>{dt.log.error("error handling incoming stream id %s - %e",mt.id,ft),mt.timeline.close==null&&await mt.close()})}}),lt=async(mt,ft={})=>{var gt;if(ct==null)throw new MuxerUnavailableError("Connection is not multiplexed");dt.log.trace("starting new stream for protocols %s",mt);const yt=await ct.newStream();dt.log.trace("started new stream %s for protocols %s",yt.id,mt);try{if(ft.signal==null){yt.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",mt);const wt=AbortSignal.timeout(this.outboundStreamProtocolNegotiationTimeout);setMaxListeners(1/0,wt),ft={...ft,signal:wt}}yt.log.trace("selecting protocol from protocols %s",mt);const{stream:xt,protocol:vt}=await select(yt,mt,{...ft,log:yt.log,yieldBytes:!0});yt.log.trace("selected protocol %s",vt);const bt=findOutgoingStreamLimit(vt,this.components.registrar,ft),Et=countStreams(vt,"outbound",dt);if(Et>=bt){const wt=new TooManyOutboundProtocolStreamsError(`Too many outbound protocol streams for protocol "${vt}" - ${Et}/${bt}`);throw yt.abort(wt),wt}return await this.components.peerStore.merge(it,{protocols:[vt]}),yt.source=xt.source,yt.sink=xt.sink,yt.protocol=vt,xt.closeWrite!=null&&(yt.closeWrite=xt.closeWrite),xt.closeRead!=null&&(yt.closeRead=xt.closeRead),xt.close!=null&&(yt.close=xt.close),(gt=this.components.metrics)==null||gt.trackProtocolStream(yt,dt),yt}catch(xt){throw dt.log.error("could not create new outbound stream on connection %s %a for protocols %s - %e",nt==="inbound"?"from":"to",et.maConn.remoteAddr,mt,xt),yt.timeline.close==null&&yt.abort(xt),xt}},Promise.all([ct.sink(ot.source),ot.sink(ct.source)]).catch(mt=>{dt.log.error("error piping data through muxer - %e",mt)}));const ht=rt.timeline;rt.timeline=new Proxy(ht,{set:(...mt)=>(mt[1]==="close"&&mt[2]!=null&&ht.close==null&&(async()=>{try{dt.status==="open"&&await dt.close()}catch(ft){dt.log.error("error closing connection after timeline close %e",ft)}finally{this.events.safeDispatchEvent("connection:close",{detail:dt})}})().catch(ft=>{dt.log.error("error thrown while dispatching connection:close event %e",ft)}),Reflect.set(...mt))}),rt.timeline.upgraded=Date.now();const pt=()=>{throw new MuxerUnavailableError("Connection is not multiplexed")};return dt=createConnection({remoteAddr:rt.remoteAddr,remotePeer:it,status:"open",direction:nt,timeline:rt.timeline,multiplexer:ct==null?void 0:ct.protocol,encryption:tt,limits:at,logger:this.components.logger,newStream:lt??pt,getStreams:()=>(ct==null?void 0:ct.streams)??[],close:async mt=>{await(ct==null?void 0:ct.close(mt)),await rt.close(mt)},abort:mt=>{rt.abort(mt),ct==null||ct.abort(mt)}}),this.events.safeDispatchEvent("connection:open",{detail:dt}),dt.__maConnTimeline=ht,dt}_onStream(et){const{connection:tt,stream:nt,protocol:rt}=et,{handler:ot,options:it}=this.components.registrar.getHandler(rt);if(tt.limits!=null&&it.runOnLimitedConnection!==!0)throw new LimitedConnectionError("Cannot open protocol stream on limited connection");ot({connection:tt,stream:nt})}async _encryptInbound(et,tt){const nt=Array.from(this.connectionEncrypters.keys());try{const{stream:rt,protocol:ot}=await handle(et,nt,{...tt,log:et.log}),it=this.connectionEncrypters.get(ot);if(it==null)throw new EncryptionFailedError(`no crypto module found for ${ot}`);return et.log("encrypting inbound connection to %a using %s",et.remoteAddr,ot),{...await it.secureInbound(rt,tt),protocol:ot}}catch(rt){throw et.log.error("encrypting inbound connection from %a failed",et.remoteAddr,rt),new EncryptionFailedError(rt.message)}}async _encryptOutbound(et,tt){const nt=Array.from(this.connectionEncrypters.keys());try{et.log.trace("selecting encrypter from %s",nt);const{stream:rt,protocol:ot}=await select(et,nt,{...tt,log:et.log,yieldBytes:!0}),it=this.connectionEncrypters.get(ot);if(it==null)throw new EncryptionFailedError(`no crypto module found for ${ot}`);return et.log("encrypting outbound connection to %a using %s",et.remoteAddr,ot),{...await it.secureOutbound(rt,tt),protocol:ot}}catch(rt){throw et.log.error("encrypting outbound connection to %a failed",et.remoteAddr,rt),new EncryptionFailedError(rt.message)}}async _multiplexOutbound(et,tt,nt){const rt=Array.from(tt.keys());et.log("outbound selecting muxer %s",rt);try{et.log.trace("selecting stream muxer from %s",rt);const{stream:ot,protocol:it}=await select(et,rt,{...nt,log:et.log,yieldBytes:!0});et.log("selected %s as muxer protocol",it);const st=tt.get(it);return{stream:ot,muxerFactory:st}}catch(ot){throw et.log.error("error multiplexing outbound connection",ot),new MuxerUnavailableError(String(ot))}}async _multiplexInbound(et,tt,nt){const rt=Array.from(tt.keys());et.log("inbound handling muxers %s",rt);try{const{stream:ot,protocol:it}=await handle(et,rt,{...nt,log:et.log}),st=tt.get(it);return{stream:ot,muxerFactory:st}}catch(ot){throw et.log.error("error multiplexing inbound connection",ot),new MuxerUnavailableError(String(ot))}}}const version$3="2.1.8",name$2="libp2p";var po,Ms;class Libp2p extends TypedEventEmitter{constructor(tt){var at,ct,lt,dt,ht,pt;super();fn(this,po);Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"contentRouting");Ct(this,"peerRouting");Ct(this,"metrics");Ct(this,"services");Ct(this,"logger");Ct(this,"status");Ct(this,"components");Ct(this,"log");this.status="stopped";const nt=new TypedEventEmitter,rt=nt.dispatchEvent.bind(nt);nt.dispatchEvent=mt=>{const ft=rt(mt),yt=this.dispatchEvent(new CustomEvent(mt.type,{detail:mt.detail}));return ft||yt},setMaxListeners(1/0,nt),this.peerId=tt.peerId,this.logger=tt.logger??defaultLogger(),this.log=this.logger.forComponent("libp2p"),this.services={};const ot=this.components=defaultComponents({peerId:tt.peerId,privateKey:tt.privateKey,nodeInfo:tt.nodeInfo??{name:name$2,version:version$3},logger:this.logger,events:nt,datastore:tt.datastore??new MemoryDatastore,connectionGater:connectionGater(tt.connectionGater),dns:tt.dns});this.peerStore=this.configureComponent("peerStore",persistentPeerStore(ot,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...tt.peerStore})),tt.metrics!=null&&(this.metrics=this.configureComponent("metrics",tt.metrics(this.components))),ot.events.addEventListener("peer:update",mt=>{if(mt.detail.previous==null){const ft={id:mt.detail.peer.id,multiaddrs:mt.detail.peer.addresses.map(yt=>yt.multiaddr)};ot.events.safeDispatchEvent("peer:discovery",{detail:ft})}}),tt.connectionProtector!=null&&this.configureComponent("connectionProtector",tt.connectionProtector(ot)),this.components.upgrader=new DefaultUpgrader(this.components,{connectionEncrypters:(tt.connectionEncrypters??[]).map((mt,ft)=>this.configureComponent(`connection-encryption-${ft}`,mt(this.components))),streamMuxers:(tt.streamMuxers??[]).map((mt,ft)=>this.configureComponent(`stream-muxers-${ft}`,mt(this.components))),inboundUpgradeTimeout:(at=tt.connectionManager)==null?void 0:at.inboundUpgradeTimeout,outboundUpgradeTimeout:(ct=tt.connectionManager)==null?void 0:ct.outboundUpgradeTimeout}),this.configureComponent("transportManager",new DefaultTransportManager(this.components,tt.transportManager)),this.configureComponent("connectionManager",new DefaultConnectionManager(this.components,tt.connectionManager)),((lt=tt.connectionMonitor)==null?void 0:lt.enabled)!==!1&&this.configureComponent("connectionMonitor",new ConnectionMonitor(this.components,tt.connectionMonitor)),this.configureComponent("registrar",new DefaultRegistrar(this.components)),this.configureComponent("addressManager",new DefaultAddressManager(this.components,tt.addresses));const it=(tt.peerRouters??[]).map((mt,ft)=>this.configureComponent(`peer-router-${ft}`,mt(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new DefaultPeerRouting(this.components,{routers:it}));const st=(tt.contentRouters??[]).map((mt,ft)=>this.configureComponent(`content-router-${ft}`,mt(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new CompoundContentRouting(this.components,{routers:st})),this.configureComponent("randomWalk",new RandomWalk(this.components)),(tt.peerDiscovery??[]).forEach((mt,ft)=>{this.configureComponent(`peer-discovery-${ft}`,mt(this.components)).addEventListener("peer",gt=>{gn(this,po,Ms).call(this,gt)})}),(dt=tt.transports)==null||dt.forEach((mt,ft)=>{this.components.transportManager.add(this.configureComponent(`transport-${ft}`,mt(this.components)))}),tt.services!=null)for(const mt of Object.keys(tt.services)){const ft=tt.services[mt],yt=ft(this.components);if(yt==null){this.log.error("service factory %s returned null or undefined instance",mt);continue}this.services[mt]=yt,this.configureComponent(mt,yt),yt[contentRoutingSymbol]!=null&&(this.log("registering service %s for content routing",mt),st.push(yt[contentRoutingSymbol])),yt[peerRoutingSymbol]!=null&&(this.log("registering service %s for peer routing",mt),it.push(yt[peerRoutingSymbol])),yt[peerDiscoverySymbol]!=null&&(this.log("registering service %s for peer discovery",mt),(pt=(ht=yt[peerDiscoverySymbol]).addEventListener)==null||pt.call(ht,"peer",gt=>{gn(this,po,Ms).call(this,gt)}))}checkServiceDependencies(ot)}configureComponent(tt,nt){return nt==null&&this.log.error("component %s was null or undefined",tt),this.components[tt]=nt,nt}async start(){var tt,nt,rt,ot;if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await((nt=(tt=this.components).beforeStart)==null?void 0:nt.call(tt)),await this.components.start(),await((ot=(rt=this.components).afterStart)==null?void 0:ot.call(rt)),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(it){throw this.log.error("An error occurred starting libp2p",it),this.status="started",await this.stop(),it}}}async stop(){var tt,nt,rt,ot;this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await((nt=(tt=this.components).beforeStop)==null?void 0:nt.call(tt)),await this.components.stop(),await((ot=(rt=this.components).afterStop)==null?void 0:ot.call(rt)),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(tt){return this.components.connectionManager.getConnections(tt)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){const tt=new PeerSet;for(const nt of this.components.connectionManager.getConnections())tt.add(nt.remotePeer);return Array.from(tt)}async dial(tt,nt={}){return this.components.connectionManager.openConnection(tt,{priority:75,...nt})}async dialProtocol(tt,nt,rt={}){if(nt==null)throw new InvalidParametersError$1("no protocols were provided to open a stream");if(nt=Array.isArray(nt)?nt:[nt],nt.length===0)throw new InvalidParametersError$1("no protocols were provided to open a stream");return(await this.dial(tt,rt)).newStream(nt,rt)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(tt,nt={}){isMultiaddr(tt)&&(tt=peerIdFromString$1(tt.getPeerId()??"")),await this.components.connectionManager.closeConnections(tt,nt)}async getPublicKey(tt,nt={}){if(this.log("getPublicKey %p",tt),tt.publicKey!=null)return tt.publicKey;try{const st=await this.peerStore.get(tt);if(st.id.publicKey!=null)return st.id.publicKey}catch(st){if(st.name!=="NotFoundError")throw st}const rt=concat$1([fromString("/pk/"),tt.toMultihash().bytes]),ot=await this.contentRouting.get(rt,nt),it=publicKeyFromProtobuf(ot);return await this.peerStore.patch(tt,{publicKey:it}),it}async handle(tt,nt,rt){Array.isArray(tt)||(tt=[tt]),await Promise.all(tt.map(async ot=>{await this.components.registrar.handle(ot,nt,rt)}))}async unhandle(tt){Array.isArray(tt)||(tt=[tt]),await Promise.all(tt.map(async nt=>{await this.components.registrar.unhandle(nt)}))}async register(tt,nt){return this.components.registrar.register(tt,nt)}unregister(tt){this.components.registrar.unregister(tt)}async isDialable(tt,nt={}){return this.components.connectionManager.isDialable(tt,nt)}}po=new WeakSet,Ms=function(tt){const{detail:nt}=tt;if(nt.id.toString()===this.peerId.toString()){this.log.error("peer discovery mechanism discovered self");return}this.components.peerStore.merge(nt.id,{multiaddrs:nt.multiaddrs}).catch(rt=>{this.log.error(rt)})};async function createLibp2p(o={}){o.privateKey??(o.privateKey=await generateKeyPair());const et=new Libp2p({...await validateConfig(o),peerId:peerIdFromPrivateKey(o.privateKey)});return o.start!==!1&&await et.start(),et}const enrTree={SANDBOX:"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im",TEST:"enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im"},DEFAULT_BOOTSTRAP_TAG_NAME="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE=50,DEFAULT_BOOTSTRAP_TAG_TTL=1e8,DEFAULT_NODE_REQUIREMENTS={store:1,filter:2,lightPush:2},ERR_INVALID_ID="Invalid record id",MULTIADDR_LENGTH_SIZE=2,__viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"}));/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const _0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_8n=BigInt(8),CURVE=Object.freeze({a:_0n,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:_1n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),divNearest=(o,et)=>(o+et/_2n)/et,endo={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(o){const{n:et}=CURVE,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest(ot*o,et),at=divNearest(-nt*o,et);let ct=mod(o-st*tt-at*rt,et),lt=mod(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalarEndo: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}},fieldLen=32,groupLen=32,hashLen=32,compressedLen=fieldLen+1,uncompressedLen=2*fieldLen+1;function weierstrass(o){const{a:et,b:tt}=CURVE,nt=mod(o*o),rt=mod(nt*o);return mod(rt+et*o+tt)}const USE_ENDOMORPHISM=CURVE.a===_0n;class ShaError extends Error{constructor(et){super(et)}}function assertJacPoint(o){if(!(o instanceof JacobianPoint))throw new TypeError("JacobianPoint expected")}class JacobianPoint{constructor(et,tt,nt){this.x=et,this.y=tt,this.z=nt}static fromAffine(et){if(!(et instanceof Point))throw new TypeError("JacobianPoint#fromAffine: expected Point");return et.equals(Point.ZERO)?JacobianPoint.ZERO:new JacobianPoint(et.x,et.y,_1n)}static toAffineBatch(et){const tt=invertBatch(et.map(nt=>nt.z));return et.map((nt,rt)=>nt.toAffine(tt[rt]))}static normalizeZ(et){return JacobianPoint.toAffineBatch(et).map(JacobianPoint.fromAffine)}equals(et){assertJacPoint(et);const{x:tt,y:nt,z:rt}=this,{x:ot,y:it,z:st}=et,at=mod(rt*rt),ct=mod(st*st),lt=mod(tt*ct),dt=mod(ot*at),ht=mod(mod(nt*st)*ct),pt=mod(mod(it*rt)*at);return lt===dt&&ht===pt}negate(){return new JacobianPoint(this.x,mod(-this.y),this.z)}double(){const{x:et,y:tt,z:nt}=this,rt=mod(et*et),ot=mod(tt*tt),it=mod(ot*ot),st=et+ot,at=mod(_2n*(mod(st*st)-rt-it)),ct=mod(_3n*rt),lt=mod(ct*ct),dt=mod(lt-_2n*at),ht=mod(ct*(at-dt)-_8n*it),pt=mod(_2n*tt*nt);return new JacobianPoint(dt,ht,pt)}add(et){assertJacPoint(et);const{x:tt,y:nt,z:rt}=this,{x:ot,y:it,z:st}=et;if(ot===_0n||it===_0n)return this;if(tt===_0n||nt===_0n)return et;const at=mod(rt*rt),ct=mod(st*st),lt=mod(tt*ct),dt=mod(ot*at),ht=mod(mod(nt*st)*ct),pt=mod(mod(it*rt)*at),mt=mod(dt-lt),ft=mod(pt-ht);if(mt===_0n)return ft===_0n?this.double():JacobianPoint.ZERO;const yt=mod(mt*mt),gt=mod(mt*yt),xt=mod(lt*yt),vt=mod(ft*ft-gt-_2n*xt),bt=mod(ft*(xt-vt)-ht*gt),Et=mod(rt*st*mt);return new JacobianPoint(vt,bt,Et)}subtract(et){return this.add(et.negate())}multiplyUnsafe(et){const tt=JacobianPoint.ZERO;if(typeof et=="bigint"&&et===_0n)return tt;let nt=normalizeScalar(et);if(nt===_1n)return this;if(!USE_ENDOMORPHISM){let dt=tt,ht=this;for(;nt>_0n;)nt&_1n&&(dt=dt.add(ht)),ht=ht.double(),nt>>=_1n;return dt}let{k1neg:rt,k1:ot,k2neg:it,k2:st}=endo.splitScalar(nt),at=tt,ct=tt,lt=this;for(;ot>_0n||st>_0n;)ot&_1n&&(at=at.add(lt)),st&_1n&&(ct=ct.add(lt)),lt=lt.double(),ot>>=_1n,st>>=_1n;return rt&&(at=at.negate()),it&&(ct=ct.negate()),ct=new JacobianPoint(mod(ct.x*endo.beta),ct.y,ct.z),at.add(ct)}precomputeWindow(et){const tt=USE_ENDOMORPHISM?128/et+1:256/et+1,nt=[];let rt=this,ot=rt;for(let it=0;it>=dt,mt>at&&(mt-=lt,et+=_1n);const ft=pt,yt=pt+Math.abs(mt)-1,gt=ht%2!==0,xt=mt<0;mt===0?it=it.add(constTimeNegate(gt,rt[ft])):ot=ot.add(constTimeNegate(xt,rt[yt]))}return{p:ot,f:it}}multiply(et,tt){let nt=normalizeScalar(et),rt,ot;if(USE_ENDOMORPHISM){const{k1neg:it,k1:st,k2neg:at,k2:ct}=endo.splitScalar(nt);let{p:lt,f:dt}=this.wNAF(st,tt),{p:ht,f:pt}=this.wNAF(ct,tt);lt=constTimeNegate(it,lt),ht=constTimeNegate(at,ht),ht=new JacobianPoint(mod(ht.x*endo.beta),ht.y,ht.z),rt=lt.add(ht),ot=dt.add(pt)}else{const{p:it,f:st}=this.wNAF(nt,tt);rt=it,ot=st}return JacobianPoint.normalizeZ([rt,ot])[0]}toAffine(et){const{x:tt,y:nt,z:rt}=this,ot=this.equals(JacobianPoint.ZERO);et==null&&(et=ot?_8n:invert(rt));const it=et,st=mod(it*it),at=mod(st*it),ct=mod(tt*st),lt=mod(nt*at),dt=mod(rt*it);if(ot)return Point.ZERO;if(dt!==_1n)throw new Error("invZ was invalid");return new Point(ct,lt)}}JacobianPoint.BASE=new JacobianPoint(CURVE.Gx,CURVE.Gy,_1n);JacobianPoint.ZERO=new JacobianPoint(_0n,_1n,_0n);function constTimeNegate(o,et){const tt=et.negate();return o?tt:et}const pointPrecomputes=new WeakMap;class Point{constructor(et,tt){this.x=et,this.y=tt}_setWindowSize(et){this._WINDOW_SIZE=et,pointPrecomputes.delete(this)}hasEvenY(){return this.y%_2n===_0n}static fromCompressedHex(et){const tt=et.length===32,nt=bytesToNumber(tt?et:et.subarray(1));if(!isValidFieldElement(nt))throw new Error("Point is not on curve");const rt=weierstrass(nt);let ot=sqrtMod(rt);const it=(ot&_1n)===_1n;tt?it&&(ot=mod(-ot)):(et[0]&1)===1!==it&&(ot=mod(-ot));const st=new Point(nt,ot);return st.assertValidity(),st}static fromUncompressedHex(et){const tt=bytesToNumber(et.subarray(1,fieldLen+1)),nt=bytesToNumber(et.subarray(fieldLen+1,fieldLen*2+1)),rt=new Point(tt,nt);return rt.assertValidity(),rt}static fromHex(et){const tt=ensureBytes(et),nt=tt.length,rt=tt[0];if(nt===fieldLen)return this.fromCompressedHex(tt);if(nt===compressedLen&&(rt===2||rt===3))return this.fromCompressedHex(tt);if(nt===uncompressedLen&&rt===4)return this.fromUncompressedHex(tt);throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${nt}`)}static fromPrivateKey(et){return Point.BASE.multiply(normalizePrivateKey(et))}static fromSignature(et,tt,nt){const{r:rt,s:ot}=normalizeSignature(tt);if(![0,1,2,3].includes(nt))throw new Error("Cannot recover: invalid recovery bit");const it=truncateHash(ensureBytes(et)),{n:st}=CURVE,at=nt===2||nt===3?rt+st:rt,ct=invert(at,st),lt=mod(-it*ct,st),dt=mod(ot*ct,st),ht=nt&1?"03":"02",pt=Point.fromHex(ht+numTo32bStr(at)),mt=Point.BASE.multiplyAndAddUnsafe(pt,lt,dt);if(!mt)throw new Error("Cannot recover signature: point at infinify");return mt.assertValidity(),mt}toRawBytes(et=!1){return hexToBytes(this.toHex(et))}toHex(et=!1){const tt=numTo32bStr(this.x);return et?`${this.hasEvenY()?"02":"03"}${tt}`:`04${tt}${numTo32bStr(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const et="Point is not on elliptic curve",{x:tt,y:nt}=this;if(!isValidFieldElement(tt)||!isValidFieldElement(nt))throw new Error(et);const rt=mod(nt*nt),ot=weierstrass(tt);if(mod(rt-ot)!==_0n)throw new Error(et)}equals(et){return this.x===et.x&&this.y===et.y}negate(){return new Point(this.x,mod(-this.y))}double(){return JacobianPoint.fromAffine(this).double().toAffine()}add(et){return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(et)).toAffine()}subtract(et){return this.add(et.negate())}multiply(et){return JacobianPoint.fromAffine(this).multiply(et,this).toAffine()}multiplyAndAddUnsafe(et,tt,nt){const rt=JacobianPoint.fromAffine(this),ot=tt===_0n||tt===_1n||this!==Point.BASE?rt.multiplyUnsafe(tt):rt.multiply(tt),it=JacobianPoint.fromAffine(et).multiplyUnsafe(nt),st=ot.add(it);return st.equals(JacobianPoint.ZERO)?void 0:st.toAffine()}}Point.BASE=new Point(CURVE.Gx,CURVE.Gy);Point.ZERO=new Point(_0n,_0n);function sliceDER(o){return Number.parseInt(o[0],16)>=8?"00"+o:o}function parseDERInt(o){if(o.length<2||o[0]!==2)throw new Error(`Invalid signature integer tag: ${bytesToHex(o)}`);const et=o[1],tt=o.subarray(2,et+2);if(!et||tt.length!==et)throw new Error("Invalid signature integer: wrong length");if(tt[0]===0&&tt[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:bytesToNumber(tt),left:o.subarray(et+2)}}function parseDERSignature(o){if(o.length<2||o[0]!=48)throw new Error(`Invalid signature tag: ${bytesToHex(o)}`);if(o[1]!==o.length-2)throw new Error("Invalid signature: incorrect length");const{data:et,left:tt}=parseDERInt(o.subarray(2)),{data:nt,left:rt}=parseDERInt(tt);if(rt.length)throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(rt)}`);return{r:et,s:nt}}class Signature{constructor(et,tt){this.r=et,this.s=tt,this.assertValidity()}static fromCompact(et){const tt=et instanceof Uint8Array,nt="Signature.fromCompact";if(typeof et!="string"&&!tt)throw new TypeError(`${nt}: Expected string or Uint8Array`);const rt=tt?bytesToHex(et):et;if(rt.length!==128)throw new Error(`${nt}: Expected 64-byte hex`);return new Signature(hexToNumber(rt.slice(0,64)),hexToNumber(rt.slice(64,128)))}static fromDER(et){const tt=et instanceof Uint8Array;if(typeof et!="string"&&!tt)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:nt,s:rt}=parseDERSignature(tt?et:hexToBytes(et));return new Signature(nt,rt)}static fromHex(et){return this.fromDER(et)}assertValidity(){const{r:et,s:tt}=this;if(!isWithinCurveOrder(et))throw new Error("Invalid Signature: r must be 0 < r < n");if(!isWithinCurveOrder(tt))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const et=CURVE.n>>_1n;return this.s>et}normalizeS(){return this.hasHighS()?new Signature(this.r,mod(-this.s,CURVE.n)):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){const et=sliceDER(numberToHexUnpadded(this.s)),tt=sliceDER(numberToHexUnpadded(this.r)),nt=et.length/2,rt=tt.length/2,ot=numberToHexUnpadded(nt),it=numberToHexUnpadded(rt);return`30${numberToHexUnpadded(rt+nt+4)}02${it}${tt}02${ot}${et}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numTo32bStr(this.r)+numTo32bStr(this.s)}}function concatBytes(...o){if(!o.every(nt=>nt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(o.length===1)return o[0];const et=o.reduce((nt,rt)=>nt+rt.length,0),tt=new Uint8Array(et);for(let nt=0,rt=0;ntet.toString(16).padStart(2,"0"));function bytesToHex(o){if(!(o instanceof Uint8Array))throw new Error("Expected Uint8Array");let et="";for(let tt=0;tt0)return BigInt(o);if(typeof o=="bigint"&&isWithinCurveOrder(o))return o;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function mod(o,et=CURVE.P){const tt=o%et;return tt>=_0n?tt:et+tt}function pow2(o,et){const{P:tt}=CURVE;let nt=o;for(;et-- >_0n;)nt*=nt,nt%=tt;return nt}function sqrtMod(o){const{P:et}=CURVE,tt=BigInt(6),nt=BigInt(11),rt=BigInt(22),ot=BigInt(23),it=BigInt(44),st=BigInt(88),at=o*o*o%et,ct=at*at*o%et,lt=pow2(ct,_3n)*ct%et,dt=pow2(lt,_3n)*ct%et,ht=pow2(dt,_2n)*at%et,pt=pow2(ht,nt)*ht%et,mt=pow2(pt,rt)*pt%et,ft=pow2(mt,it)*mt%et,yt=pow2(ft,st)*ft%et,gt=pow2(yt,it)*mt%et,xt=pow2(gt,_3n)*ct%et,vt=pow2(xt,ot)*pt%et,bt=pow2(vt,tt)*at%et,Et=pow2(bt,_2n);if(Et*Et%et!==o)throw new Error("Cannot find square root");return Et}function invert(o,et=CURVE.P){if(o===_0n||et<=_0n)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod(o,et),nt=et,rt=_0n,ot=_1n;for(;tt!==_0n;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n)throw new Error("invert: does not exist");return mod(rt,et)}function invertBatch(o,et=CURVE.P){const tt=new Array(o.length),nt=o.reduce((ot,it,st)=>it===_0n?ot:(tt[st]=ot,mod(ot*it,et)),_1n),rt=invert(nt,et);return o.reduceRight((ot,it,st)=>it===_0n?ot:(tt[st]=mod(ot*tt[st],et),mod(ot*it,et)),rt),tt}function bits2int_2(o){const et=o.length*8-groupLen*8,tt=bytesToNumber(o);return et>0?tt>>BigInt(et):tt}function truncateHash(o,et=!1){const tt=bits2int_2(o);if(et)return tt;const{n:nt}=CURVE;return tt>=nt?tt-nt:tt}let _sha256Sync,_hmacSha256Sync;class HmacDrbg{constructor(et,tt){if(this.hashLen=et,this.qByteLen=tt,typeof et!="number"||et<2)throw new Error("hashLen must be a number");if(typeof tt!="number"||tt<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(et).fill(1),this.k=new Uint8Array(et).fill(0),this.counter=0}hmac(...et){return utils.hmacSha256(this.k,...et)}hmacSync(...et){return _hmacSha256Sync(this.k,...et)}checkSync(){if(typeof _hmacSha256Sync!="function")throw new ShaError("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(et=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),et),this.v=await this.hmac(this.v),et.length!==0&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),et),this.v=await this.hmac(this.v))}reseedSync(et=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),et),this.v=this.hmacSync(this.v),et.length!==0&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),et),this.v=this.hmacSync(this.v))}async generate(){this.incr();let et=0;const tt=[];for(;et0)et=BigInt(o);else if(typeof o=="string"){if(o.length!==2*groupLen)throw new Error("Expected 32 bytes of private key");et=hexToNumber(o)}else if(o instanceof Uint8Array){if(o.length!==groupLen)throw new Error("Expected 32 bytes of private key");et=bytesToNumber(o)}else throw new TypeError("Expected valid private key");if(!isWithinCurveOrder(et))throw new Error("Expected private key: 0 < key < n");return et}function normalizePublicKey(o){return o instanceof Point?(o.assertValidity(),o):Point.fromHex(o)}function normalizeSignature(o){if(o instanceof Signature)return o.assertValidity(),o;try{return Signature.fromDER(o)}catch{return Signature.fromCompact(o)}}function bits2int(o){const et=o.length>fieldLen?o.slice(0,fieldLen):o;return bytesToNumber(et)}function bits2octets(o){const et=bits2int(o),tt=mod(et,CURVE.n);return int2octets(tt<_0n?et:tt)}function int2octets(o){return numTo32b(o)}function initSigArgs(o,et,tt){if(o==null)throw new Error(`sign: expected valid message hash, not "${o}"`);const nt=ensureBytes(o),rt=normalizePrivateKey(et),ot=[int2octets(rt),bits2octets(nt)];if(tt!=null){tt===!0&&(tt=utils.randomBytes(fieldLen));const at=ensureBytes(tt);if(at.length!==fieldLen)throw new Error(`sign: Expected ${fieldLen} bytes of extra data`);ot.push(at)}const it=concatBytes(...ot),st=bits2int(nt);return{seed:it,m:st,d:rt}}function finalizeSig(o,et){const{sig:tt,recovery:nt}=o,{der:rt,recovered:ot}=Object.assign({canonical:!0,der:!0},et),it=rt?tt.toDERRawBytes():tt.toCompactRawBytes();return ot?[it,nt]:it}async function sign$1(o,et,tt={}){const{seed:nt,m:rt,d:ot}=initSigArgs(o,et,tt.extraEntropy),it=new HmacDrbg(hashLen,groupLen);await it.reseed(nt);let st;for(;!(st=kmdToSig(await it.generate(),rt,ot,tt.canonical));)await it.reseed();return finalizeSig(st,tt)}const vopts={strict:!0};function verify(o,et,tt,nt=vopts){let rt;try{rt=normalizeSignature(o),et=ensureBytes(et)}catch{return!1}const{r:ot,s:it}=rt;if(nt.strict&&rt.hasHighS())return!1;const st=truncateHash(et);let at;try{at=normalizePublicKey(tt)}catch{return!1}const{n:ct}=CURVE,lt=invert(it,ct),dt=mod(st*lt,ct),ht=mod(ot*lt,ct),pt=Point.BASE.multiplyAndAddUnsafe(at,dt,ht);return pt?mod(pt.x,ct)===ot:!1}Point.BASE._setWindowSize(8);const crypto$1={node:__viteBrowserExternal$1,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0},TAGGED_HASH_PREFIXES={},utils={bytesToHex,hexToBytes,concatBytes,mod,invert,isValidPrivateKey(o){try{return normalizePrivateKey(o),!0}catch{return!1}},_bigintTo32Bytes:numTo32b,_normalizePrivateKey:normalizePrivateKey,hashToPrivateKey:o=>{o=ensureBytes(o);const et=groupLen+8;if(o.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");const tt=mod(bytesToNumber(o),CURVE.n-_1n)+_1n;return numTo32b(tt)},randomBytes:(o=32)=>{if(crypto$1.web)return crypto$1.web.getRandomValues(new Uint8Array(o));if(crypto$1.node){const{randomBytes:et}=crypto$1.node;return Uint8Array.from(et(o))}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>utils.hashToPrivateKey(utils.randomBytes(groupLen+8)),precompute(o=8,et=Point.BASE){const tt=et===Point.BASE?et:new Point(et.x,et.y);return tt._setWindowSize(o),tt.multiply(_3n),tt},sha256:async(...o)=>{if(crypto$1.web){const et=await crypto$1.web.subtle.digest("SHA-256",concatBytes(...o));return new Uint8Array(et)}else if(crypto$1.node){const{createHash:et}=crypto$1.node,tt=et("sha256");return o.forEach(nt=>tt.update(nt)),Uint8Array.from(tt.digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(o,...et)=>{if(crypto$1.web){const tt=await crypto$1.web.subtle.importKey("raw",o,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),nt=concatBytes(...et),rt=await crypto$1.web.subtle.sign("HMAC",tt,nt);return new Uint8Array(rt)}else if(crypto$1.node){const{createHmac:tt}=crypto$1.node,nt=tt("sha256",o);return et.forEach(rt=>nt.update(rt)),Uint8Array.from(nt.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(o,...et)=>{let tt=TAGGED_HASH_PREFIXES[o];if(tt===void 0){const nt=await utils.sha256(Uint8Array.from(o,rt=>rt.charCodeAt(0)));tt=concatBytes(nt,nt),TAGGED_HASH_PREFIXES[o]=tt}return utils.sha256(tt,...et)},taggedHashSync:(o,...et)=>{if(typeof _sha256Sync!="function")throw new ShaError("sha256Sync is undefined, you need to set it");let tt=TAGGED_HASH_PREFIXES[o];if(tt===void 0){const nt=_sha256Sync(Uint8Array.from(o,rt=>rt.charCodeAt(0)));tt=concatBytes(nt,nt),TAGGED_HASH_PREFIXES[o]=tt}return _sha256Sync(tt,...et)},_JacobianPoint:JacobianPoint};Object.defineProperties(utils,{sha256Sync:{configurable:!1,get(){return _sha256Sync},set(o){_sha256Sync||(_sha256Sync=o)}},hmacSha256Sync:{configurable:!1,get(){return _hmacSha256Sync},set(o){_hmacSha256Sync||(_hmacSha256Sync=o)}}});var sha3$1={exports:{}};(function(o){var et={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};/** +`),tt),tt.log('handle: responded with "na" for "%s"',rt)}}const CLOSE_TIMEOUT=500;var Ql,Yl;Yl=Symbol.toStringTag,Ql=connectionSymbol;class ConnectionImpl{constructor(et){Ct(this,"id");Ct(this,"remoteAddr");Ct(this,"remotePeer");Ct(this,"direction");Ct(this,"timeline");Ct(this,"multiplexer");Ct(this,"encryption");Ct(this,"status");Ct(this,"limits");Ct(this,"log");Ct(this,"tags");Ct(this,"_newStream");Ct(this,"_close");Ct(this,"_abort");Ct(this,"_getStreams");Ct(this,Yl,"Connection");Ct(this,Ql,!0);const{remoteAddr:tt,remotePeer:nt,newStream:rt,close:ot,abort:it,getStreams:st}=et;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=tt,this.remotePeer=nt,this.direction=et.direction,this.status="open",this.timeline=et.timeline,this.multiplexer=et.multiplexer,this.encryption=et.encryption,this.limits=et.limits,this.log=et.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=rt,this._close=ot,this._abort=it,this._getStreams=st,this.tags=[]}get streams(){return this._getStreams()}async newStream(et,tt){if(this.status==="closing")throw new ConnectionClosingError("the connection is being closed");if(this.status==="closed")throw new ConnectionClosedError("the connection is closed");if(Array.isArray(et)||(et=[et]),this.limits!=null&&(tt==null?void 0:tt.runOnLimitedConnection)!==!0)throw new LimitedConnectionError("Cannot open protocol stream on limited connection");const nt=await this._newStream(et,tt);return nt.direction="outbound",nt}async close(et={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",et.signal==null){const tt=AbortSignal.timeout(CLOSE_TIMEOUT);setMaxListeners(1/0,tt),et={...et,signal:tt}}try{this.log.trace("closing underlying transport"),await this._close(et),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(tt){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,tt),this.abort(tt)}}}abort(et){this.status!=="closed"&&(this.log.error("aborting connection to %a due to error",this.remoteAddr,et),this.status="closing",this._abort(et),this.status="closed",this.timeline.close=Date.now())}}function createConnection(o){return new ConnectionImpl(o)}function findIncomingStreamLimit(o,et){try{const{options:tt}=et.getHandler(o);return tt.maxInboundStreams}catch(tt){if(tt.name!=="UnhandledProtocolError")throw tt}return DEFAULT_MAX_INBOUND_STREAMS}function findOutgoingStreamLimit(o,et,tt={}){try{const{options:nt}=et.getHandler(o);if(nt.maxOutboundStreams!=null)return nt.maxOutboundStreams}catch(nt){if(nt.name!=="UnhandledProtocolError")throw nt}return tt.maxOutboundStreams??DEFAULT_MAX_OUTBOUND_STREAMS}function countStreams(o,et,tt){let nt=0;return tt.streams.forEach(rt=>{rt.direction===et&&rt.protocol===o&&nt++}),nt}var Zl;Zl=Symbol.toStringTag;class DefaultUpgrader{constructor(et,tt){Ct(this,"components");Ct(this,"connectionEncrypters");Ct(this,"streamMuxers");Ct(this,"inboundUpgradeTimeout");Ct(this,"outboundUpgradeTimeout");Ct(this,"inboundStreamProtocolNegotiationTimeout");Ct(this,"outboundStreamProtocolNegotiationTimeout");Ct(this,"events");Ct(this,"metrics");Ct(this,Zl,"@libp2p/upgrader");var nt,rt;this.components=et,this.connectionEncrypters=new Map,tt.connectionEncrypters.forEach(ot=>{this.connectionEncrypters.set(ot.protocol,ot)}),this.streamMuxers=new Map,tt.streamMuxers.forEach(ot=>{this.streamMuxers.set(ot.protocol,ot)}),this.inboundUpgradeTimeout=tt.inboundUpgradeTimeout??UPGRADE_TIMEOUT,this.outboundUpgradeTimeout=tt.outboundUpgradeTimeout??UPGRADE_TIMEOUT,this.inboundStreamProtocolNegotiationTimeout=tt.inboundStreamProtocolNegotiationTimeout??PROTOCOL_NEGOTIATION_TIMEOUT,this.outboundStreamProtocolNegotiationTimeout=tt.outboundStreamProtocolNegotiationTimeout??PROTOCOL_NEGOTIATION_TIMEOUT,this.events=et.events,this.metrics={dials:(nt=et.metrics)==null?void 0:nt.registerCounterGroup("libp2p_connection_manager_dials_total"),errors:(rt=et.metrics)==null?void 0:rt.registerCounterGroup("libp2p_connection_manager_dial_errors_total")}}async shouldBlockConnection(et,...tt){const nt=this.components.connectionGater[et];if(nt==null)return;if(await nt.apply(this.components.connectionGater,tt)===!0)throw new ConnectionInterceptedError(`The multiaddr connection is blocked by gater.${et}`)}async upgradeInbound(et,tt={}){var nt,rt;try{if((nt=this.metrics.dials)==null||nt.increment({inbound:!0}),!await this.components.connectionManager.acceptIncomingConnection(et))throw new ConnectionDeniedError("connection denied");return await this.shouldBlockConnection("denyInboundConnection",et),await this._performUpgrade(et,"inbound",tt)}catch(ot){throw(rt=this.metrics.errors)==null||rt.increment({inbound:!0}),ot}finally{this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(et,tt={}){var nt,rt;try{(nt=this.metrics.dials)==null||nt.increment({outbound:!0});const ot=et.remoteAddr.getPeerId();let it;return ot!=null&&(it=peerIdFromString$1(ot),await this.shouldBlockConnection("denyOutboundConnection",it,et)),await this._performUpgrade(et,"outbound",tt)}catch(ot){throw(rt=this.metrics.errors)==null||rt.increment({outbound:!0}),ot}}async _performUpgrade(et,tt,nt){var ht,ft,mt;let rt,ot,it,st,at;const ct=AbortSignal.timeout(tt==="inbound"?this.inboundUpgradeTimeout:this.outboundUpgradeTimeout),lt=anySignal([ct,nt.signal]);setMaxListeners(1/0,ct,lt),nt.signal=lt,(ht=this.components.metrics)==null||ht.trackMultiaddrConnection(et),et.log.trace("starting the %s connection upgrade",tt);let dt=et;if((nt==null?void 0:nt.skipProtection)!==!0){const pt=this.components.connectionProtector;pt!=null&&(et.log("protecting the %s connection",tt),dt=await pt.protect(et,nt))}try{if(rt=dt,(nt==null?void 0:nt.skipEncryption)!==!0){(ft=nt==null?void 0:nt.onProgress)==null||ft.call(nt,new CustomProgressEvent(`upgrader:encrypt-${tt}-connection`)),{conn:rt,remotePeer:ot,protocol:at}=await(tt==="inbound"?this._encryptInbound(dt,{...nt,signal:lt}):this._encryptOutbound(dt,{...nt,signal:lt}));const pt={...dt,...rt};await this.shouldBlockConnection(tt==="inbound"?"denyInboundEncryptedConnection":"denyOutboundEncryptedConnection",ot,pt)}else{const pt=et.remoteAddr.getPeerId();if(pt==null)throw new InvalidMultiaddrError(`${tt} connection that skipped encryption must have a peer id`);const yt=peerIdFromString$1(pt);at="native",ot=yt}if(ot.equals(this.components.peerId)){const pt=new InvalidPeerIdError("Can not dial self");throw et.abort(pt),pt}if(it=rt,(nt==null?void 0:nt.muxerFactory)!=null)st=nt.muxerFactory;else if(this.streamMuxers.size>0){(mt=nt==null?void 0:nt.onProgress)==null||mt.call(nt,new CustomProgressEvent(`upgrader:multiplex-${tt}-connection`));const pt=await(tt==="inbound"?this._multiplexInbound({...dt,...rt},this.streamMuxers,nt):this._multiplexOutbound({...dt,...rt},this.streamMuxers,nt));st=pt.muxerFactory,it=pt.stream}}catch(pt){throw et.log.error("failed to upgrade inbound connection %s %a - %e",tt==="inbound"?"from":"to",et.remoteAddr,pt),pt}finally{lt.clear()}return await this.shouldBlockConnection(tt==="inbound"?"denyInboundUpgradedConnection":"denyOutboundUpgradedConnection",ot,et),et.log("successfully upgraded %s connection",tt),this._createConnection({cryptoProtocol:at,direction:tt,maConn:et,upgradedConn:it,muxerFactory:st,remotePeer:ot,limits:nt==null?void 0:nt.limits})}_createConnection(et){const{cryptoProtocol:tt,direction:nt,maConn:rt,upgradedConn:ot,remotePeer:it,muxerFactory:st,limits:at}=et;let ct,lt,dt;st!=null&&(ct=st.createStreamMuxer({direction:nt,onIncomingStream:mt=>{dt!=null&&Promise.resolve().then(async()=>{var Et;const pt=this.components.registrar.getProtocols(),yt=AbortSignal.timeout(this.inboundStreamProtocolNegotiationTimeout);setMaxListeners(1/0,yt);const{stream:gt,protocol:xt}=await handle(mt,pt,{signal:yt,log:mt.log,yieldBytes:!1});if(dt==null)return;dt.log("incoming stream opened on %s",xt);const vt=findIncomingStreamLimit(xt,this.components.registrar);if(countStreams(xt,"inbound",dt)===vt){const wt=new TooManyInboundProtocolStreamsError(`Too many inbound protocol streams for protocol "${xt}" - limit ${vt}`);throw mt.abort(wt),wt}mt.source=gt.source,mt.sink=gt.sink,mt.protocol=xt,gt.closeWrite!=null&&(mt.closeWrite=gt.closeWrite),gt.closeRead!=null&&(mt.closeRead=gt.closeRead),gt.close!=null&&(mt.close=gt.close),await this.components.peerStore.merge(it,{protocols:[xt]}),(Et=this.components.metrics)==null||Et.trackProtocolStream(mt,dt),this._onStream({connection:dt,stream:mt,protocol:xt})}).catch(async pt=>{dt.log.error("error handling incoming stream id %s - %e",mt.id,pt),mt.timeline.close==null&&await mt.close()})}}),lt=async(mt,pt={})=>{var gt;if(ct==null)throw new MuxerUnavailableError("Connection is not multiplexed");dt.log.trace("starting new stream for protocols %s",mt);const yt=await ct.newStream();dt.log.trace("started new stream %s for protocols %s",yt.id,mt);try{if(pt.signal==null){yt.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",mt);const wt=AbortSignal.timeout(this.outboundStreamProtocolNegotiationTimeout);setMaxListeners(1/0,wt),pt={...pt,signal:wt}}yt.log.trace("selecting protocol from protocols %s",mt);const{stream:xt,protocol:vt}=await select(yt,mt,{...pt,log:yt.log,yieldBytes:!0});yt.log.trace("selected protocol %s",vt);const bt=findOutgoingStreamLimit(vt,this.components.registrar,pt),Et=countStreams(vt,"outbound",dt);if(Et>=bt){const wt=new TooManyOutboundProtocolStreamsError(`Too many outbound protocol streams for protocol "${vt}" - ${Et}/${bt}`);throw yt.abort(wt),wt}return await this.components.peerStore.merge(it,{protocols:[vt]}),yt.source=xt.source,yt.sink=xt.sink,yt.protocol=vt,xt.closeWrite!=null&&(yt.closeWrite=xt.closeWrite),xt.closeRead!=null&&(yt.closeRead=xt.closeRead),xt.close!=null&&(yt.close=xt.close),(gt=this.components.metrics)==null||gt.trackProtocolStream(yt,dt),yt}catch(xt){throw dt.log.error("could not create new outbound stream on connection %s %a for protocols %s - %e",nt==="inbound"?"from":"to",et.maConn.remoteAddr,mt,xt),yt.timeline.close==null&&yt.abort(xt),xt}},Promise.all([ct.sink(ot.source),ot.sink(ct.source)]).catch(mt=>{dt.log.error("error piping data through muxer - %e",mt)}));const ht=rt.timeline;rt.timeline=new Proxy(ht,{set:(...mt)=>(mt[1]==="close"&&mt[2]!=null&&ht.close==null&&(async()=>{try{dt.status==="open"&&await dt.close()}catch(pt){dt.log.error("error closing connection after timeline close %e",pt)}finally{this.events.safeDispatchEvent("connection:close",{detail:dt})}})().catch(pt=>{dt.log.error("error thrown while dispatching connection:close event %e",pt)}),Reflect.set(...mt))}),rt.timeline.upgraded=Date.now();const ft=()=>{throw new MuxerUnavailableError("Connection is not multiplexed")};return dt=createConnection({remoteAddr:rt.remoteAddr,remotePeer:it,status:"open",direction:nt,timeline:rt.timeline,multiplexer:ct==null?void 0:ct.protocol,encryption:tt,limits:at,logger:this.components.logger,newStream:lt??ft,getStreams:()=>(ct==null?void 0:ct.streams)??[],close:async mt=>{await(ct==null?void 0:ct.close(mt)),await rt.close(mt)},abort:mt=>{rt.abort(mt),ct==null||ct.abort(mt)}}),this.events.safeDispatchEvent("connection:open",{detail:dt}),dt.__maConnTimeline=ht,dt}_onStream(et){const{connection:tt,stream:nt,protocol:rt}=et,{handler:ot,options:it}=this.components.registrar.getHandler(rt);if(tt.limits!=null&&it.runOnLimitedConnection!==!0)throw new LimitedConnectionError("Cannot open protocol stream on limited connection");ot({connection:tt,stream:nt})}async _encryptInbound(et,tt){const nt=Array.from(this.connectionEncrypters.keys());try{const{stream:rt,protocol:ot}=await handle(et,nt,{...tt,log:et.log}),it=this.connectionEncrypters.get(ot);if(it==null)throw new EncryptionFailedError(`no crypto module found for ${ot}`);return et.log("encrypting inbound connection to %a using %s",et.remoteAddr,ot),{...await it.secureInbound(rt,tt),protocol:ot}}catch(rt){throw et.log.error("encrypting inbound connection from %a failed",et.remoteAddr,rt),new EncryptionFailedError(rt.message)}}async _encryptOutbound(et,tt){const nt=Array.from(this.connectionEncrypters.keys());try{et.log.trace("selecting encrypter from %s",nt);const{stream:rt,protocol:ot}=await select(et,nt,{...tt,log:et.log,yieldBytes:!0}),it=this.connectionEncrypters.get(ot);if(it==null)throw new EncryptionFailedError(`no crypto module found for ${ot}`);return et.log("encrypting outbound connection to %a using %s",et.remoteAddr,ot),{...await it.secureOutbound(rt,tt),protocol:ot}}catch(rt){throw et.log.error("encrypting outbound connection to %a failed",et.remoteAddr,rt),new EncryptionFailedError(rt.message)}}async _multiplexOutbound(et,tt,nt){const rt=Array.from(tt.keys());et.log("outbound selecting muxer %s",rt);try{et.log.trace("selecting stream muxer from %s",rt);const{stream:ot,protocol:it}=await select(et,rt,{...nt,log:et.log,yieldBytes:!0});et.log("selected %s as muxer protocol",it);const st=tt.get(it);return{stream:ot,muxerFactory:st}}catch(ot){throw et.log.error("error multiplexing outbound connection",ot),new MuxerUnavailableError(String(ot))}}async _multiplexInbound(et,tt,nt){const rt=Array.from(tt.keys());et.log("inbound handling muxers %s",rt);try{const{stream:ot,protocol:it}=await handle(et,rt,{...nt,log:et.log}),st=tt.get(it);return{stream:ot,muxerFactory:st}}catch(ot){throw et.log.error("error multiplexing inbound connection",ot),new MuxerUnavailableError(String(ot))}}}const version$3="2.1.8",name$2="libp2p";var fo,Fs;class Libp2p extends TypedEventEmitter{constructor(tt){var at,ct,lt,dt,ht,ft;super();pn(this,fo);Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"contentRouting");Ct(this,"peerRouting");Ct(this,"metrics");Ct(this,"services");Ct(this,"logger");Ct(this,"status");Ct(this,"components");Ct(this,"log");this.status="stopped";const nt=new TypedEventEmitter,rt=nt.dispatchEvent.bind(nt);nt.dispatchEvent=mt=>{const pt=rt(mt),yt=this.dispatchEvent(new CustomEvent(mt.type,{detail:mt.detail}));return pt||yt},setMaxListeners(1/0,nt),this.peerId=tt.peerId,this.logger=tt.logger??defaultLogger(),this.log=this.logger.forComponent("libp2p"),this.services={};const ot=this.components=defaultComponents({peerId:tt.peerId,privateKey:tt.privateKey,nodeInfo:tt.nodeInfo??{name:name$2,version:version$3},logger:this.logger,events:nt,datastore:tt.datastore??new MemoryDatastore,connectionGater:connectionGater(tt.connectionGater),dns:tt.dns});this.peerStore=this.configureComponent("peerStore",persistentPeerStore(ot,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...tt.peerStore})),tt.metrics!=null&&(this.metrics=this.configureComponent("metrics",tt.metrics(this.components))),ot.events.addEventListener("peer:update",mt=>{if(mt.detail.previous==null){const pt={id:mt.detail.peer.id,multiaddrs:mt.detail.peer.addresses.map(yt=>yt.multiaddr)};ot.events.safeDispatchEvent("peer:discovery",{detail:pt})}}),tt.connectionProtector!=null&&this.configureComponent("connectionProtector",tt.connectionProtector(ot)),this.components.upgrader=new DefaultUpgrader(this.components,{connectionEncrypters:(tt.connectionEncrypters??[]).map((mt,pt)=>this.configureComponent(`connection-encryption-${pt}`,mt(this.components))),streamMuxers:(tt.streamMuxers??[]).map((mt,pt)=>this.configureComponent(`stream-muxers-${pt}`,mt(this.components))),inboundUpgradeTimeout:(at=tt.connectionManager)==null?void 0:at.inboundUpgradeTimeout,outboundUpgradeTimeout:(ct=tt.connectionManager)==null?void 0:ct.outboundUpgradeTimeout}),this.configureComponent("transportManager",new DefaultTransportManager(this.components,tt.transportManager)),this.configureComponent("connectionManager",new DefaultConnectionManager(this.components,tt.connectionManager)),((lt=tt.connectionMonitor)==null?void 0:lt.enabled)!==!1&&this.configureComponent("connectionMonitor",new ConnectionMonitor(this.components,tt.connectionMonitor)),this.configureComponent("registrar",new DefaultRegistrar(this.components)),this.configureComponent("addressManager",new DefaultAddressManager(this.components,tt.addresses));const it=(tt.peerRouters??[]).map((mt,pt)=>this.configureComponent(`peer-router-${pt}`,mt(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new DefaultPeerRouting(this.components,{routers:it}));const st=(tt.contentRouters??[]).map((mt,pt)=>this.configureComponent(`content-router-${pt}`,mt(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new CompoundContentRouting(this.components,{routers:st})),this.configureComponent("randomWalk",new RandomWalk(this.components)),(tt.peerDiscovery??[]).forEach((mt,pt)=>{this.configureComponent(`peer-discovery-${pt}`,mt(this.components)).addEventListener("peer",gt=>{gn(this,fo,Fs).call(this,gt)})}),(dt=tt.transports)==null||dt.forEach((mt,pt)=>{this.components.transportManager.add(this.configureComponent(`transport-${pt}`,mt(this.components)))}),tt.services!=null)for(const mt of Object.keys(tt.services)){const pt=tt.services[mt],yt=pt(this.components);if(yt==null){this.log.error("service factory %s returned null or undefined instance",mt);continue}this.services[mt]=yt,this.configureComponent(mt,yt),yt[contentRoutingSymbol]!=null&&(this.log("registering service %s for content routing",mt),st.push(yt[contentRoutingSymbol])),yt[peerRoutingSymbol]!=null&&(this.log("registering service %s for peer routing",mt),it.push(yt[peerRoutingSymbol])),yt[peerDiscoverySymbol]!=null&&(this.log("registering service %s for peer discovery",mt),(ft=(ht=yt[peerDiscoverySymbol]).addEventListener)==null||ft.call(ht,"peer",gt=>{gn(this,fo,Fs).call(this,gt)}))}checkServiceDependencies(ot)}configureComponent(tt,nt){return nt==null&&this.log.error("component %s was null or undefined",tt),this.components[tt]=nt,nt}async start(){var tt,nt,rt,ot;if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await((nt=(tt=this.components).beforeStart)==null?void 0:nt.call(tt)),await this.components.start(),await((ot=(rt=this.components).afterStart)==null?void 0:ot.call(rt)),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(it){throw this.log.error("An error occurred starting libp2p",it),this.status="started",await this.stop(),it}}}async stop(){var tt,nt,rt,ot;this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await((nt=(tt=this.components).beforeStop)==null?void 0:nt.call(tt)),await this.components.stop(),await((ot=(rt=this.components).afterStop)==null?void 0:ot.call(rt)),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(tt){return this.components.connectionManager.getConnections(tt)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){const tt=new PeerSet;for(const nt of this.components.connectionManager.getConnections())tt.add(nt.remotePeer);return Array.from(tt)}async dial(tt,nt={}){return this.components.connectionManager.openConnection(tt,{priority:75,...nt})}async dialProtocol(tt,nt,rt={}){if(nt==null)throw new InvalidParametersError$1("no protocols were provided to open a stream");if(nt=Array.isArray(nt)?nt:[nt],nt.length===0)throw new InvalidParametersError$1("no protocols were provided to open a stream");return(await this.dial(tt,rt)).newStream(nt,rt)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(tt,nt={}){isMultiaddr(tt)&&(tt=peerIdFromString$1(tt.getPeerId()??"")),await this.components.connectionManager.closeConnections(tt,nt)}async getPublicKey(tt,nt={}){if(this.log("getPublicKey %p",tt),tt.publicKey!=null)return tt.publicKey;try{const st=await this.peerStore.get(tt);if(st.id.publicKey!=null)return st.id.publicKey}catch(st){if(st.name!=="NotFoundError")throw st}const rt=concat$1([fromString("/pk/"),tt.toMultihash().bytes]),ot=await this.contentRouting.get(rt,nt),it=publicKeyFromProtobuf(ot);return await this.peerStore.patch(tt,{publicKey:it}),it}async handle(tt,nt,rt){Array.isArray(tt)||(tt=[tt]),await Promise.all(tt.map(async ot=>{await this.components.registrar.handle(ot,nt,rt)}))}async unhandle(tt){Array.isArray(tt)||(tt=[tt]),await Promise.all(tt.map(async nt=>{await this.components.registrar.unhandle(nt)}))}async register(tt,nt){return this.components.registrar.register(tt,nt)}unregister(tt){this.components.registrar.unregister(tt)}async isDialable(tt,nt={}){return this.components.connectionManager.isDialable(tt,nt)}}fo=new WeakSet,Fs=function(tt){const{detail:nt}=tt;if(nt.id.toString()===this.peerId.toString()){this.log.error("peer discovery mechanism discovered self");return}this.components.peerStore.merge(nt.id,{multiaddrs:nt.multiaddrs}).catch(rt=>{this.log.error(rt)})};async function createLibp2p(o={}){o.privateKey??(o.privateKey=await generateKeyPair());const et=new Libp2p({...await validateConfig(o),peerId:peerIdFromPrivateKey(o.privateKey)});return o.start!==!1&&await et.start(),et}var Protocols;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError||(ProtocolError={}));var Tags;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents||(EConnectionStateEvents={}));const DNS_DISCOVERY_TAG="@waku/bootstrap";var HealthStatus;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));const enrTree={SANDBOX:"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im",TEST:"enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im"},DEFAULT_BOOTSTRAP_TAG_NAME="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE=50,DEFAULT_BOOTSTRAP_TAG_TTL=1e8,DEFAULT_NODE_REQUIREMENTS={store:1,filter:2,lightPush:2},ERR_INVALID_ID="Invalid record id",MULTIADDR_LENGTH_SIZE=2,__viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"}));/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const _0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_8n=BigInt(8),CURVE=Object.freeze({a:_0n,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:_1n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),divNearest=(o,et)=>(o+et/_2n)/et,endo={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(o){const{n:et}=CURVE,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest(ot*o,et),at=divNearest(-nt*o,et);let ct=mod(o-st*tt-at*rt,et),lt=mod(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalarEndo: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}},fieldLen=32,groupLen=32,hashLen=32,compressedLen=fieldLen+1,uncompressedLen=2*fieldLen+1;function weierstrass(o){const{a:et,b:tt}=CURVE,nt=mod(o*o),rt=mod(nt*o);return mod(rt+et*o+tt)}const USE_ENDOMORPHISM=CURVE.a===_0n;class ShaError extends Error{constructor(et){super(et)}}function assertJacPoint(o){if(!(o instanceof JacobianPoint))throw new TypeError("JacobianPoint expected")}class JacobianPoint{constructor(et,tt,nt){this.x=et,this.y=tt,this.z=nt}static fromAffine(et){if(!(et instanceof Point))throw new TypeError("JacobianPoint#fromAffine: expected Point");return et.equals(Point.ZERO)?JacobianPoint.ZERO:new JacobianPoint(et.x,et.y,_1n)}static toAffineBatch(et){const tt=invertBatch(et.map(nt=>nt.z));return et.map((nt,rt)=>nt.toAffine(tt[rt]))}static normalizeZ(et){return JacobianPoint.toAffineBatch(et).map(JacobianPoint.fromAffine)}equals(et){assertJacPoint(et);const{x:tt,y:nt,z:rt}=this,{x:ot,y:it,z:st}=et,at=mod(rt*rt),ct=mod(st*st),lt=mod(tt*ct),dt=mod(ot*at),ht=mod(mod(nt*st)*ct),ft=mod(mod(it*rt)*at);return lt===dt&&ht===ft}negate(){return new JacobianPoint(this.x,mod(-this.y),this.z)}double(){const{x:et,y:tt,z:nt}=this,rt=mod(et*et),ot=mod(tt*tt),it=mod(ot*ot),st=et+ot,at=mod(_2n*(mod(st*st)-rt-it)),ct=mod(_3n*rt),lt=mod(ct*ct),dt=mod(lt-_2n*at),ht=mod(ct*(at-dt)-_8n*it),ft=mod(_2n*tt*nt);return new JacobianPoint(dt,ht,ft)}add(et){assertJacPoint(et);const{x:tt,y:nt,z:rt}=this,{x:ot,y:it,z:st}=et;if(ot===_0n||it===_0n)return this;if(tt===_0n||nt===_0n)return et;const at=mod(rt*rt),ct=mod(st*st),lt=mod(tt*ct),dt=mod(ot*at),ht=mod(mod(nt*st)*ct),ft=mod(mod(it*rt)*at),mt=mod(dt-lt),pt=mod(ft-ht);if(mt===_0n)return pt===_0n?this.double():JacobianPoint.ZERO;const yt=mod(mt*mt),gt=mod(mt*yt),xt=mod(lt*yt),vt=mod(pt*pt-gt-_2n*xt),bt=mod(pt*(xt-vt)-ht*gt),Et=mod(rt*st*mt);return new JacobianPoint(vt,bt,Et)}subtract(et){return this.add(et.negate())}multiplyUnsafe(et){const tt=JacobianPoint.ZERO;if(typeof et=="bigint"&&et===_0n)return tt;let nt=normalizeScalar(et);if(nt===_1n)return this;if(!USE_ENDOMORPHISM){let dt=tt,ht=this;for(;nt>_0n;)nt&_1n&&(dt=dt.add(ht)),ht=ht.double(),nt>>=_1n;return dt}let{k1neg:rt,k1:ot,k2neg:it,k2:st}=endo.splitScalar(nt),at=tt,ct=tt,lt=this;for(;ot>_0n||st>_0n;)ot&_1n&&(at=at.add(lt)),st&_1n&&(ct=ct.add(lt)),lt=lt.double(),ot>>=_1n,st>>=_1n;return rt&&(at=at.negate()),it&&(ct=ct.negate()),ct=new JacobianPoint(mod(ct.x*endo.beta),ct.y,ct.z),at.add(ct)}precomputeWindow(et){const tt=USE_ENDOMORPHISM?128/et+1:256/et+1,nt=[];let rt=this,ot=rt;for(let it=0;it>=dt,mt>at&&(mt-=lt,et+=_1n);const pt=ft,yt=ft+Math.abs(mt)-1,gt=ht%2!==0,xt=mt<0;mt===0?it=it.add(constTimeNegate(gt,rt[pt])):ot=ot.add(constTimeNegate(xt,rt[yt]))}return{p:ot,f:it}}multiply(et,tt){let nt=normalizeScalar(et),rt,ot;if(USE_ENDOMORPHISM){const{k1neg:it,k1:st,k2neg:at,k2:ct}=endo.splitScalar(nt);let{p:lt,f:dt}=this.wNAF(st,tt),{p:ht,f:ft}=this.wNAF(ct,tt);lt=constTimeNegate(it,lt),ht=constTimeNegate(at,ht),ht=new JacobianPoint(mod(ht.x*endo.beta),ht.y,ht.z),rt=lt.add(ht),ot=dt.add(ft)}else{const{p:it,f:st}=this.wNAF(nt,tt);rt=it,ot=st}return JacobianPoint.normalizeZ([rt,ot])[0]}toAffine(et){const{x:tt,y:nt,z:rt}=this,ot=this.equals(JacobianPoint.ZERO);et==null&&(et=ot?_8n:invert(rt));const it=et,st=mod(it*it),at=mod(st*it),ct=mod(tt*st),lt=mod(nt*at),dt=mod(rt*it);if(ot)return Point.ZERO;if(dt!==_1n)throw new Error("invZ was invalid");return new Point(ct,lt)}}JacobianPoint.BASE=new JacobianPoint(CURVE.Gx,CURVE.Gy,_1n);JacobianPoint.ZERO=new JacobianPoint(_0n,_1n,_0n);function constTimeNegate(o,et){const tt=et.negate();return o?tt:et}const pointPrecomputes=new WeakMap;class Point{constructor(et,tt){this.x=et,this.y=tt}_setWindowSize(et){this._WINDOW_SIZE=et,pointPrecomputes.delete(this)}hasEvenY(){return this.y%_2n===_0n}static fromCompressedHex(et){const tt=et.length===32,nt=bytesToNumber(tt?et:et.subarray(1));if(!isValidFieldElement(nt))throw new Error("Point is not on curve");const rt=weierstrass(nt);let ot=sqrtMod(rt);const it=(ot&_1n)===_1n;tt?it&&(ot=mod(-ot)):(et[0]&1)===1!==it&&(ot=mod(-ot));const st=new Point(nt,ot);return st.assertValidity(),st}static fromUncompressedHex(et){const tt=bytesToNumber(et.subarray(1,fieldLen+1)),nt=bytesToNumber(et.subarray(fieldLen+1,fieldLen*2+1)),rt=new Point(tt,nt);return rt.assertValidity(),rt}static fromHex(et){const tt=ensureBytes(et),nt=tt.length,rt=tt[0];if(nt===fieldLen)return this.fromCompressedHex(tt);if(nt===compressedLen&&(rt===2||rt===3))return this.fromCompressedHex(tt);if(nt===uncompressedLen&&rt===4)return this.fromUncompressedHex(tt);throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${nt}`)}static fromPrivateKey(et){return Point.BASE.multiply(normalizePrivateKey(et))}static fromSignature(et,tt,nt){const{r:rt,s:ot}=normalizeSignature(tt);if(![0,1,2,3].includes(nt))throw new Error("Cannot recover: invalid recovery bit");const it=truncateHash(ensureBytes(et)),{n:st}=CURVE,at=nt===2||nt===3?rt+st:rt,ct=invert(at,st),lt=mod(-it*ct,st),dt=mod(ot*ct,st),ht=nt&1?"03":"02",ft=Point.fromHex(ht+numTo32bStr(at)),mt=Point.BASE.multiplyAndAddUnsafe(ft,lt,dt);if(!mt)throw new Error("Cannot recover signature: point at infinify");return mt.assertValidity(),mt}toRawBytes(et=!1){return hexToBytes(this.toHex(et))}toHex(et=!1){const tt=numTo32bStr(this.x);return et?`${this.hasEvenY()?"02":"03"}${tt}`:`04${tt}${numTo32bStr(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const et="Point is not on elliptic curve",{x:tt,y:nt}=this;if(!isValidFieldElement(tt)||!isValidFieldElement(nt))throw new Error(et);const rt=mod(nt*nt),ot=weierstrass(tt);if(mod(rt-ot)!==_0n)throw new Error(et)}equals(et){return this.x===et.x&&this.y===et.y}negate(){return new Point(this.x,mod(-this.y))}double(){return JacobianPoint.fromAffine(this).double().toAffine()}add(et){return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(et)).toAffine()}subtract(et){return this.add(et.negate())}multiply(et){return JacobianPoint.fromAffine(this).multiply(et,this).toAffine()}multiplyAndAddUnsafe(et,tt,nt){const rt=JacobianPoint.fromAffine(this),ot=tt===_0n||tt===_1n||this!==Point.BASE?rt.multiplyUnsafe(tt):rt.multiply(tt),it=JacobianPoint.fromAffine(et).multiplyUnsafe(nt),st=ot.add(it);return st.equals(JacobianPoint.ZERO)?void 0:st.toAffine()}}Point.BASE=new Point(CURVE.Gx,CURVE.Gy);Point.ZERO=new Point(_0n,_0n);function sliceDER(o){return Number.parseInt(o[0],16)>=8?"00"+o:o}function parseDERInt(o){if(o.length<2||o[0]!==2)throw new Error(`Invalid signature integer tag: ${bytesToHex(o)}`);const et=o[1],tt=o.subarray(2,et+2);if(!et||tt.length!==et)throw new Error("Invalid signature integer: wrong length");if(tt[0]===0&&tt[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:bytesToNumber(tt),left:o.subarray(et+2)}}function parseDERSignature(o){if(o.length<2||o[0]!=48)throw new Error(`Invalid signature tag: ${bytesToHex(o)}`);if(o[1]!==o.length-2)throw new Error("Invalid signature: incorrect length");const{data:et,left:tt}=parseDERInt(o.subarray(2)),{data:nt,left:rt}=parseDERInt(tt);if(rt.length)throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(rt)}`);return{r:et,s:nt}}class Signature{constructor(et,tt){this.r=et,this.s=tt,this.assertValidity()}static fromCompact(et){const tt=et instanceof Uint8Array,nt="Signature.fromCompact";if(typeof et!="string"&&!tt)throw new TypeError(`${nt}: Expected string or Uint8Array`);const rt=tt?bytesToHex(et):et;if(rt.length!==128)throw new Error(`${nt}: Expected 64-byte hex`);return new Signature(hexToNumber(rt.slice(0,64)),hexToNumber(rt.slice(64,128)))}static fromDER(et){const tt=et instanceof Uint8Array;if(typeof et!="string"&&!tt)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:nt,s:rt}=parseDERSignature(tt?et:hexToBytes(et));return new Signature(nt,rt)}static fromHex(et){return this.fromDER(et)}assertValidity(){const{r:et,s:tt}=this;if(!isWithinCurveOrder(et))throw new Error("Invalid Signature: r must be 0 < r < n");if(!isWithinCurveOrder(tt))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const et=CURVE.n>>_1n;return this.s>et}normalizeS(){return this.hasHighS()?new Signature(this.r,mod(-this.s,CURVE.n)):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){const et=sliceDER(numberToHexUnpadded(this.s)),tt=sliceDER(numberToHexUnpadded(this.r)),nt=et.length/2,rt=tt.length/2,ot=numberToHexUnpadded(nt),it=numberToHexUnpadded(rt);return`30${numberToHexUnpadded(rt+nt+4)}02${it}${tt}02${ot}${et}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numTo32bStr(this.r)+numTo32bStr(this.s)}}function concatBytes(...o){if(!o.every(nt=>nt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(o.length===1)return o[0];const et=o.reduce((nt,rt)=>nt+rt.length,0),tt=new Uint8Array(et);for(let nt=0,rt=0;ntet.toString(16).padStart(2,"0"));function bytesToHex(o){if(!(o instanceof Uint8Array))throw new Error("Expected Uint8Array");let et="";for(let tt=0;tt0)return BigInt(o);if(typeof o=="bigint"&&isWithinCurveOrder(o))return o;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function mod(o,et=CURVE.P){const tt=o%et;return tt>=_0n?tt:et+tt}function pow2(o,et){const{P:tt}=CURVE;let nt=o;for(;et-- >_0n;)nt*=nt,nt%=tt;return nt}function sqrtMod(o){const{P:et}=CURVE,tt=BigInt(6),nt=BigInt(11),rt=BigInt(22),ot=BigInt(23),it=BigInt(44),st=BigInt(88),at=o*o*o%et,ct=at*at*o%et,lt=pow2(ct,_3n)*ct%et,dt=pow2(lt,_3n)*ct%et,ht=pow2(dt,_2n)*at%et,ft=pow2(ht,nt)*ht%et,mt=pow2(ft,rt)*ft%et,pt=pow2(mt,it)*mt%et,yt=pow2(pt,st)*pt%et,gt=pow2(yt,it)*mt%et,xt=pow2(gt,_3n)*ct%et,vt=pow2(xt,ot)*ft%et,bt=pow2(vt,tt)*at%et,Et=pow2(bt,_2n);if(Et*Et%et!==o)throw new Error("Cannot find square root");return Et}function invert(o,et=CURVE.P){if(o===_0n||et<=_0n)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod(o,et),nt=et,rt=_0n,ot=_1n;for(;tt!==_0n;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n)throw new Error("invert: does not exist");return mod(rt,et)}function invertBatch(o,et=CURVE.P){const tt=new Array(o.length),nt=o.reduce((ot,it,st)=>it===_0n?ot:(tt[st]=ot,mod(ot*it,et)),_1n),rt=invert(nt,et);return o.reduceRight((ot,it,st)=>it===_0n?ot:(tt[st]=mod(ot*tt[st],et),mod(ot*it,et)),rt),tt}function bits2int_2(o){const et=o.length*8-groupLen*8,tt=bytesToNumber(o);return et>0?tt>>BigInt(et):tt}function truncateHash(o,et=!1){const tt=bits2int_2(o);if(et)return tt;const{n:nt}=CURVE;return tt>=nt?tt-nt:tt}let _sha256Sync,_hmacSha256Sync;class HmacDrbg{constructor(et,tt){if(this.hashLen=et,this.qByteLen=tt,typeof et!="number"||et<2)throw new Error("hashLen must be a number");if(typeof tt!="number"||tt<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(et).fill(1),this.k=new Uint8Array(et).fill(0),this.counter=0}hmac(...et){return utils.hmacSha256(this.k,...et)}hmacSync(...et){return _hmacSha256Sync(this.k,...et)}checkSync(){if(typeof _hmacSha256Sync!="function")throw new ShaError("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(et=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),et),this.v=await this.hmac(this.v),et.length!==0&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),et),this.v=await this.hmac(this.v))}reseedSync(et=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),et),this.v=this.hmacSync(this.v),et.length!==0&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),et),this.v=this.hmacSync(this.v))}async generate(){this.incr();let et=0;const tt=[];for(;et0)et=BigInt(o);else if(typeof o=="string"){if(o.length!==2*groupLen)throw new Error("Expected 32 bytes of private key");et=hexToNumber(o)}else if(o instanceof Uint8Array){if(o.length!==groupLen)throw new Error("Expected 32 bytes of private key");et=bytesToNumber(o)}else throw new TypeError("Expected valid private key");if(!isWithinCurveOrder(et))throw new Error("Expected private key: 0 < key < n");return et}function normalizePublicKey(o){return o instanceof Point?(o.assertValidity(),o):Point.fromHex(o)}function normalizeSignature(o){if(o instanceof Signature)return o.assertValidity(),o;try{return Signature.fromDER(o)}catch{return Signature.fromCompact(o)}}function bits2int(o){const et=o.length>fieldLen?o.slice(0,fieldLen):o;return bytesToNumber(et)}function bits2octets(o){const et=bits2int(o),tt=mod(et,CURVE.n);return int2octets(tt<_0n?et:tt)}function int2octets(o){return numTo32b(o)}function initSigArgs(o,et,tt){if(o==null)throw new Error(`sign: expected valid message hash, not "${o}"`);const nt=ensureBytes(o),rt=normalizePrivateKey(et),ot=[int2octets(rt),bits2octets(nt)];if(tt!=null){tt===!0&&(tt=utils.randomBytes(fieldLen));const at=ensureBytes(tt);if(at.length!==fieldLen)throw new Error(`sign: Expected ${fieldLen} bytes of extra data`);ot.push(at)}const it=concatBytes(...ot),st=bits2int(nt);return{seed:it,m:st,d:rt}}function finalizeSig(o,et){const{sig:tt,recovery:nt}=o,{der:rt,recovered:ot}=Object.assign({canonical:!0,der:!0},et),it=rt?tt.toDERRawBytes():tt.toCompactRawBytes();return ot?[it,nt]:it}async function sign$1(o,et,tt={}){const{seed:nt,m:rt,d:ot}=initSigArgs(o,et,tt.extraEntropy),it=new HmacDrbg(hashLen,groupLen);await it.reseed(nt);let st;for(;!(st=kmdToSig(await it.generate(),rt,ot,tt.canonical));)await it.reseed();return finalizeSig(st,tt)}const vopts={strict:!0};function verify(o,et,tt,nt=vopts){let rt;try{rt=normalizeSignature(o),et=ensureBytes(et)}catch{return!1}const{r:ot,s:it}=rt;if(nt.strict&&rt.hasHighS())return!1;const st=truncateHash(et);let at;try{at=normalizePublicKey(tt)}catch{return!1}const{n:ct}=CURVE,lt=invert(it,ct),dt=mod(st*lt,ct),ht=mod(ot*lt,ct),ft=Point.BASE.multiplyAndAddUnsafe(at,dt,ht);return ft?mod(ft.x,ct)===ot:!1}Point.BASE._setWindowSize(8);const crypto$1={node:__viteBrowserExternal$1,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0},TAGGED_HASH_PREFIXES={},utils={bytesToHex,hexToBytes,concatBytes,mod,invert,isValidPrivateKey(o){try{return normalizePrivateKey(o),!0}catch{return!1}},_bigintTo32Bytes:numTo32b,_normalizePrivateKey:normalizePrivateKey,hashToPrivateKey:o=>{o=ensureBytes(o);const et=groupLen+8;if(o.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");const tt=mod(bytesToNumber(o),CURVE.n-_1n)+_1n;return numTo32b(tt)},randomBytes:(o=32)=>{if(crypto$1.web)return crypto$1.web.getRandomValues(new Uint8Array(o));if(crypto$1.node){const{randomBytes:et}=crypto$1.node;return Uint8Array.from(et(o))}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>utils.hashToPrivateKey(utils.randomBytes(groupLen+8)),precompute(o=8,et=Point.BASE){const tt=et===Point.BASE?et:new Point(et.x,et.y);return tt._setWindowSize(o),tt.multiply(_3n),tt},sha256:async(...o)=>{if(crypto$1.web){const et=await crypto$1.web.subtle.digest("SHA-256",concatBytes(...o));return new Uint8Array(et)}else if(crypto$1.node){const{createHash:et}=crypto$1.node,tt=et("sha256");return o.forEach(nt=>tt.update(nt)),Uint8Array.from(tt.digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(o,...et)=>{if(crypto$1.web){const tt=await crypto$1.web.subtle.importKey("raw",o,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),nt=concatBytes(...et),rt=await crypto$1.web.subtle.sign("HMAC",tt,nt);return new Uint8Array(rt)}else if(crypto$1.node){const{createHmac:tt}=crypto$1.node,nt=tt("sha256",o);return et.forEach(rt=>nt.update(rt)),Uint8Array.from(nt.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(o,...et)=>{let tt=TAGGED_HASH_PREFIXES[o];if(tt===void 0){const nt=await utils.sha256(Uint8Array.from(o,rt=>rt.charCodeAt(0)));tt=concatBytes(nt,nt),TAGGED_HASH_PREFIXES[o]=tt}return utils.sha256(tt,...et)},taggedHashSync:(o,...et)=>{if(typeof _sha256Sync!="function")throw new ShaError("sha256Sync is undefined, you need to set it");let tt=TAGGED_HASH_PREFIXES[o];if(tt===void 0){const nt=_sha256Sync(Uint8Array.from(o,rt=>rt.charCodeAt(0)));tt=concatBytes(nt,nt),TAGGED_HASH_PREFIXES[o]=tt}return _sha256Sync(tt,...et)},_JacobianPoint:JacobianPoint};Object.defineProperties(utils,{sha256Sync:{configurable:!1,get(){return _sha256Sync},set(o){_sha256Sync||(_sha256Sync=o)}},hmacSha256Sync:{configurable:!1,get(){return _hmacSha256Sync},set(o){_hmacSha256Sync||(_hmacSha256Sync=o)}}});var sha3$1={exports:{}};(function(o){var et={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.9.3 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2023 * @license MIT - */(function(){var tt="input is invalid type",nt="finalize already called",rt=typeof window=="object",ot=rt?window:{};ot.JS_SHA3_NO_WINDOW&&(rt=!1);var it=!rt&&typeof self=="object",st=!ot.JS_SHA3_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;st?ot=globalThis:it&&(ot=self);for(var at=!ot.JS_SHA3_NO_COMMON_JS&&!0&&o.exports,ct=!ot.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",lt="0123456789abcdef".split(""),dt=[31,7936,2031616,520093696],ht=[4,1024,262144,67108864],pt=[1,256,65536,16777216],mt=[6,1536,393216,100663296],ft=[0,8,16,24],yt=[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],gt=[224,256,384,512],xt=[128,256],vt=["hex","buffer","arrayBuffer","array","digest"],bt={128:168,256:136},Et=ot.JS_SHA3_NO_NODE_JS||!Array.isArray?function(_t){return Object.prototype.toString.call(_t)==="[object Array]"}:Array.isArray,wt=ct&&(ot.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(_t){return typeof _t=="object"&&_t.buffer&&_t.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,kt=function(_t){var Dt=typeof _t;if(Dt==="string")return[_t,!0];if(Dt!=="object"||_t===null)throw new Error(tt);if(ct&&_t.constructor===ArrayBuffer)return[new Uint8Array(_t),!1];if(!Et(_t)&&!wt(_t))throw new Error(tt);return[_t,!1]},It=function(_t){return kt(_t)[0].length===0},Rt=function(_t){for(var Dt=[],Vt=0;Vt<_t.length;++Vt)Dt[Vt]=_t[Vt];return Dt},Pt=function(_t,Dt,Vt){return function(en){return new Xt(_t,Dt,_t).update(en)[Vt]()}},jt=function(_t,Dt,Vt){return function(en,an){return new Xt(_t,Dt,an).update(en)[Vt]()}},Ot=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["cshake"+_t].update(en,an,dn,ln)[Vt]()}},Bt=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["kmac"+_t].update(en,an,dn,ln)[Vt]()}},zt=function(_t,Dt,Vt,en){for(var an=0;an>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Vt>>5,this.extraBytes=(Vt&31)>>3;for(var en=0;en<50;++en)this.s[en]=0}Xt.prototype.update=function(_t){if(this.finalized)throw new Error(nt);var Dt=kt(_t);_t=Dt[0];for(var Vt=Dt[1],en=this.blocks,an=this.byteCount,dn=_t.length,ln=this.blockCount,pn=0,kn=this.s,mn,wn;pn>2]|=wn<>2]|=(192|wn>>6)<>2]|=(128|wn&63)<=57344?(en[mn>>2]|=(224|wn>>12)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=(240|wn>>18)<>2]|=(128|wn>>12&63)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=_t[pn]<=an){for(this.start=mn-an,this.block=en[ln],mn=0;mn>8,Vt=_t&255;Vt>0;)an.unshift(Vt),_t=_t>>8,Vt=_t&255,++en;return Dt?an.push(en):an.unshift(en),this.update(an),an.length},Xt.prototype.encodeString=function(_t){var Dt=kt(_t);_t=Dt[0];var Vt=Dt[1],en=0,an=_t.length;if(Vt)for(var dn=0;dn<_t.length;++dn){var ln=_t.charCodeAt(dn);ln<128?en+=1:ln<2048?en+=2:ln<55296||ln>=57344?en+=3:(ln=65536+((ln&1023)<<10|_t.charCodeAt(++dn)&1023),en+=4)}else en=an;return en+=this.encode(en*8),this.update(_t),en},Xt.prototype.bytepad=function(_t,Dt){for(var Vt=this.encode(Dt),en=0;en<_t.length;++en)Vt+=this.encodeString(_t[en]);var an=(Dt-Vt%Dt)%Dt,dn=[];return dn.length=an,this.update(dn),this},Xt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var _t=this.blocks,Dt=this.lastByteIndex,Vt=this.blockCount,en=this.s;if(_t[Dt>>2]|=this.padding[Dt&3],this.lastByteIndex===this.byteCount)for(_t[0]=_t[Vt],Dt=1;Dt>4&15]+lt[pn&15]+lt[pn>>12&15]+lt[pn>>8&15]+lt[pn>>20&15]+lt[pn>>16&15]+lt[pn>>28&15]+lt[pn>>24&15];dn%_t===0&&(Dt=Rt(Dt),tn(Dt),an=0)}return en&&(pn=Dt[an],ln+=lt[pn>>4&15]+lt[pn&15],en>1&&(ln+=lt[pn>>12&15]+lt[pn>>8&15]),en>2&&(ln+=lt[pn>>20&15]+lt[pn>>16&15])),ln},Xt.prototype.arrayBuffer=function(){this.finalize();var _t=this.blockCount,Dt=this.s,Vt=this.outputBlocks,en=this.extraBytes,an=0,dn=0,ln=this.outputBits>>3,pn;en?pn=new ArrayBuffer(Vt+1<<2):pn=new ArrayBuffer(ln);for(var kn=new Uint32Array(pn);dn>8&255,ln[pn+2]=kn>>16&255,ln[pn+3]=kn>>24&255;dn%_t===0&&(Dt=Rt(Dt),tn(Dt))}return en&&(pn=dn<<2,kn=Dt[an],ln[pn]=kn&255,en>1&&(ln[pn+1]=kn>>8&255),en>2&&(ln[pn+2]=kn>>16&255)),ln};function Jt(_t,Dt,Vt){Xt.call(this,_t,Dt,Vt)}Jt.prototype=new Xt,Jt.prototype.finalize=function(){return this.encode(this.outputBits,!0),Xt.prototype.finalize.call(this)};var tn=function(_t){var Dt,Vt,en,an,dn,ln,pn,kn,mn,wn,Tn,Pn,yn,En,on,Tt,St,At,$t,Kt,rn,sn,xn,Rn,vn,An,bn,fo,mo,go,yo,xo,vo,bo,Eo,wo,Co,So,ko,Ao,Ro,_o,Io,To,Po,Lo,No,jo,$o,Oo,Mo,Bo,Do,Fo,Uo,zo,Vo,Ho,Wo,Go,qo,Ko,Qo;for(en=0;en<48;en+=2)an=_t[0]^_t[10]^_t[20]^_t[30]^_t[40],dn=_t[1]^_t[11]^_t[21]^_t[31]^_t[41],ln=_t[2]^_t[12]^_t[22]^_t[32]^_t[42],pn=_t[3]^_t[13]^_t[23]^_t[33]^_t[43],kn=_t[4]^_t[14]^_t[24]^_t[34]^_t[44],mn=_t[5]^_t[15]^_t[25]^_t[35]^_t[45],wn=_t[6]^_t[16]^_t[26]^_t[36]^_t[46],Tn=_t[7]^_t[17]^_t[27]^_t[37]^_t[47],Pn=_t[8]^_t[18]^_t[28]^_t[38]^_t[48],yn=_t[9]^_t[19]^_t[29]^_t[39]^_t[49],Dt=Pn^(ln<<1|pn>>>31),Vt=yn^(pn<<1|ln>>>31),_t[0]^=Dt,_t[1]^=Vt,_t[10]^=Dt,_t[11]^=Vt,_t[20]^=Dt,_t[21]^=Vt,_t[30]^=Dt,_t[31]^=Vt,_t[40]^=Dt,_t[41]^=Vt,Dt=an^(kn<<1|mn>>>31),Vt=dn^(mn<<1|kn>>>31),_t[2]^=Dt,_t[3]^=Vt,_t[12]^=Dt,_t[13]^=Vt,_t[22]^=Dt,_t[23]^=Vt,_t[32]^=Dt,_t[33]^=Vt,_t[42]^=Dt,_t[43]^=Vt,Dt=ln^(wn<<1|Tn>>>31),Vt=pn^(Tn<<1|wn>>>31),_t[4]^=Dt,_t[5]^=Vt,_t[14]^=Dt,_t[15]^=Vt,_t[24]^=Dt,_t[25]^=Vt,_t[34]^=Dt,_t[35]^=Vt,_t[44]^=Dt,_t[45]^=Vt,Dt=kn^(Pn<<1|yn>>>31),Vt=mn^(yn<<1|Pn>>>31),_t[6]^=Dt,_t[7]^=Vt,_t[16]^=Dt,_t[17]^=Vt,_t[26]^=Dt,_t[27]^=Vt,_t[36]^=Dt,_t[37]^=Vt,_t[46]^=Dt,_t[47]^=Vt,Dt=wn^(an<<1|dn>>>31),Vt=Tn^(dn<<1|an>>>31),_t[8]^=Dt,_t[9]^=Vt,_t[18]^=Dt,_t[19]^=Vt,_t[28]^=Dt,_t[29]^=Vt,_t[38]^=Dt,_t[39]^=Vt,_t[48]^=Dt,_t[49]^=Vt,En=_t[0],on=_t[1],Lo=_t[11]<<4|_t[10]>>>28,No=_t[10]<<4|_t[11]>>>28,fo=_t[20]<<3|_t[21]>>>29,mo=_t[21]<<3|_t[20]>>>29,Go=_t[31]<<9|_t[30]>>>23,qo=_t[30]<<9|_t[31]>>>23,_o=_t[40]<<18|_t[41]>>>14,Io=_t[41]<<18|_t[40]>>>14,bo=_t[2]<<1|_t[3]>>>31,Eo=_t[3]<<1|_t[2]>>>31,Tt=_t[13]<<12|_t[12]>>>20,St=_t[12]<<12|_t[13]>>>20,jo=_t[22]<<10|_t[23]>>>22,$o=_t[23]<<10|_t[22]>>>22,go=_t[33]<<13|_t[32]>>>19,yo=_t[32]<<13|_t[33]>>>19,Ko=_t[42]<<2|_t[43]>>>30,Qo=_t[43]<<2|_t[42]>>>30,Fo=_t[5]<<30|_t[4]>>>2,Uo=_t[4]<<30|_t[5]>>>2,wo=_t[14]<<6|_t[15]>>>26,Co=_t[15]<<6|_t[14]>>>26,At=_t[25]<<11|_t[24]>>>21,$t=_t[24]<<11|_t[25]>>>21,Oo=_t[34]<<15|_t[35]>>>17,Mo=_t[35]<<15|_t[34]>>>17,xo=_t[45]<<29|_t[44]>>>3,vo=_t[44]<<29|_t[45]>>>3,Rn=_t[6]<<28|_t[7]>>>4,vn=_t[7]<<28|_t[6]>>>4,zo=_t[17]<<23|_t[16]>>>9,Vo=_t[16]<<23|_t[17]>>>9,So=_t[26]<<25|_t[27]>>>7,ko=_t[27]<<25|_t[26]>>>7,Kt=_t[36]<<21|_t[37]>>>11,rn=_t[37]<<21|_t[36]>>>11,Bo=_t[47]<<24|_t[46]>>>8,Do=_t[46]<<24|_t[47]>>>8,To=_t[8]<<27|_t[9]>>>5,Po=_t[9]<<27|_t[8]>>>5,An=_t[18]<<20|_t[19]>>>12,bn=_t[19]<<20|_t[18]>>>12,Ho=_t[29]<<7|_t[28]>>>25,Wo=_t[28]<<7|_t[29]>>>25,Ao=_t[38]<<8|_t[39]>>>24,Ro=_t[39]<<8|_t[38]>>>24,sn=_t[48]<<14|_t[49]>>>18,xn=_t[49]<<14|_t[48]>>>18,_t[0]=En^~Tt&At,_t[1]=on^~St&$t,_t[10]=Rn^~An&fo,_t[11]=vn^~bn&mo,_t[20]=bo^~wo&So,_t[21]=Eo^~Co&ko,_t[30]=To^~Lo&jo,_t[31]=Po^~No&$o,_t[40]=Fo^~zo&Ho,_t[41]=Uo^~Vo&Wo,_t[2]=Tt^~At&Kt,_t[3]=St^~$t&rn,_t[12]=An^~fo&go,_t[13]=bn^~mo&yo,_t[22]=wo^~So&Ao,_t[23]=Co^~ko&Ro,_t[32]=Lo^~jo&Oo,_t[33]=No^~$o&Mo,_t[42]=zo^~Ho&Go,_t[43]=Vo^~Wo&qo,_t[4]=At^~Kt&sn,_t[5]=$t^~rn&xn,_t[14]=fo^~go&xo,_t[15]=mo^~yo&vo,_t[24]=So^~Ao&_o,_t[25]=ko^~Ro&Io,_t[34]=jo^~Oo&Bo,_t[35]=$o^~Mo&Do,_t[44]=Ho^~Go&Ko,_t[45]=Wo^~qo&Qo,_t[6]=Kt^~sn&En,_t[7]=rn^~xn&on,_t[16]=go^~xo&Rn,_t[17]=yo^~vo&vn,_t[26]=Ao^~_o&bo,_t[27]=Ro^~Io&Eo,_t[36]=Oo^~Bo&To,_t[37]=Mo^~Do&Po,_t[46]=Go^~Ko&Fo,_t[47]=qo^~Qo&Uo,_t[8]=sn^~En&Tt,_t[9]=xn^~on&St,_t[18]=xo^~Rn&An,_t[19]=vo^~vn&bn,_t[28]=_o^~bo&wo,_t[29]=Io^~Eo&Co,_t[38]=Bo^~To&Lo,_t[39]=Do^~Po&No,_t[48]=Ko^~Fo&zo,_t[49]=Qo^~Uo&Vo,_t[0]^=yt[en],_t[1]^=yt[en+1]};if(at)o.exports=Lt;else for(Qt=0;Qtot+MULTIADDR_LENGTH_SIZE+it.bytes.length,0),tt=new Uint8Array(et),nt=new DataView(tt.buffer);let rt=0;return o.forEach(ot=>{if(ot.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");nt.setUint16(rt,ot.bytes.length),rt+=MULTIADDR_LENGTH_SIZE,tt.set(ot.bytes,rt),rt+=ot.bytes.length}),tt}function encodeWaku2(o){let et=0;return o.lightPush&&(et+=1),et=et<<1,o.filter&&(et+=1),et=et<<1,o.store&&(et+=1),et=et<<1,o.relay&&(et+=1),et}function decodeWaku2(o){const et={relay:!1,store:!1,filter:!1,lightPush:!1};return o%2&&(et.relay=!0),o=o>>1,o%2&&(et.store=!0),o=o>>1,o%2&&(et.filter=!0),o=o>>1,o%2&&(et.lightPush=!0),et}class RawEnr extends Map{constructor(tt={},nt=BigInt(1),rt){super(Object.entries(tt));Ct(this,"seq");Ct(this,"signature");this.seq=nt,this.signature=rt}set(tt,nt){return this.signature=void 0,this.seq++,super.set(tt,nt)}get id(){const tt=this.get("id");if(!tt)throw new Error("id not found.");return bytesToUtf8(tt)}get publicKey(){switch(this.id){case"v4":return this.get("secp256k1");default:throw new Error(ERR_INVALID_ID)}}get rs(){const tt=this.get("rs");if(tt)return decodeRelayShard(tt)}get rsv(){const tt=this.get("rsv");if(tt)return decodeRelayShard(tt)}get ip(){return getStringValue(this,"ip","ip4")}set ip(tt){setStringValue(this,"ip","ip4",tt)}get tcp(){return getNumberAsStringValue(this,"tcp","tcp")}set tcp(tt){setNumberAsStringValue(this,"tcp","tcp",tt)}get udp(){return getNumberAsStringValue(this,"udp","udp")}set udp(tt){setNumberAsStringValue(this,"udp","udp",tt)}get ip6(){return getStringValue(this,"ip6","ip6")}set ip6(tt){setStringValue(this,"ip6","ip6",tt)}get tcp6(){return getNumberAsStringValue(this,"tcp6","tcp")}set tcp6(tt){setNumberAsStringValue(this,"tcp6","tcp",tt)}get udp6(){return getNumberAsStringValue(this,"udp6","udp")}set udp6(tt){setNumberAsStringValue(this,"udp6","udp",tt)}get multiaddrs(){const tt=this.get("multiaddrs");if(tt)return decodeMultiaddrs(tt)}set multiaddrs(tt){deleteUndefined(this,"multiaddrs",tt,encodeMultiaddrs)}get waku2(){const tt=this.get("waku2");if(tt)return decodeWaku2(tt[0])}set waku2(tt){deleteUndefined(this,"waku2",tt,nt=>new Uint8Array([encodeWaku2(nt)]))}}function getStringValue(o,et,tt){const nt=o.get(et);if(nt)return convertToString(tt,nt)}function getNumberAsStringValue(o,et,tt){const nt=o.get(et);if(nt)return Number(convertToString(tt,nt))}function setStringValue(o,et,tt,nt){deleteUndefined(o,et,nt,convertToBytes.bind({},tt))}function setNumberAsStringValue(o,et,tt,nt){setStringValue(o,et,tt,nt==null?void 0:nt.toString(10))}function deleteUndefined(o,et,tt,nt){tt!==void 0?o.set(et,nt(tt)):o.delete(et)}async function sign(o,et){return sign$1(keccak256(et),o,{der:!1})}function nodeId(o){const tt=Point.fromHex(o).toRawBytes(!1);return bytesToHex$1(keccak256(tt.slice(1)))}const log$9=new Logger$1("enr");var TransportProtocol;(function(o){o.TCP="tcp",o.UDP="udp"})(TransportProtocol||(TransportProtocol={}));var TransportProtocolPerIpVersion;(function(o){o.TCP4="tcp4",o.UDP4="udp4",o.TCP6="tcp6",o.UDP6="udp6"})(TransportProtocolPerIpVersion||(TransportProtocolPerIpVersion={}));const os=class os extends RawEnr{constructor(){super(...arguments);Ct(this,"peerId");Ct(this,"getLocationMultiaddr",locationMultiaddrFromEnrFields.bind({},this))}static create(tt={},nt=BigInt(1),rt){const ot=new os(tt,nt,rt);try{const it=ot.publicKey;it&&(ot.peerId=createPeerIdFromPublicKey(it))}catch(it){log$9.error("Could not calculate peer id for ENR",it)}return ot}get nodeId(){switch(this.id){case"v4":return this.publicKey?nodeId(this.publicKey):void 0;default:throw new Error(ERR_INVALID_ID)}}get shardInfo(){return this.rs&&this.rsv&&log$9.warn("ENR contains both `rs` and `rsv` fields."),this.rs||this.rsv}setLocationMultiaddr(tt){const nt=tt.protoNames();if(nt.length!==2&&nt[1]!=="udp"&&nt[1]!=="tcp")throw new Error("Invalid multiaddr");const rt=tt.tuples();if(!rt[0][1]||!rt[1][1])throw new Error("Invalid multiaddr");rt[0][0]===4?(this.set("ip",rt[0][1]),this.set(nt[1],rt[1][1])):(this.set("ip6",rt[0][1]),this.set(nt[1]+"6",rt[1][1]))}getAllLocationMultiaddrs(){const tt=[];for(const rt of Object.values(TransportProtocolPerIpVersion)){const ot=this.getLocationMultiaddr(rt);ot&&tt.push(ot)}const nt=this.multiaddrs??[];return tt.concat(nt).map(rt=>this.peerId?rt.encapsulate(`/p2p/${this.peerId.toString()}`):rt)}get peerInfo(){const tt=this.peerId;if(tt)return{id:tt,multiaddrs:this.getAllLocationMultiaddrs()}}getFullMultiaddr(tt){if(this.peerId){const nt=this.getLocationMultiaddr(tt);if(nt)return nt.encapsulate(`/p2p/${this.peerId.toString()}`)}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const tt=this.peerId;return this.multiaddrs.map(nt=>nt.encapsulate(`/p2p/${tt.toString()}`))}return[]}verify(tt,nt){if(!this.get("id")||this.id!=="v4")throw new Error(ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return verifySignature(nt,keccak256(tt),this.publicKey)}async sign(tt,nt){switch(this.id){case"v4":this.signature=await sign(nt,tt);break;default:throw new Error(ERR_INVALID_ID)}return this.signature}};Ct(os,"RECORD_PREFIX","enr:");let ENR=os;const version$2="logger/5.7.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const o=[];if(["NFD","NFC","NFKD","NFKC"].forEach(et=>{try{if("test".normalize(et)!=="test")throw new Error("bad normalize")}catch{o.push(et)}}),o.length)throw new Error("missing "+o.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(o){return o.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARNING="WARNING",o.ERROR="ERROR",o.OFF="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(o){o.UNKNOWN_ERROR="UNKNOWN_ERROR",o.NOT_IMPLEMENTED="NOT_IMPLEMENTED",o.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",o.NETWORK_ERROR="NETWORK_ERROR",o.SERVER_ERROR="SERVER_ERROR",o.TIMEOUT="TIMEOUT",o.BUFFER_OVERRUN="BUFFER_OVERRUN",o.NUMERIC_FAULT="NUMERIC_FAULT",o.MISSING_NEW="MISSING_NEW",o.INVALID_ARGUMENT="INVALID_ARGUMENT",o.MISSING_ARGUMENT="MISSING_ARGUMENT",o.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",o.CALL_EXCEPTION="CALL_EXCEPTION",o.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",o.NONCE_EXPIRED="NONCE_EXPIRED",o.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",o.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",o.TRANSACTION_REPLACED="TRANSACTION_REPLACED",o.ACTION_REJECTED="ACTION_REJECTED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{constructor(et){Object.defineProperty(this,"version",{enumerable:!0,value:et,writable:!1})}_log(et,tt){const nt=et.toLowerCase();LogLevels[nt]==null&&this.throwArgumentError("invalid log level name","logLevel",et),!(_logLevel>LogLevels[nt])&&console.log.apply(console,tt)}debug(...et){this._log(Logger.levels.DEBUG,et)}info(...et){this._log(Logger.levels.INFO,et)}warn(...et){this._log(Logger.levels.WARNING,et)}makeError(et,tt,nt){if(_censorErrors)return this.makeError("censored error",tt,{});tt||(tt=Logger.errors.UNKNOWN_ERROR),nt||(nt={});const rt=[];Object.keys(nt).forEach(at=>{const ct=nt[at];try{if(ct instanceof Uint8Array){let lt="";for(let dt=0;dt>4],lt+=HEX[ct[dt]&15];rt.push(at+"=Uint8Array(0x"+lt+")")}else rt.push(at+"="+JSON.stringify(ct))}catch{rt.push(at+"="+JSON.stringify(nt[at].toString()))}}),rt.push(`code=${tt}`),rt.push(`version=${this.version}`);const ot=et;let it="";switch(tt){case ErrorCode.NUMERIC_FAULT:{it="NUMERIC_FAULT";const at=et;switch(at){case"overflow":case"underflow":case"division-by-zero":it+="-"+at;break;case"negative-power":case"negative-width":it+="-unsupported";break;case"unbound-bitwise-result":it+="-unbound-result";break}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:it=tt;break}it&&(et+=" [ See: https://links.ethers.org/v5-errors-"+it+" ]"),rt.length&&(et+=" ("+rt.join(", ")+")");const st=new Error(et);return st.reason=ot,st.code=tt,Object.keys(nt).forEach(function(at){st[at]=nt[at]}),st}throwError(et,tt,nt){throw this.makeError(et,tt,nt)}throwArgumentError(et,tt,nt){return this.throwError(et,Logger.errors.INVALID_ARGUMENT,{argument:tt,value:nt})}assert(et,tt,nt,rt){et||this.throwError(tt,nt,rt)}assertArgument(et,tt,nt,rt){et||this.throwArgumentError(tt,nt,rt)}checkNormalize(et){_normalizeError&&this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(et,tt){typeof et=="number"&&(tt==null&&(tt="value not safe"),(et<0||et>=9007199254740991)&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:et}),et%1&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:et}))}checkArgumentCount(et,tt,nt){nt?nt=": "+nt:nt="",ettt&&this.throwError("too many arguments"+nt,Logger.errors.UNEXPECTED_ARGUMENT,{count:et,expectedCount:tt})}checkNew(et,tt){(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}checkAbstract(et,tt){et===tt?this.throwError("cannot instantiate abstract class "+JSON.stringify(tt.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:et.name,operation:"new"}):(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}static globalLogger(){return _globalLogger||(_globalLogger=new Logger(version$2)),_globalLogger}static setCensorship(et,tt){if(!et&&tt&&this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!et)return;this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!et,_permanentCensorErrors=!!tt}static setLogLevel(et){const tt=LogLevels[et.toLowerCase()];if(tt==null){Logger.globalLogger().warn("invalid log level - "+et);return}_logLevel=tt}static from(et){return new Logger(et)}}Logger.errors=ErrorCode;Logger.levels=LogLevel;const version$1="bytes/5.7.0",logger$1=new Logger(version$1);function isHexable(o){return!!o.toHexString}function addSlice(o){return o.slice||(o.slice=function(){const et=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(o,et)))}),o}function isBytesLike(o){return isHexString(o)&&!(o.length%2)||isBytes(o)}function isInteger(o){return typeof o=="number"&&o==o&&o%1===0}function isBytes(o){if(o==null)return!1;if(o.constructor===Uint8Array)return!0;if(typeof o=="string"||!isInteger(o.length)||o.length<0)return!1;for(let et=0;et=256)return!1}return!0}function arrayify(o,et){if(et||(et={}),typeof o=="number"){logger$1.checkSafeUint53(o,"invalid arrayify value");const tt=[];for(;o;)tt.unshift(o&255),o=parseInt(String(o/256));return tt.length===0&&tt.push(0),addSlice(new Uint8Array(tt))}if(et.allowMissingPrefix&&typeof o=="string"&&o.substring(0,2)!=="0x"&&(o="0x"+o),isHexable(o)&&(o=o.toHexString()),isHexString(o)){let tt=o.substring(2);tt.length%2&&(et.hexPad==="left"?tt="0"+tt:et.hexPad==="right"?tt+="0":logger$1.throwArgumentError("hex data is odd-length","value",o));const nt=[];for(let rt=0;rt>4]+HexCharacters[rt&15]}return tt}return logger$1.throwArgumentError("invalid hexlify value","value",o)}const version="rlp/5.7.0",logger=new Logger(version);function arrayifyInteger(o){const et=[];for(;o;)et.unshift(o&255),o>>=8;return et}function unarrayifyInteger(o,et,tt){let nt=0;for(let rt=0;rtet+1+nt&&logger.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+nt,result:rt}}function _decode(o,et){if(o.length===0&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{}),o[et]>=248){const tt=o[et]-247;et+1+tt>o.length&&logger.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);return et+1+tt+nt>o.length&&logger.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1+tt,tt+nt)}else if(o[et]>=192){const tt=o[et]-192;return et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1,tt)}else if(o[et]>=184){const tt=o[et]-183;et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);et+1+tt+nt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const rt=hexlify(o.slice(et+1+tt,et+1+tt+nt));return{consumed:1+tt+nt,result:rt}}else if(o[et]>=128){const tt=o[et]-128;et+1+tt>o.length&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{});const nt=hexlify(o.slice(et+1,et+1+tt));return{consumed:1+tt,result:nt}}return{consumed:1,result:hexlify(o[et])}}function decode$4(o){const et=arrayify(o),tt=_decode(et,0);return tt.consumed!==et.length&&logger.throwArgumentError("invalid rlp data","data",o),tt.result}const log$8=new Logger$1("enr:decoder");class EnrDecoder{static fromString(et){if(!et.startsWith(ENR.RECORD_PREFIX))throw new Error(`"string encoded ENR must start with '${ENR.RECORD_PREFIX}'`);return EnrDecoder.fromRLP(fromString(et.slice(4),"base64url"))}static fromRLP(et){const tt=decode$4(et).map(hexToBytes$1);return fromValues(tt)}}async function fromValues(o){const{signature:et,seq:tt,kvs:nt}=checkValues(o),rt={};for(let st=0;stv4Regex$1.test(o),encode(o,et,tt){tt=~~tt,et=et||new Uint8Array(tt+v4Size);const nt=o.length;let rt=0;for(let ot=0;oto.length>0&&v6Regex$1.test(o),encode(o,et,tt){tt=~~tt;let nt=tt+v6Size,rt=-1,ot=0,it=0,st=!0,at=!1;et=et||new Uint8Array(tt+v6Size);for(let ct=0;ct>8),tt=97?lt-=87:lt>=65?lt-=55:(lt-=48,it=it*10+lt),ot=(ot<<4)+lt)}if(st===!1)at===!0?(tt>8),tt=rt+2;ct--)et[ct]=et[ct-2];et[rt]=0,et[rt+1]=0,rt=tt}if(rt!==tt&&rt!==-1)for(tt>nt-2&&(tt=nt-2);nt>rt;)et[--nt]=ttrt?et[--tt]:0;else for(;tt=SURROGATE_B||(o.charCodeAt(ot)&64512)!==SURROGATE_B?et+=3:(nt=ot,et+=4)}}return et}function encode$1(o,et,tt){const nt=o.length;tt==null&&(tt=0),et===void 0&&(et=new Uint8Array(encodingLength$1(o)+tt));let rt=tt;for(let ot=0;ot>6,et[rt++]=128|it&63;else if((it&63488)!==SURROGATE_A)et[rt++]=224|(it&61440)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63;else{const st=ot+1;if(st===nt||it>=SURROGATE_B)et[rt++]=239,et[rt++]=191,et[rt++]=189;else{const at=o.charCodeAt(st);(at&64512)!==SURROGATE_B?(et[rt++]=239,et[rt++]=191,et[rt++]=189):(ot=st,it=65536|(it&1023)<<10|at&1023,et[rt++]=240|(it&1835008)>>18,et[rt++]=128|(it&258048)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63)}}}return encode$1.bytes=rt-tt,et}encode$1.bytes=0;function decode$2(o,et,tt){let nt="";et==null&&(et=0),tt==null&&(tt=o.length);for(let rt=et;rt191&&ot<224)it=(ot&31)<<6|o[rt++]&63;else if(ot>239&&ot<365){it=((ot&7)<<18|(o[rt++]&63)<<12|(o[rt++]&63)<<6|o[rt++]&63)-65536;const st=SURROGATE_A|it>>10&1023;nt+=String.fromCharCode(st),it=SURROGATE_B|it&1023}else it=(ot&15)<<12|(o[rt++]&63)<<6|o[rt++]&63;nt+=String.fromCharCode(it)}return decode$2.bytes=tt-et,nt}decode$2.bytes=0;const isU8Arr=o=>o instanceof Uint8Array;function bytelength(o){return typeof o=="string"?encodingLength$1(o):o.byteLength}function from(o){return o instanceof Uint8Array?o:Array.isArray(o)?new Uint8Array(o):encode$1(o)}function write(o,et,tt){if(typeof et!="string")throw new Error("unknown input type");return encode$1(et,o,tt),encode$1.bytes}const P_24=Math.pow(2,24),P_16=Math.pow(2,16),P_8=Math.pow(2,8),readUInt32BE=(o,et)=>o[et]*P_24+o[et+1]*P_16+o[et+2]*P_8+o[et+3],readUInt16BE=(o,et)=>o[et]<<8|o[et+1],writeUInt32BE=(o,et,tt)=>(et=+et,o[tt+3]=et,et=et>>>8,o[tt+2]=et,et=et>>>8,o[tt+1]=et,et=et>>>8,o[tt]=et,tt+4),writeUInt16BE=(o,et,tt)=>(o[tt]=et>>8,o[tt+1]=et&255,tt+2);function copy(o,et,tt,nt,rt){return tt<0&&(nt-=tt,tt=0),nt<0&&(nt=0),rt<0?new Uint8Array(0):tt>=et.length||nt>=rt?0:_copyActual(o,et,tt,nt,rt)}function _copyActual(o,et,tt,nt,rt){rt-nt>et.length-tt&&(rt=nt+et.length-tt);let ot=rt-nt;const it=o.length-nt;return ot>it&&(ot=it),(nt!==0||rto)}}const name$1=codec({encode(o,et,tt){et||(et=new Uint8Array(name$1.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.replace(/^\.|\.$/gm,"");if(rt.length){const ot=rt.split(".");for(let it=0;it=o.length)throw new Error("Cannot decode name (buffer overflow)");const st=o[et++];if(ot+=it?0:1,st===0)break;if(st&192)if((st&192)===192){if(et+1>o.length)throw new Error("Cannot decode name (buffer overflow)");const at=readUInt16BE(o,et-1)-49152;if(at>=nt)throw new Error("Cannot decode name (bad pointer)");et=at,nt=at,ot+=it?0:1,it=!0}else throw new Error("Cannot decode name (bad label)");else{if(et+st>o.length)throw new Error("Cannot decode name (buffer overflow)");if(rt+=st+1,rt>254)throw new Error("Cannot decode name (name too long)");tt.push(decode$2(o,et,et+st)),et+=st,ot+=it?0:st}}return name$1.decode.bytes=ot,tt.length===0?".":tt.join(".")},encodingLength(o){return o==="."||o===".."?1:bytelength(o.replace(/^\.|\.$/gm,""))+2}}),string$2=codec({encode(o,et,tt){et||(et=new Uint8Array(string$2.encodingLength(o))),tt||(tt=0);const nt=write(et,o,tt+1);return et[tt]=nt,string$2.encode.bytes=nt+1,et},decode(o,et){et||(et=0);const tt=o[et],nt=decode$2(o,et+1,et+1+tt);return string$2.decode.bytes=tt+1,nt},encodingLength(o){return bytelength(o)+1}}),header=codec({bytes:12,encode(o,et,tt){et||(et=new Uint8Array(header.encodingLength(o))),tt||(tt=0);const nt=(o.flags||0)&32767,rt=o.type==="response"?RESPONSE_FLAG:QUERY_FLAG;return writeUInt16BE(et,o.id||0,tt),writeUInt16BE(et,nt|rt,tt+2),writeUInt16BE(et,o.questions.length,tt+4),writeUInt16BE(et,o.answers.length,tt+6),writeUInt16BE(et,o.authorities.length,tt+8),writeUInt16BE(et,o.additionals.length,tt+10),et},decode(o,et){if(et||(et=0),o.length<12)throw new Error("Header must be 12 bytes");const tt=readUInt16BE(o,et+2);return{id:readUInt16BE(o,et),type:tt&RESPONSE_FLAG?"response":"query",flags:tt&32767,flag_qr:(tt>>15&1)===1,opcode:toString$4(tt>>11&15),flag_aa:(tt>>10&1)===1,flag_tc:(tt>>9&1)===1,flag_rd:(tt>>8&1)===1,flag_ra:(tt>>7&1)===1,flag_z:(tt>>6&1)===1,flag_ad:(tt>>5&1)===1,flag_cd:(tt>>4&1)===1,rcode:toString$5(tt&15),questions:new Array(readUInt16BE(o,et+4)),answers:new Array(readUInt16BE(o,et+6)),authorities:new Array(readUInt16BE(o,et+8)),additionals:new Array(readUInt16BE(o,et+10))}},encodingLength(){return 12}}),runknown=codec({encode(o,et,tt){et||(et=new Uint8Array(runknown.encodingLength(o))),tt||(tt=0);const nt=o.length;return writeUInt16BE(et,nt,tt),copy(o,et,tt+2,0,nt),runknown.encode.bytes=nt+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=o.slice(et+2,et+2+tt);return runknown.decode.bytes=tt+2,nt},encodingLength(o){return o.length+2}}),rns=codec({encode(o,et,tt){return et||(et=new Uint8Array(rns.encodingLength(o))),tt||(tt=0),name$1.encode(o,et,tt+2),writeUInt16BE(et,name$1.encode.bytes,tt),rns.encode.bytes=name$1.encode.bytes+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=name$1.decode(o,et+2);return rns.decode.bytes=tt+2,nt},encodingLength(o){return name$1.encodingLength(o)+2}}),rsoa=codec({encode(o,et,tt){et||(et=new Uint8Array(rsoa.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mname,et,tt),tt+=name$1.encode.bytes,name$1.encode(o.rname,et,tt),tt+=name$1.encode.bytes,writeUInt32BE(et,o.serial||0,tt),tt+=4,writeUInt32BE(et,o.refresh||0,tt),tt+=4,writeUInt32BE(et,o.retry||0,tt),tt+=4,writeUInt32BE(et,o.expire||0,tt),tt+=4,writeUInt32BE(et,o.minimum||0,tt),tt+=4,writeUInt16BE(et,tt-nt-2,nt),rsoa.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.rname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.serial=readUInt32BE(o,et),et+=4,nt.refresh=readUInt32BE(o,et),et+=4,nt.retry=readUInt32BE(o,et),et+=4,nt.expire=readUInt32BE(o,et),et+=4,nt.minimum=readUInt32BE(o,et),et+=4,rsoa.decode.bytes=et-tt,nt},encodingLength(o){return 22+name$1.encodingLength(o.mname)+name$1.encodingLength(o.rname)}}),rtxt=codec({encode(o,et,tt){Array.isArray(o)||(o=[o]);for(let rt=0;rt0;){const ot=o[et++];if(--nt,ntnew Uint8Array(o),roption=codec({encode(o,et,tt){et||(et=new Uint8Array(roption.encodingLength(o))),tt||(tt=0);const nt=tt,rt=toCode(o.code);if(writeUInt16BE(et,rt,tt),tt+=2,o.data)writeUInt16BE(et,o.data.length,tt),tt+=2,copy(o.data,et,tt),tt+=o.data.length;else switch(rt){case 8:{const ot=o.sourcePrefixLength||0,it=o.family||familyOf(o.ip),st=encode$2(o.ip,alloc),at=Math.ceil(ot/8);writeUInt16BE(et,at+4,tt),tt+=2,writeUInt16BE(et,it,tt),tt+=2,et[tt++]=ot,et[tt++]=o.scopePrefixLength||0,copy(st,et,tt,0,at),tt+=at}break;case 11:o.timeout?(writeUInt16BE(et,2,tt),tt+=2,writeUInt16BE(et,o.timeout,tt),tt+=2):(writeUInt16BE(et,0,tt),tt+=2);break;case 12:{const ot=o.length||0;writeUInt16BE(et,ot,tt),tt+=2,et.fill(0,tt,tt+ot),tt+=ot}break;case 14:{const ot=o.tags.length*2;writeUInt16BE(et,ot,tt),tt+=2;for(const it of o.tags)writeUInt16BE(et,it,tt),tt+=2}break;default:throw new Error(`Unknown roption code: ${o.code}`)}return roption.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt={};tt.code=readUInt16BE(o,et),tt.type=toString$2(tt.code),et+=2;const nt=readUInt16BE(o,et);switch(et+=2,tt.data=o.slice(et,et+nt),tt.code){case 8:tt.family=readUInt16BE(o,et),et+=2,tt.sourcePrefixLength=o[et++],tt.scopePrefixLength=o[et++];{const rt=new Uint8Array(tt.family===1?4:16);copy(o,rt,0,et,et+nt-4),tt.ip=decode$3(rt)}break;case 11:nt>0&&(tt.timeout=readUInt16BE(o,et),et+=2);break;case 14:tt.tags=[];for(let rt=0;rt0;)nt[ot++]=roption.decode(o,et),et+=roption.decode.bytes,rt-=roption.decode.bytes;return ropt.decode.bytes=et-tt,nt},encodingLength(o){return 2+encodingLengthList(o||[],roption)}}),rdnskey=codec({encode(o,et,tt){et||(et=new Uint8Array(rdnskey.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.key;if(!isU8Arr(rt))throw new Error("Key must be a Buffer");return tt+=2,writeUInt16BE(et,o.flags,tt),tt+=2,et[tt]=rdnskey.PROTOCOL_DNSSEC,tt+=1,et[tt]=o.algorithm,tt+=1,copy(rt,et,tt,0,rt.length),tt+=rt.length,rdnskey.encode.bytes=tt-nt,writeUInt16BE(et,rdnskey.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);if(et+=2,nt.flags=readUInt16BE(o,et),et+=2,o[et]!==rdnskey.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return et+=1,nt.algorithm=o[et],et+=1,nt.key=o.slice(et,tt+rt+2),et+=nt.key.length,rdnskey.decode.bytes=et-tt,nt},encodingLength(o){return 6+bytelength(o.key)}});rdnskey.PROTOCOL_DNSSEC=3;rdnskey.ZONE_KEY=128;rdnskey.SECURE_ENTRYPOINT=32768;const rrrsig=codec({encode(o,et,tt){et||(et=new Uint8Array(rrrsig.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.signature;if(!isU8Arr(rt))throw new Error("Signature must be a Buffer");return tt+=2,writeUInt16BE(et,toType(o.typeCovered),tt),tt+=2,et[tt]=o.algorithm,tt+=1,et[tt]=o.labels,tt+=1,writeUInt32BE(et,o.originalTTL,tt),tt+=4,writeUInt32BE(et,o.expiration,tt),tt+=4,writeUInt32BE(et,o.inception,tt),tt+=4,writeUInt16BE(et,o.keyTag,tt),tt+=2,name$1.encode(o.signersName,et,tt),tt+=name$1.encode.bytes,copy(rt,et,tt,0,rt.length),tt+=rt.length,rrrsig.encode.bytes=tt-nt,writeUInt16BE(et,rrrsig.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);return et+=2,nt.typeCovered=toString$6(readUInt16BE(o,et)),et+=2,nt.algorithm=o[et],et+=1,nt.labels=o[et],et+=1,nt.originalTTL=readUInt32BE(o,et),et+=4,nt.expiration=readUInt32BE(o,et),et+=4,nt.inception=readUInt32BE(o,et),et+=4,nt.keyTag=readUInt16BE(o,et),et+=2,nt.signersName=name$1.decode(o,et),et+=name$1.decode.bytes,nt.signature=o.slice(et,tt+rt+2),et+=nt.signature.length,rrrsig.decode.bytes=et-tt,nt},encodingLength(o){return 20+name$1.encodingLength(o.signersName)+bytelength(o.signature)}}),rrp=codec({encode(o,et,tt){et||(et=new Uint8Array(rrp.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mbox||".",et,tt),tt+=name$1.encode.bytes,name$1.encode(o.txt||".",et,tt),tt+=name$1.encode.bytes,rrp.encode.bytes=tt-nt,writeUInt16BE(et,rrp.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mbox=name$1.decode(o,et)||".",et+=name$1.decode.bytes,nt.txt=name$1.decode(o,et)||".",et+=name$1.decode.bytes,rrp.decode.bytes=et-tt,nt},encodingLength(o){return 2+name$1.encodingLength(o.mbox||".")+name$1.encodingLength(o.txt||".")}}),typebitmap=codec({encode(o,et,tt){et||(et=new Uint8Array(typebitmap.encodingLength(o))),tt||(tt=0);const nt=tt,rt=[];for(let ot=0;ot>8]===void 0&&(rt[it>>8]=[]),rt[it>>8][it>>3&31]|=1<<7-(it&7)}for(let ot=0;ot>8]=Math.max(et[rt>>8]||0,rt&255)}let tt=0;for(let nt=0;nt>15&1)===1,tt.options=ropt.decode(o,et+8),et+=8+ropt.decode.bytes;else{const rt=readUInt16BE(o,et+2);tt.ttl=readUInt32BE(o,et+4),tt.class=toString$3(rt&NOT_FLUSH_MASK),tt.flush=!!(rt&FLUSH_MASK);const ot=renc(tt.type);tt.data=ot.decode(o,et+8),et+=8+ot.decode.bytes}return answer.decode.bytes=et-nt,tt},encodingLength(o){const et=o.data!==null&&o.data!==void 0?o.data:o.options;return name$1.encodingLength(o.name)+8+renc(o.type).encodingLength(et)}}),question=codec({encode(o,et,tt){et||(et=new Uint8Array(question.encodingLength(o))),tt||(tt=0);const nt=tt;return name$1.encode(o.name,et,tt),tt+=name$1.encode.bytes,writeUInt16BE(et,toType(o.type),tt),tt+=2,writeUInt16BE(et,toClass(o.class===void 0?"IN":o.class),tt),tt+=2,question.encode.bytes=tt-nt,o},decode(o,et){et||(et=0);const tt=et,nt={};return nt.name=name$1.decode(o,et),et+=name$1.decode.bytes,nt.type=toString$6(readUInt16BE(o,et)),et+=2,nt.class=toString$3(readUInt16BE(o,et)),et+=2,!!(nt.class&QU_MASK)&&(nt.class&=NOT_QU_MASK),question.decode.bytes=et-tt,nt},encodingLength(o){return name$1.encodingLength(o.name)+4}}),RECURSION_DESIRED=256,packet={encode:function(o,et,tt){const nt=!et;nt&&(et=new Uint8Array(encodingLength(o))),tt||(tt=0);const rt=tt;return o.questions||(o.questions=[]),o.answers||(o.answers=[]),o.authorities||(o.authorities=[]),o.additionals||(o.additionals=[]),header.encode(o,et,tt),tt+=header.encode.bytes,tt=encodeList(o.questions,question,et,tt),tt=encodeList(o.answers,answer,et,tt),tt=encodeList(o.authorities,answer,et,tt),tt=encodeList(o.additionals,answer,et,tt),packet.encode.bytes=tt-rt,nt&&encode.bytes!==et.length?et.slice(0,encode.bytes):et},decode:function(o,et){et||(et=0);const tt=et,nt=header.decode(o,et);return et+=header.decode.bytes,et=decodeList(nt.questions,question,o,et),et=decodeList(nt.answers,answer,o,et),et=decodeList(nt.authorities,answer,o,et),et=decodeList(nt.additionals,answer,o,et),packet.decode.bytes=et-tt,nt},encodingLength:function(o){return header.encodingLength(o)+encodingLengthList(o.questions||[],question)+encodingLengthList(o.answers||[],answer)+encodingLengthList(o.authorities||[],answer)+encodingLengthList(o.additionals||[],answer)}};packet.encode.bytes=0;packet.decode.bytes=0;const encode=packet.encode,decode$1=packet.decode,encodingLength=packet.encodingLength;function encodingLengthList(o,et){let tt=0;for(let nt=0;nt255)throw new Error(`Character #${at} in charset [code=${ct}, char=${et.charAt(at)}] is too high! (max=255)`);if(rt[ct]!==0)throw new Error(`Character [code=${ct}, char=${et.charAt(at)}] is more than once in the charset!`);rt[ct]=at,ot[at]=ct}const it=tt.charCodeAt(0),st={name:o,encodingLength(at){const ct=at.length,lt=ct*.75|0;return at.charCodeAt(ct-1)===it?at.charCodeAt(ct-2)===it?lt-2:lt-1:lt},encode(at,ct,lt){ct==null&&(ct=new Uint8Array(st.encodingLength(at))),lt==null&&(lt=0);let dt=at.length;at.charCodeAt(dt-1)===it&&(at.charCodeAt(dt-2)===it?dt-=2:dt-=1);const ht=dt%4,pt=dt-ht;let mt=lt,ft=0;for(;ft>16,ct[mt++]=yt>>8,ct[mt++]=yt,ft+=4}if(ht===3){const yt=rt[at.charCodeAt(ft)]<<10|rt[at.charCodeAt(ft+1)]<<4|rt[at.charCodeAt(ft+2)]>>2;ct[mt++]=yt>>8,ct[mt++]=yt}else ht===2&&(ct[mt++]=rt[at.charCodeAt(ft)]<<2|rt[at.charCodeAt(ft+1)]>>4);return st.encode.bytes=mt-lt,ct},decode(at,ct,lt){ct==null&&(ct=0),lt==null&&(lt=at.length);const dt=lt-ct,ht=dt%3,pt=ct+dt-ht,mt=[];for(let ft=ct;ft>18&63],ot[yt>>12&63],ot[yt>>6&63],ot[yt&63])}if(ht===2){const ft=(at[lt-2]<<8)+at[lt-1];mt.push(ot[ft>>10],ot[ft>>4&63],ot[ft<<2&63]),nt===PREFERS_PADDING&&mt.push(it)}else if(ht===1){const ft=at[lt-1];mt.push(ot[ft>>2],ot[ft<<4&63]),nt===PREFERS_PADDING&&mt.push(it,it)}return st.decode.bytes=dt,String.fromCharCode.apply(String,mt)}};return st}make("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",PREFERS_PADDING);const base64URL=make("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",PREFERS_NO_PADDING);let AbortError=typeof globalThis<"u"?globalThis.AbortError:typeof window<"u"?window.AbortError:null;AbortError||(AbortError=class extends Error{constructor(et="Request aborted."){super(et)}});AbortError.prototype.name="AbortError";AbortError.prototype.code="ABORT_ERR";const URL$1=typeof globalThis<"u"&&globalThis.URL||require("url").URL;class HTTPStatusError extends Error{constructor(et,tt,nt){super("status="+tt+" while requesting "+et+" ["+nt+"]"),this.uri=et,this.status=tt,this.method=nt}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}HTTPStatusError.prototype.name="HTTPStatusError";HTTPStatusError.prototype.code="HTTP_STATUS";class ResponseError extends Error{constructor(et,tt){super(et),this.cause=tt}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:reduceError(this.cause)}}}ResponseError.prototype.name="ResponseError";ResponseError.prototype.code="RESPONSE_ERR";class TimeoutError extends Error{constructor(et){super("Timeout (t="+et+")."),this.timeout=et}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}TimeoutError.prototype.name="TimeoutError";TimeoutError.prototype.code="ETIMEOUT";const v4Regex=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,v6Regex=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function reduceError(o){if(typeof o=="string")return{message:o};try{const tt=JSON.stringify(o);if(tt!=="{}")return JSON.parse(tt)}catch{}const et={message:String(o.message||o)};return o.code!==void 0&&(et.code=String(o.code)),et}const baseParts=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,httpFlags=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/ig,updFlags=/\[(((pk|name)=([^\]]+)))\]/ig;function parseEndpoint(o){const et=baseParts.exec(o),tt=et[2]||"https:",nt=et[3],rt=et[5],ot=et[6],it=et[7];if(tt==="https:"||tt==="http:"){const st=parseFlags(it,httpFlags);return{name:st.name,protocol:tt,ipv4:st.ipv4,ipv6:st.ipv6,host:nt,port:rt,path:ot,method:st.post?"POST":"GET"}}if(tt==="udp:"||tt==="udp4:"||tt==="udp6:"){const st=parseFlags(it,updFlags),at=/^\[(.*)\]$/.exec(nt);if(at&&tt==="udp4:")throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${o})`);if(!at&&tt==="udp6:")throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${o})`);return at?new UDP6Endpoint({protocol:"udp6:",ipv6:at[1],port:rt,pk:st.pk,name:st.name}):new UDP4Endpoint({protocol:"udp4:",ipv4:nt,port:rt,pk:st.pk,name:st.name})}throw new InvalidProtocolError(tt,o)}function parseFlags(o,et){et.lastIndex=0;const tt={};for(;;){const nt=et.exec(o);if(!nt)break;nt[2]?tt[nt[3].toLowerCase()]=nt[4]:tt[nt[1].toLowerCase()]=!0}return tt}class InvalidProtocolError extends Error{constructor(et,tt){super(`Invalid Endpoint: unsupported protocol "${et}" for endpoint: ${tt}, supported protocols: ${supportedProtocols.join(", ")}`),this.protocol=et,this.endpoint=tt}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}InvalidProtocolError.prototype.name="InvalidProtocolError";InvalidProtocolError.prototype.code="EPROTOCOL";const supportedProtocols=["http:","https:","udp4:","udp6:"];class BaseEndpoint{constructor(et,tt){this.name=et.name||null,this.protocol=et.protocol;const nt=typeof et.port=="string"?et.port=parseInt(et.port,10):et.port;if(nt==null)this.port=tt?this.protocol==="https:"?443:80:et.pk?443:53;else{if(typeof nt!="number"&&!isNaN(nt))throw new Error(`Invalid Endpoint: port "${et.port}" needs to be a number: ${JSON.stringify(et)}`);this.port=nt}}toJSON(){return this.toString()}}class UDPEndpoint extends BaseEndpoint{constructor(et){super(et,!1),this.pk=et.pk||null}toString(){const et=this.port!==(this.pk?443:53)?`:${this.port}`:"",tt=this.pk?` [pk=${this.pk}]`:"",nt=this.name?` [name=${this.name}]`:"";return`udp://${this.ipv4||`[${this.ipv6}]`}${et}${tt}${nt}`}}class UDP4Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp4:"},et)),!et.ipv4||typeof et.ipv4!="string")throw new Error(`Invalid Endpoint: .ipv4 "${et.ipv4}" needs to be set: ${JSON.stringify(et)}`);this.ipv4=et.ipv4}}class UDP6Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp6:"},et)),!et.ipv6||typeof et.ipv6!="string")throw new Error(`Invalid Endpoint: .ipv6 "${et.ipv6}" needs to be set: ${JSON.stringify(et)}`);this.ipv6=et.ipv6}}function safeHost(o){return v6Regex.test(o)&&!v4Regex.test(o)?`[${o}]`:o}class HTTPEndpoint extends BaseEndpoint{constructor(et){if(super(Object.assign({protocol:"https:"},et),!0),et.host||(et.ipv4&&(et.host=et.ipv4),et.ipv6&&(et.host=`[${et.ipv6}]`)),!et.host||typeof et.host!="string")throw new Error(`Invalid Endpoint: host "${et.path}" needs to be set: ${JSON.stringify(et)}`);if(this.host=et.host,this.path=et.path||"/dns-query",this.method=/^post$/i.test(et.method)?"POST":"GET",this.ipv4=et.ipv4,this.ipv6=et.ipv6,!this.ipv6){const nt=v6Regex.exec(this.host);nt&&(this.ipv6=nt[1])}this.ipv4||v4Regex.test(this.host)&&(this.ipv4=this.host);const tt=`${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`;try{this.url=new URL$1(tt)}catch(nt){throw new Error(nt.message+` [${tt}]`)}}toString(){const et=this.protocol==="https:"?"":"http://",tt=this.port!==(this.protocol==="https:"?443:80)?`:${this.port}`:"",nt=this.method!=="GET"?" [post]":"",rt=this.path==="/dns-query"?"":this.path,ot=this.name?` [name=${this.name}]`:"",it=this.ipv4&&this.ipv4!==this.host?` [ipv4=${this.ipv4}]`:"",st=this.ipv6&&this.ipv6!==this.host?` [ipv6=${this.ipv6}]`:"";return`${et}${safeHost(this.host)}${tt}${rt}${nt}${it}${st}${ot}`}}function toEndpoint(o){let et;if(typeof o=="string")et=parseEndpoint(o);else{if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Can not convert ${o} to an endpoint`);if(o instanceof BaseEndpoint)return o;et=o}(et.protocol===null||et.protocol===void 0)&&(et.protocol="https:");const tt=et.protocol;if(tt==="udp4:")return new UDP4Endpoint(et);if(tt==="udp6:")return new UDP6Endpoint(et);if(tt==="https:"||tt==="http:")return new HTTPEndpoint(et);throw new InvalidProtocolError(tt,JSON.stringify(et))}const contentType="application/dns-message";function noop$1(){}function queryDns(){throw new Error('Only "doh" endpoints are supported in the browser')}async function loadJSON(o,et,tt,nt){const rt=et?et.localStoragePrefix+et.name:null;if(rt)try{const st=JSON.parse(localStorage.getItem(rt));if(st&&st.time>et.maxTime)return st}catch{}const{data:ot}=await requestRaw(o,"GET",null,tt,nt),it={time:Date.now(),data:JSON.parse(decode$2(ot))};if(rt)try{localStorage.setItem(rt,JSON.stringify(it))}catch{it.time=null}return it}function requestRaw(o,et,tt,nt,rt){return new Promise((ot,it)=>{const st=new URL$1(o);et==="GET"&&tt&&(st.search="?dns="+base64URL.decode(tt));const at=st.toString(),ct=new XMLHttpRequest;ct.open(et,at,!0),ct.setRequestHeader("Accept",contentType),et==="POST"&&ct.setRequestHeader("Content-Type",contentType),ct.responseType="arraybuffer",ct.timeout=nt,ct.ontimeout=lt,ct.onreadystatechange=ht,ct.onerror=mt,ct.onload=dt,et==="POST"?ct.send(tt):ct.send(),rt&&rt.addEventListener("abort",ft);function lt(){pt(new TimeoutError(nt));try{ct.abort()}catch{}}function dt(){if(ct.status!==200)pt(new HTTPStatusError(at,ct.status,et));else{let yt;if(typeof ct.response=="string")yt=encode$1(ct.response);else if(ct.response instanceof Uint8Array)yt=ct.response;else if(Array.isArray(ct.response)||ct.response instanceof ArrayBuffer)yt=new Uint8Array(ct.response);else throw new Error("Unprocessable response "+ct.response);pt(null,yt)}}function ht(){if(ct.readyState>1&&ct.status!==200&&ct.status!==0){pt(new HTTPStatusError(at,ct.status,et));try{ct.abort()}catch{}}}let pt=function(yt,gt){pt=noop$1,rt&&rt.removeEventListener("abort",ft),ot(yt?{error:yt,response:ct}:{data:gt,response:ct})};function mt(){pt(ct.status===200?new Error("Inexplicable XHR Error"):new HTTPStatusError(at,ct.status,et))}function ft(){pt(new AbortError);try{ct.abort()}catch{}}})}function request(o,et,tt,nt,rt){return requestRaw(o,et,tt,nt,rt)}function processResolvers$1(o){return o.filter(et=>et.cors||et.endpoint.cors)}const resolvers={data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:`Public updns DoH service with advertising, tracker and malware filters. + */(function(){var tt="input is invalid type",nt="finalize already called",rt=typeof window=="object",ot=rt?window:{};ot.JS_SHA3_NO_WINDOW&&(rt=!1);var it=!rt&&typeof self=="object",st=!ot.JS_SHA3_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;st?ot=globalThis:it&&(ot=self);for(var at=!ot.JS_SHA3_NO_COMMON_JS&&!0&&o.exports,ct=!ot.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",lt="0123456789abcdef".split(""),dt=[31,7936,2031616,520093696],ht=[4,1024,262144,67108864],ft=[1,256,65536,16777216],mt=[6,1536,393216,100663296],pt=[0,8,16,24],yt=[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],gt=[224,256,384,512],xt=[128,256],vt=["hex","buffer","arrayBuffer","array","digest"],bt={128:168,256:136},Et=ot.JS_SHA3_NO_NODE_JS||!Array.isArray?function(Tt){return Object.prototype.toString.call(Tt)==="[object Array]"}:Array.isArray,wt=ct&&(ot.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(Tt){return typeof Tt=="object"&&Tt.buffer&&Tt.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,kt=function(Tt){var Dt=typeof Tt;if(Dt==="string")return[Tt,!0];if(Dt!=="object"||Tt===null)throw new Error(tt);if(ct&&Tt.constructor===ArrayBuffer)return[new Uint8Array(Tt),!1];if(!Et(Tt)&&!wt(Tt))throw new Error(tt);return[Tt,!1]},It=function(Tt){return kt(Tt)[0].length===0},Rt=function(Tt){for(var Dt=[],Vt=0;Vt>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Vt>>5,this.extraBytes=(Vt&31)>>3;for(var en=0;en<50;++en)this.s[en]=0}Xt.prototype.update=function(Tt){if(this.finalized)throw new Error(nt);var Dt=kt(Tt);Tt=Dt[0];for(var Vt=Dt[1],en=this.blocks,an=this.byteCount,dn=Tt.length,ln=this.blockCount,fn=0,kn=this.s,mn,wn;fn>2]|=wn<>2]|=(192|wn>>6)<>2]|=(128|wn&63)<=57344?(en[mn>>2]|=(224|wn>>12)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=(240|wn>>18)<>2]|=(128|wn>>12&63)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=Tt[fn]<=an){for(this.start=mn-an,this.block=en[ln],mn=0;mn>8,Vt=Tt&255;Vt>0;)an.unshift(Vt),Tt=Tt>>8,Vt=Tt&255,++en;return Dt?an.push(en):an.unshift(en),this.update(an),an.length},Xt.prototype.encodeString=function(Tt){var Dt=kt(Tt);Tt=Dt[0];var Vt=Dt[1],en=0,an=Tt.length;if(Vt)for(var dn=0;dn=57344?en+=3:(ln=65536+((ln&1023)<<10|Tt.charCodeAt(++dn)&1023),en+=4)}else en=an;return en+=this.encode(en*8),this.update(Tt),en},Xt.prototype.bytepad=function(Tt,Dt){for(var Vt=this.encode(Dt),en=0;en>2]|=this.padding[Dt&3],this.lastByteIndex===this.byteCount)for(Tt[0]=Tt[Vt],Dt=1;Dt>4&15]+lt[fn&15]+lt[fn>>12&15]+lt[fn>>8&15]+lt[fn>>20&15]+lt[fn>>16&15]+lt[fn>>28&15]+lt[fn>>24&15];dn%Tt===0&&(Dt=Rt(Dt),tn(Dt),an=0)}return en&&(fn=Dt[an],ln+=lt[fn>>4&15]+lt[fn&15],en>1&&(ln+=lt[fn>>12&15]+lt[fn>>8&15]),en>2&&(ln+=lt[fn>>20&15]+lt[fn>>16&15])),ln},Xt.prototype.arrayBuffer=function(){this.finalize();var Tt=this.blockCount,Dt=this.s,Vt=this.outputBlocks,en=this.extraBytes,an=0,dn=0,ln=this.outputBits>>3,fn;en?fn=new ArrayBuffer(Vt+1<<2):fn=new ArrayBuffer(ln);for(var kn=new Uint32Array(fn);dn>8&255,ln[fn+2]=kn>>16&255,ln[fn+3]=kn>>24&255;dn%Tt===0&&(Dt=Rt(Dt),tn(Dt))}return en&&(fn=dn<<2,kn=Dt[an],ln[fn]=kn&255,en>1&&(ln[fn+1]=kn>>8&255),en>2&&(ln[fn+2]=kn>>16&255)),ln};function Jt(Tt,Dt,Vt){Xt.call(this,Tt,Dt,Vt)}Jt.prototype=new Xt,Jt.prototype.finalize=function(){return this.encode(this.outputBits,!0),Xt.prototype.finalize.call(this)};var tn=function(Tt){var Dt,Vt,en,an,dn,ln,fn,kn,mn,wn,_n,$n,yn,En,on,_t,St,At,Ot,Kt,rn,sn,xn,Rn,vn,An,bn,po,mo,go,yo,xo,vo,bo,Eo,wo,Co,So,ko,Ao,Ro,To,Io,_o,$o,Po,Lo,No,Oo,Mo,jo,Bo,Do,Fo,Uo,zo,Vo,Ho,Wo,Go,qo,Ko,Qo;for(en=0;en<48;en+=2)an=Tt[0]^Tt[10]^Tt[20]^Tt[30]^Tt[40],dn=Tt[1]^Tt[11]^Tt[21]^Tt[31]^Tt[41],ln=Tt[2]^Tt[12]^Tt[22]^Tt[32]^Tt[42],fn=Tt[3]^Tt[13]^Tt[23]^Tt[33]^Tt[43],kn=Tt[4]^Tt[14]^Tt[24]^Tt[34]^Tt[44],mn=Tt[5]^Tt[15]^Tt[25]^Tt[35]^Tt[45],wn=Tt[6]^Tt[16]^Tt[26]^Tt[36]^Tt[46],_n=Tt[7]^Tt[17]^Tt[27]^Tt[37]^Tt[47],$n=Tt[8]^Tt[18]^Tt[28]^Tt[38]^Tt[48],yn=Tt[9]^Tt[19]^Tt[29]^Tt[39]^Tt[49],Dt=$n^(ln<<1|fn>>>31),Vt=yn^(fn<<1|ln>>>31),Tt[0]^=Dt,Tt[1]^=Vt,Tt[10]^=Dt,Tt[11]^=Vt,Tt[20]^=Dt,Tt[21]^=Vt,Tt[30]^=Dt,Tt[31]^=Vt,Tt[40]^=Dt,Tt[41]^=Vt,Dt=an^(kn<<1|mn>>>31),Vt=dn^(mn<<1|kn>>>31),Tt[2]^=Dt,Tt[3]^=Vt,Tt[12]^=Dt,Tt[13]^=Vt,Tt[22]^=Dt,Tt[23]^=Vt,Tt[32]^=Dt,Tt[33]^=Vt,Tt[42]^=Dt,Tt[43]^=Vt,Dt=ln^(wn<<1|_n>>>31),Vt=fn^(_n<<1|wn>>>31),Tt[4]^=Dt,Tt[5]^=Vt,Tt[14]^=Dt,Tt[15]^=Vt,Tt[24]^=Dt,Tt[25]^=Vt,Tt[34]^=Dt,Tt[35]^=Vt,Tt[44]^=Dt,Tt[45]^=Vt,Dt=kn^($n<<1|yn>>>31),Vt=mn^(yn<<1|$n>>>31),Tt[6]^=Dt,Tt[7]^=Vt,Tt[16]^=Dt,Tt[17]^=Vt,Tt[26]^=Dt,Tt[27]^=Vt,Tt[36]^=Dt,Tt[37]^=Vt,Tt[46]^=Dt,Tt[47]^=Vt,Dt=wn^(an<<1|dn>>>31),Vt=_n^(dn<<1|an>>>31),Tt[8]^=Dt,Tt[9]^=Vt,Tt[18]^=Dt,Tt[19]^=Vt,Tt[28]^=Dt,Tt[29]^=Vt,Tt[38]^=Dt,Tt[39]^=Vt,Tt[48]^=Dt,Tt[49]^=Vt,En=Tt[0],on=Tt[1],Po=Tt[11]<<4|Tt[10]>>>28,Lo=Tt[10]<<4|Tt[11]>>>28,po=Tt[20]<<3|Tt[21]>>>29,mo=Tt[21]<<3|Tt[20]>>>29,Go=Tt[31]<<9|Tt[30]>>>23,qo=Tt[30]<<9|Tt[31]>>>23,To=Tt[40]<<18|Tt[41]>>>14,Io=Tt[41]<<18|Tt[40]>>>14,bo=Tt[2]<<1|Tt[3]>>>31,Eo=Tt[3]<<1|Tt[2]>>>31,_t=Tt[13]<<12|Tt[12]>>>20,St=Tt[12]<<12|Tt[13]>>>20,No=Tt[22]<<10|Tt[23]>>>22,Oo=Tt[23]<<10|Tt[22]>>>22,go=Tt[33]<<13|Tt[32]>>>19,yo=Tt[32]<<13|Tt[33]>>>19,Ko=Tt[42]<<2|Tt[43]>>>30,Qo=Tt[43]<<2|Tt[42]>>>30,Fo=Tt[5]<<30|Tt[4]>>>2,Uo=Tt[4]<<30|Tt[5]>>>2,wo=Tt[14]<<6|Tt[15]>>>26,Co=Tt[15]<<6|Tt[14]>>>26,At=Tt[25]<<11|Tt[24]>>>21,Ot=Tt[24]<<11|Tt[25]>>>21,Mo=Tt[34]<<15|Tt[35]>>>17,jo=Tt[35]<<15|Tt[34]>>>17,xo=Tt[45]<<29|Tt[44]>>>3,vo=Tt[44]<<29|Tt[45]>>>3,Rn=Tt[6]<<28|Tt[7]>>>4,vn=Tt[7]<<28|Tt[6]>>>4,zo=Tt[17]<<23|Tt[16]>>>9,Vo=Tt[16]<<23|Tt[17]>>>9,So=Tt[26]<<25|Tt[27]>>>7,ko=Tt[27]<<25|Tt[26]>>>7,Kt=Tt[36]<<21|Tt[37]>>>11,rn=Tt[37]<<21|Tt[36]>>>11,Bo=Tt[47]<<24|Tt[46]>>>8,Do=Tt[46]<<24|Tt[47]>>>8,_o=Tt[8]<<27|Tt[9]>>>5,$o=Tt[9]<<27|Tt[8]>>>5,An=Tt[18]<<20|Tt[19]>>>12,bn=Tt[19]<<20|Tt[18]>>>12,Ho=Tt[29]<<7|Tt[28]>>>25,Wo=Tt[28]<<7|Tt[29]>>>25,Ao=Tt[38]<<8|Tt[39]>>>24,Ro=Tt[39]<<8|Tt[38]>>>24,sn=Tt[48]<<14|Tt[49]>>>18,xn=Tt[49]<<14|Tt[48]>>>18,Tt[0]=En^~_t&At,Tt[1]=on^~St&Ot,Tt[10]=Rn^~An&po,Tt[11]=vn^~bn&mo,Tt[20]=bo^~wo&So,Tt[21]=Eo^~Co&ko,Tt[30]=_o^~Po&No,Tt[31]=$o^~Lo&Oo,Tt[40]=Fo^~zo&Ho,Tt[41]=Uo^~Vo&Wo,Tt[2]=_t^~At&Kt,Tt[3]=St^~Ot&rn,Tt[12]=An^~po&go,Tt[13]=bn^~mo&yo,Tt[22]=wo^~So&Ao,Tt[23]=Co^~ko&Ro,Tt[32]=Po^~No&Mo,Tt[33]=Lo^~Oo&jo,Tt[42]=zo^~Ho&Go,Tt[43]=Vo^~Wo&qo,Tt[4]=At^~Kt&sn,Tt[5]=Ot^~rn&xn,Tt[14]=po^~go&xo,Tt[15]=mo^~yo&vo,Tt[24]=So^~Ao&To,Tt[25]=ko^~Ro&Io,Tt[34]=No^~Mo&Bo,Tt[35]=Oo^~jo&Do,Tt[44]=Ho^~Go&Ko,Tt[45]=Wo^~qo&Qo,Tt[6]=Kt^~sn&En,Tt[7]=rn^~xn&on,Tt[16]=go^~xo&Rn,Tt[17]=yo^~vo&vn,Tt[26]=Ao^~To&bo,Tt[27]=Ro^~Io&Eo,Tt[36]=Mo^~Bo&_o,Tt[37]=jo^~Do&$o,Tt[46]=Go^~Ko&Fo,Tt[47]=qo^~Qo&Uo,Tt[8]=sn^~En&_t,Tt[9]=xn^~on&St,Tt[18]=xo^~Rn&An,Tt[19]=vo^~vn&bn,Tt[28]=To^~bo&wo,Tt[29]=Io^~Eo&Co,Tt[38]=Bo^~_o&Po,Tt[39]=Do^~$o&Lo,Tt[48]=Ko^~Fo&zo,Tt[49]=Qo^~Uo&Vo,Tt[0]^=yt[en],Tt[1]^=yt[en+1]};if(at)o.exports=Pt;else for(Qt=0;Qtot+MULTIADDR_LENGTH_SIZE+it.bytes.length,0),tt=new Uint8Array(et),nt=new DataView(tt.buffer);let rt=0;return o.forEach(ot=>{if(ot.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");nt.setUint16(rt,ot.bytes.length),rt+=MULTIADDR_LENGTH_SIZE,tt.set(ot.bytes,rt),rt+=ot.bytes.length}),tt}function encodeWaku2(o){let et=0;return o.lightPush&&(et+=1),et=et<<1,o.filter&&(et+=1),et=et<<1,o.store&&(et+=1),et=et<<1,o.relay&&(et+=1),et}function decodeWaku2(o){const et={relay:!1,store:!1,filter:!1,lightPush:!1};return o%2&&(et.relay=!0),o=o>>1,o%2&&(et.store=!0),o=o>>1,o%2&&(et.filter=!0),o=o>>1,o%2&&(et.lightPush=!0),et}class RawEnr extends Map{constructor(tt={},nt=BigInt(1),rt){super(Object.entries(tt));Ct(this,"seq");Ct(this,"signature");this.seq=nt,this.signature=rt}set(tt,nt){return this.signature=void 0,this.seq++,super.set(tt,nt)}get id(){const tt=this.get("id");if(!tt)throw new Error("id not found.");return bytesToUtf8(tt)}get publicKey(){switch(this.id){case"v4":return this.get("secp256k1");default:throw new Error(ERR_INVALID_ID)}}get rs(){const tt=this.get("rs");if(tt)return decodeRelayShard(tt)}get rsv(){const tt=this.get("rsv");if(tt)return decodeRelayShard(tt)}get ip(){return getStringValue(this,"ip","ip4")}set ip(tt){setStringValue(this,"ip","ip4",tt)}get tcp(){return getNumberAsStringValue(this,"tcp","tcp")}set tcp(tt){setNumberAsStringValue(this,"tcp","tcp",tt)}get udp(){return getNumberAsStringValue(this,"udp","udp")}set udp(tt){setNumberAsStringValue(this,"udp","udp",tt)}get ip6(){return getStringValue(this,"ip6","ip6")}set ip6(tt){setStringValue(this,"ip6","ip6",tt)}get tcp6(){return getNumberAsStringValue(this,"tcp6","tcp")}set tcp6(tt){setNumberAsStringValue(this,"tcp6","tcp",tt)}get udp6(){return getNumberAsStringValue(this,"udp6","udp")}set udp6(tt){setNumberAsStringValue(this,"udp6","udp",tt)}get multiaddrs(){const tt=this.get("multiaddrs");if(tt)return decodeMultiaddrs(tt)}set multiaddrs(tt){deleteUndefined(this,"multiaddrs",tt,encodeMultiaddrs)}get waku2(){const tt=this.get("waku2");if(tt)return decodeWaku2(tt[0])}set waku2(tt){deleteUndefined(this,"waku2",tt,nt=>new Uint8Array([encodeWaku2(nt)]))}}function getStringValue(o,et,tt){const nt=o.get(et);if(nt)return convertToString(tt,nt)}function getNumberAsStringValue(o,et,tt){const nt=o.get(et);if(nt)return Number(convertToString(tt,nt))}function setStringValue(o,et,tt,nt){deleteUndefined(o,et,nt,convertToBytes.bind({},tt))}function setNumberAsStringValue(o,et,tt,nt){setStringValue(o,et,tt,nt==null?void 0:nt.toString(10))}function deleteUndefined(o,et,tt,nt){tt!==void 0?o.set(et,nt(tt)):o.delete(et)}async function sign(o,et){return sign$1(keccak256(et),o,{der:!1})}function nodeId(o){const tt=Point.fromHex(o).toRawBytes(!1);return bytesToHex$1(keccak256(tt.slice(1)))}const log$9=new Logger$1("enr");var TransportProtocol;(function(o){o.TCP="tcp",o.UDP="udp"})(TransportProtocol||(TransportProtocol={}));var TransportProtocolPerIpVersion;(function(o){o.TCP4="tcp4",o.UDP4="udp4",o.TCP6="tcp6",o.UDP6="udp6"})(TransportProtocolPerIpVersion||(TransportProtocolPerIpVersion={}));const os=class os extends RawEnr{constructor(){super(...arguments);Ct(this,"peerId");Ct(this,"getLocationMultiaddr",locationMultiaddrFromEnrFields.bind({},this))}static create(tt={},nt=BigInt(1),rt){const ot=new os(tt,nt,rt);try{const it=ot.publicKey;it&&(ot.peerId=createPeerIdFromPublicKey(it))}catch(it){log$9.error("Could not calculate peer id for ENR",it)}return ot}get nodeId(){switch(this.id){case"v4":return this.publicKey?nodeId(this.publicKey):void 0;default:throw new Error(ERR_INVALID_ID)}}get shardInfo(){return this.rs&&this.rsv&&log$9.warn("ENR contains both `rs` and `rsv` fields."),this.rs||this.rsv}setLocationMultiaddr(tt){const nt=tt.protoNames();if(nt.length!==2&&nt[1]!=="udp"&&nt[1]!=="tcp")throw new Error("Invalid multiaddr");const rt=tt.tuples();if(!rt[0][1]||!rt[1][1])throw new Error("Invalid multiaddr");rt[0][0]===4?(this.set("ip",rt[0][1]),this.set(nt[1],rt[1][1])):(this.set("ip6",rt[0][1]),this.set(nt[1]+"6",rt[1][1]))}getAllLocationMultiaddrs(){const tt=[];for(const rt of Object.values(TransportProtocolPerIpVersion)){const ot=this.getLocationMultiaddr(rt);ot&&tt.push(ot)}const nt=this.multiaddrs??[];return tt.concat(nt).map(rt=>this.peerId?rt.encapsulate(`/p2p/${this.peerId.toString()}`):rt)}get peerInfo(){const tt=this.peerId;if(tt)return{id:tt,multiaddrs:this.getAllLocationMultiaddrs()}}getFullMultiaddr(tt){if(this.peerId){const nt=this.getLocationMultiaddr(tt);if(nt)return nt.encapsulate(`/p2p/${this.peerId.toString()}`)}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const tt=this.peerId;return this.multiaddrs.map(nt=>nt.encapsulate(`/p2p/${tt.toString()}`))}return[]}verify(tt,nt){if(!this.get("id")||this.id!=="v4")throw new Error(ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return verifySignature(nt,keccak256(tt),this.publicKey)}async sign(tt,nt){switch(this.id){case"v4":this.signature=await sign(nt,tt);break;default:throw new Error(ERR_INVALID_ID)}return this.signature}};Ct(os,"RECORD_PREFIX","enr:");let ENR=os;const version$2="logger/5.7.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const o=[];if(["NFD","NFC","NFKD","NFKC"].forEach(et=>{try{if("test".normalize(et)!=="test")throw new Error("bad normalize")}catch{o.push(et)}}),o.length)throw new Error("missing "+o.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(o){return o.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARNING="WARNING",o.ERROR="ERROR",o.OFF="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(o){o.UNKNOWN_ERROR="UNKNOWN_ERROR",o.NOT_IMPLEMENTED="NOT_IMPLEMENTED",o.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",o.NETWORK_ERROR="NETWORK_ERROR",o.SERVER_ERROR="SERVER_ERROR",o.TIMEOUT="TIMEOUT",o.BUFFER_OVERRUN="BUFFER_OVERRUN",o.NUMERIC_FAULT="NUMERIC_FAULT",o.MISSING_NEW="MISSING_NEW",o.INVALID_ARGUMENT="INVALID_ARGUMENT",o.MISSING_ARGUMENT="MISSING_ARGUMENT",o.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",o.CALL_EXCEPTION="CALL_EXCEPTION",o.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",o.NONCE_EXPIRED="NONCE_EXPIRED",o.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",o.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",o.TRANSACTION_REPLACED="TRANSACTION_REPLACED",o.ACTION_REJECTED="ACTION_REJECTED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{constructor(et){Object.defineProperty(this,"version",{enumerable:!0,value:et,writable:!1})}_log(et,tt){const nt=et.toLowerCase();LogLevels[nt]==null&&this.throwArgumentError("invalid log level name","logLevel",et),!(_logLevel>LogLevels[nt])&&console.log.apply(console,tt)}debug(...et){this._log(Logger.levels.DEBUG,et)}info(...et){this._log(Logger.levels.INFO,et)}warn(...et){this._log(Logger.levels.WARNING,et)}makeError(et,tt,nt){if(_censorErrors)return this.makeError("censored error",tt,{});tt||(tt=Logger.errors.UNKNOWN_ERROR),nt||(nt={});const rt=[];Object.keys(nt).forEach(at=>{const ct=nt[at];try{if(ct instanceof Uint8Array){let lt="";for(let dt=0;dt>4],lt+=HEX[ct[dt]&15];rt.push(at+"=Uint8Array(0x"+lt+")")}else rt.push(at+"="+JSON.stringify(ct))}catch{rt.push(at+"="+JSON.stringify(nt[at].toString()))}}),rt.push(`code=${tt}`),rt.push(`version=${this.version}`);const ot=et;let it="";switch(tt){case ErrorCode.NUMERIC_FAULT:{it="NUMERIC_FAULT";const at=et;switch(at){case"overflow":case"underflow":case"division-by-zero":it+="-"+at;break;case"negative-power":case"negative-width":it+="-unsupported";break;case"unbound-bitwise-result":it+="-unbound-result";break}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:it=tt;break}it&&(et+=" [ See: https://links.ethers.org/v5-errors-"+it+" ]"),rt.length&&(et+=" ("+rt.join(", ")+")");const st=new Error(et);return st.reason=ot,st.code=tt,Object.keys(nt).forEach(function(at){st[at]=nt[at]}),st}throwError(et,tt,nt){throw this.makeError(et,tt,nt)}throwArgumentError(et,tt,nt){return this.throwError(et,Logger.errors.INVALID_ARGUMENT,{argument:tt,value:nt})}assert(et,tt,nt,rt){et||this.throwError(tt,nt,rt)}assertArgument(et,tt,nt,rt){et||this.throwArgumentError(tt,nt,rt)}checkNormalize(et){_normalizeError&&this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(et,tt){typeof et=="number"&&(tt==null&&(tt="value not safe"),(et<0||et>=9007199254740991)&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:et}),et%1&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:et}))}checkArgumentCount(et,tt,nt){nt?nt=": "+nt:nt="",ettt&&this.throwError("too many arguments"+nt,Logger.errors.UNEXPECTED_ARGUMENT,{count:et,expectedCount:tt})}checkNew(et,tt){(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}checkAbstract(et,tt){et===tt?this.throwError("cannot instantiate abstract class "+JSON.stringify(tt.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:et.name,operation:"new"}):(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}static globalLogger(){return _globalLogger||(_globalLogger=new Logger(version$2)),_globalLogger}static setCensorship(et,tt){if(!et&&tt&&this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!et)return;this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!et,_permanentCensorErrors=!!tt}static setLogLevel(et){const tt=LogLevels[et.toLowerCase()];if(tt==null){Logger.globalLogger().warn("invalid log level - "+et);return}_logLevel=tt}static from(et){return new Logger(et)}}Logger.errors=ErrorCode;Logger.levels=LogLevel;const version$1="bytes/5.7.0",logger$1=new Logger(version$1);function isHexable(o){return!!o.toHexString}function addSlice(o){return o.slice||(o.slice=function(){const et=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(o,et)))}),o}function isBytesLike(o){return isHexString(o)&&!(o.length%2)||isBytes(o)}function isInteger(o){return typeof o=="number"&&o==o&&o%1===0}function isBytes(o){if(o==null)return!1;if(o.constructor===Uint8Array)return!0;if(typeof o=="string"||!isInteger(o.length)||o.length<0)return!1;for(let et=0;et=256)return!1}return!0}function arrayify(o,et){if(et||(et={}),typeof o=="number"){logger$1.checkSafeUint53(o,"invalid arrayify value");const tt=[];for(;o;)tt.unshift(o&255),o=parseInt(String(o/256));return tt.length===0&&tt.push(0),addSlice(new Uint8Array(tt))}if(et.allowMissingPrefix&&typeof o=="string"&&o.substring(0,2)!=="0x"&&(o="0x"+o),isHexable(o)&&(o=o.toHexString()),isHexString(o)){let tt=o.substring(2);tt.length%2&&(et.hexPad==="left"?tt="0"+tt:et.hexPad==="right"?tt+="0":logger$1.throwArgumentError("hex data is odd-length","value",o));const nt=[];for(let rt=0;rt>4]+HexCharacters[rt&15]}return tt}return logger$1.throwArgumentError("invalid hexlify value","value",o)}const version="rlp/5.7.0",logger=new Logger(version);function arrayifyInteger(o){const et=[];for(;o;)et.unshift(o&255),o>>=8;return et}function unarrayifyInteger(o,et,tt){let nt=0;for(let rt=0;rtet+1+nt&&logger.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+nt,result:rt}}function _decode(o,et){if(o.length===0&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{}),o[et]>=248){const tt=o[et]-247;et+1+tt>o.length&&logger.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);return et+1+tt+nt>o.length&&logger.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1+tt,tt+nt)}else if(o[et]>=192){const tt=o[et]-192;return et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1,tt)}else if(o[et]>=184){const tt=o[et]-183;et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);et+1+tt+nt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const rt=hexlify(o.slice(et+1+tt,et+1+tt+nt));return{consumed:1+tt+nt,result:rt}}else if(o[et]>=128){const tt=o[et]-128;et+1+tt>o.length&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{});const nt=hexlify(o.slice(et+1,et+1+tt));return{consumed:1+tt,result:nt}}return{consumed:1,result:hexlify(o[et])}}function decode$4(o){const et=arrayify(o),tt=_decode(et,0);return tt.consumed!==et.length&&logger.throwArgumentError("invalid rlp data","data",o),tt.result}const log$8=new Logger$1("enr:decoder");class EnrDecoder{static fromString(et){if(!et.startsWith(ENR.RECORD_PREFIX))throw new Error(`"string encoded ENR must start with '${ENR.RECORD_PREFIX}'`);return EnrDecoder.fromRLP(fromString(et.slice(4),"base64url"))}static fromRLP(et){const tt=decode$4(et).map(hexToBytes$1);return fromValues(tt)}}async function fromValues(o){const{signature:et,seq:tt,kvs:nt}=checkValues(o),rt={};for(let st=0;stv4Regex$1.test(o),encode(o,et,tt){tt=~~tt,et=et||new Uint8Array(tt+v4Size);const nt=o.length;let rt=0;for(let ot=0;oto.length>0&&v6Regex$1.test(o),encode(o,et,tt){tt=~~tt;let nt=tt+v6Size,rt=-1,ot=0,it=0,st=!0,at=!1;et=et||new Uint8Array(tt+v6Size);for(let ct=0;ct>8),tt=97?lt-=87:lt>=65?lt-=55:(lt-=48,it=it*10+lt),ot=(ot<<4)+lt)}if(st===!1)at===!0?(tt>8),tt=rt+2;ct--)et[ct]=et[ct-2];et[rt]=0,et[rt+1]=0,rt=tt}if(rt!==tt&&rt!==-1)for(tt>nt-2&&(tt=nt-2);nt>rt;)et[--nt]=ttrt?et[--tt]:0;else for(;tt=SURROGATE_B||(o.charCodeAt(ot)&64512)!==SURROGATE_B?et+=3:(nt=ot,et+=4)}}return et}function encode$1(o,et,tt){const nt=o.length;tt==null&&(tt=0),et===void 0&&(et=new Uint8Array(encodingLength$1(o)+tt));let rt=tt;for(let ot=0;ot>6,et[rt++]=128|it&63;else if((it&63488)!==SURROGATE_A)et[rt++]=224|(it&61440)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63;else{const st=ot+1;if(st===nt||it>=SURROGATE_B)et[rt++]=239,et[rt++]=191,et[rt++]=189;else{const at=o.charCodeAt(st);(at&64512)!==SURROGATE_B?(et[rt++]=239,et[rt++]=191,et[rt++]=189):(ot=st,it=65536|(it&1023)<<10|at&1023,et[rt++]=240|(it&1835008)>>18,et[rt++]=128|(it&258048)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63)}}}return encode$1.bytes=rt-tt,et}encode$1.bytes=0;function decode$2(o,et,tt){let nt="";et==null&&(et=0),tt==null&&(tt=o.length);for(let rt=et;rt191&&ot<224)it=(ot&31)<<6|o[rt++]&63;else if(ot>239&&ot<365){it=((ot&7)<<18|(o[rt++]&63)<<12|(o[rt++]&63)<<6|o[rt++]&63)-65536;const st=SURROGATE_A|it>>10&1023;nt+=String.fromCharCode(st),it=SURROGATE_B|it&1023}else it=(ot&15)<<12|(o[rt++]&63)<<6|o[rt++]&63;nt+=String.fromCharCode(it)}return decode$2.bytes=tt-et,nt}decode$2.bytes=0;const isU8Arr=o=>o instanceof Uint8Array;function bytelength(o){return typeof o=="string"?encodingLength$1(o):o.byteLength}function from(o){return o instanceof Uint8Array?o:Array.isArray(o)?new Uint8Array(o):encode$1(o)}function write(o,et,tt){if(typeof et!="string")throw new Error("unknown input type");return encode$1(et,o,tt),encode$1.bytes}const P_24=Math.pow(2,24),P_16=Math.pow(2,16),P_8=Math.pow(2,8),readUInt32BE=(o,et)=>o[et]*P_24+o[et+1]*P_16+o[et+2]*P_8+o[et+3],readUInt16BE=(o,et)=>o[et]<<8|o[et+1],writeUInt32BE=(o,et,tt)=>(et=+et,o[tt+3]=et,et=et>>>8,o[tt+2]=et,et=et>>>8,o[tt+1]=et,et=et>>>8,o[tt]=et,tt+4),writeUInt16BE=(o,et,tt)=>(o[tt]=et>>8,o[tt+1]=et&255,tt+2);function copy(o,et,tt,nt,rt){return tt<0&&(nt-=tt,tt=0),nt<0&&(nt=0),rt<0?new Uint8Array(0):tt>=et.length||nt>=rt?0:_copyActual(o,et,tt,nt,rt)}function _copyActual(o,et,tt,nt,rt){rt-nt>et.length-tt&&(rt=nt+et.length-tt);let ot=rt-nt;const it=o.length-nt;return ot>it&&(ot=it),(nt!==0||rto)}}const name$1=codec({encode(o,et,tt){et||(et=new Uint8Array(name$1.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.replace(/^\.|\.$/gm,"");if(rt.length){const ot=rt.split(".");for(let it=0;it=o.length)throw new Error("Cannot decode name (buffer overflow)");const st=o[et++];if(ot+=it?0:1,st===0)break;if(st&192)if((st&192)===192){if(et+1>o.length)throw new Error("Cannot decode name (buffer overflow)");const at=readUInt16BE(o,et-1)-49152;if(at>=nt)throw new Error("Cannot decode name (bad pointer)");et=at,nt=at,ot+=it?0:1,it=!0}else throw new Error("Cannot decode name (bad label)");else{if(et+st>o.length)throw new Error("Cannot decode name (buffer overflow)");if(rt+=st+1,rt>254)throw new Error("Cannot decode name (name too long)");tt.push(decode$2(o,et,et+st)),et+=st,ot+=it?0:st}}return name$1.decode.bytes=ot,tt.length===0?".":tt.join(".")},encodingLength(o){return o==="."||o===".."?1:bytelength(o.replace(/^\.|\.$/gm,""))+2}}),string$2=codec({encode(o,et,tt){et||(et=new Uint8Array(string$2.encodingLength(o))),tt||(tt=0);const nt=write(et,o,tt+1);return et[tt]=nt,string$2.encode.bytes=nt+1,et},decode(o,et){et||(et=0);const tt=o[et],nt=decode$2(o,et+1,et+1+tt);return string$2.decode.bytes=tt+1,nt},encodingLength(o){return bytelength(o)+1}}),header=codec({bytes:12,encode(o,et,tt){et||(et=new Uint8Array(header.encodingLength(o))),tt||(tt=0);const nt=(o.flags||0)&32767,rt=o.type==="response"?RESPONSE_FLAG:QUERY_FLAG;return writeUInt16BE(et,o.id||0,tt),writeUInt16BE(et,nt|rt,tt+2),writeUInt16BE(et,o.questions.length,tt+4),writeUInt16BE(et,o.answers.length,tt+6),writeUInt16BE(et,o.authorities.length,tt+8),writeUInt16BE(et,o.additionals.length,tt+10),et},decode(o,et){if(et||(et=0),o.length<12)throw new Error("Header must be 12 bytes");const tt=readUInt16BE(o,et+2);return{id:readUInt16BE(o,et),type:tt&RESPONSE_FLAG?"response":"query",flags:tt&32767,flag_qr:(tt>>15&1)===1,opcode:toString$4(tt>>11&15),flag_aa:(tt>>10&1)===1,flag_tc:(tt>>9&1)===1,flag_rd:(tt>>8&1)===1,flag_ra:(tt>>7&1)===1,flag_z:(tt>>6&1)===1,flag_ad:(tt>>5&1)===1,flag_cd:(tt>>4&1)===1,rcode:toString$5(tt&15),questions:new Array(readUInt16BE(o,et+4)),answers:new Array(readUInt16BE(o,et+6)),authorities:new Array(readUInt16BE(o,et+8)),additionals:new Array(readUInt16BE(o,et+10))}},encodingLength(){return 12}}),runknown=codec({encode(o,et,tt){et||(et=new Uint8Array(runknown.encodingLength(o))),tt||(tt=0);const nt=o.length;return writeUInt16BE(et,nt,tt),copy(o,et,tt+2,0,nt),runknown.encode.bytes=nt+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=o.slice(et+2,et+2+tt);return runknown.decode.bytes=tt+2,nt},encodingLength(o){return o.length+2}}),rns=codec({encode(o,et,tt){return et||(et=new Uint8Array(rns.encodingLength(o))),tt||(tt=0),name$1.encode(o,et,tt+2),writeUInt16BE(et,name$1.encode.bytes,tt),rns.encode.bytes=name$1.encode.bytes+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=name$1.decode(o,et+2);return rns.decode.bytes=tt+2,nt},encodingLength(o){return name$1.encodingLength(o)+2}}),rsoa=codec({encode(o,et,tt){et||(et=new Uint8Array(rsoa.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mname,et,tt),tt+=name$1.encode.bytes,name$1.encode(o.rname,et,tt),tt+=name$1.encode.bytes,writeUInt32BE(et,o.serial||0,tt),tt+=4,writeUInt32BE(et,o.refresh||0,tt),tt+=4,writeUInt32BE(et,o.retry||0,tt),tt+=4,writeUInt32BE(et,o.expire||0,tt),tt+=4,writeUInt32BE(et,o.minimum||0,tt),tt+=4,writeUInt16BE(et,tt-nt-2,nt),rsoa.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.rname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.serial=readUInt32BE(o,et),et+=4,nt.refresh=readUInt32BE(o,et),et+=4,nt.retry=readUInt32BE(o,et),et+=4,nt.expire=readUInt32BE(o,et),et+=4,nt.minimum=readUInt32BE(o,et),et+=4,rsoa.decode.bytes=et-tt,nt},encodingLength(o){return 22+name$1.encodingLength(o.mname)+name$1.encodingLength(o.rname)}}),rtxt=codec({encode(o,et,tt){Array.isArray(o)||(o=[o]);for(let rt=0;rt0;){const ot=o[et++];if(--nt,ntnew Uint8Array(o),roption=codec({encode(o,et,tt){et||(et=new Uint8Array(roption.encodingLength(o))),tt||(tt=0);const nt=tt,rt=toCode(o.code);if(writeUInt16BE(et,rt,tt),tt+=2,o.data)writeUInt16BE(et,o.data.length,tt),tt+=2,copy(o.data,et,tt),tt+=o.data.length;else switch(rt){case 8:{const ot=o.sourcePrefixLength||0,it=o.family||familyOf(o.ip),st=encode$2(o.ip,alloc),at=Math.ceil(ot/8);writeUInt16BE(et,at+4,tt),tt+=2,writeUInt16BE(et,it,tt),tt+=2,et[tt++]=ot,et[tt++]=o.scopePrefixLength||0,copy(st,et,tt,0,at),tt+=at}break;case 11:o.timeout?(writeUInt16BE(et,2,tt),tt+=2,writeUInt16BE(et,o.timeout,tt),tt+=2):(writeUInt16BE(et,0,tt),tt+=2);break;case 12:{const ot=o.length||0;writeUInt16BE(et,ot,tt),tt+=2,et.fill(0,tt,tt+ot),tt+=ot}break;case 14:{const ot=o.tags.length*2;writeUInt16BE(et,ot,tt),tt+=2;for(const it of o.tags)writeUInt16BE(et,it,tt),tt+=2}break;default:throw new Error(`Unknown roption code: ${o.code}`)}return roption.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt={};tt.code=readUInt16BE(o,et),tt.type=toString$2(tt.code),et+=2;const nt=readUInt16BE(o,et);switch(et+=2,tt.data=o.slice(et,et+nt),tt.code){case 8:tt.family=readUInt16BE(o,et),et+=2,tt.sourcePrefixLength=o[et++],tt.scopePrefixLength=o[et++];{const rt=new Uint8Array(tt.family===1?4:16);copy(o,rt,0,et,et+nt-4),tt.ip=decode$3(rt)}break;case 11:nt>0&&(tt.timeout=readUInt16BE(o,et),et+=2);break;case 14:tt.tags=[];for(let rt=0;rt0;)nt[ot++]=roption.decode(o,et),et+=roption.decode.bytes,rt-=roption.decode.bytes;return ropt.decode.bytes=et-tt,nt},encodingLength(o){return 2+encodingLengthList(o||[],roption)}}),rdnskey=codec({encode(o,et,tt){et||(et=new Uint8Array(rdnskey.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.key;if(!isU8Arr(rt))throw new Error("Key must be a Buffer");return tt+=2,writeUInt16BE(et,o.flags,tt),tt+=2,et[tt]=rdnskey.PROTOCOL_DNSSEC,tt+=1,et[tt]=o.algorithm,tt+=1,copy(rt,et,tt,0,rt.length),tt+=rt.length,rdnskey.encode.bytes=tt-nt,writeUInt16BE(et,rdnskey.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);if(et+=2,nt.flags=readUInt16BE(o,et),et+=2,o[et]!==rdnskey.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return et+=1,nt.algorithm=o[et],et+=1,nt.key=o.slice(et,tt+rt+2),et+=nt.key.length,rdnskey.decode.bytes=et-tt,nt},encodingLength(o){return 6+bytelength(o.key)}});rdnskey.PROTOCOL_DNSSEC=3;rdnskey.ZONE_KEY=128;rdnskey.SECURE_ENTRYPOINT=32768;const rrrsig=codec({encode(o,et,tt){et||(et=new Uint8Array(rrrsig.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.signature;if(!isU8Arr(rt))throw new Error("Signature must be a Buffer");return tt+=2,writeUInt16BE(et,toType(o.typeCovered),tt),tt+=2,et[tt]=o.algorithm,tt+=1,et[tt]=o.labels,tt+=1,writeUInt32BE(et,o.originalTTL,tt),tt+=4,writeUInt32BE(et,o.expiration,tt),tt+=4,writeUInt32BE(et,o.inception,tt),tt+=4,writeUInt16BE(et,o.keyTag,tt),tt+=2,name$1.encode(o.signersName,et,tt),tt+=name$1.encode.bytes,copy(rt,et,tt,0,rt.length),tt+=rt.length,rrrsig.encode.bytes=tt-nt,writeUInt16BE(et,rrrsig.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);return et+=2,nt.typeCovered=toString$6(readUInt16BE(o,et)),et+=2,nt.algorithm=o[et],et+=1,nt.labels=o[et],et+=1,nt.originalTTL=readUInt32BE(o,et),et+=4,nt.expiration=readUInt32BE(o,et),et+=4,nt.inception=readUInt32BE(o,et),et+=4,nt.keyTag=readUInt16BE(o,et),et+=2,nt.signersName=name$1.decode(o,et),et+=name$1.decode.bytes,nt.signature=o.slice(et,tt+rt+2),et+=nt.signature.length,rrrsig.decode.bytes=et-tt,nt},encodingLength(o){return 20+name$1.encodingLength(o.signersName)+bytelength(o.signature)}}),rrp=codec({encode(o,et,tt){et||(et=new Uint8Array(rrp.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mbox||".",et,tt),tt+=name$1.encode.bytes,name$1.encode(o.txt||".",et,tt),tt+=name$1.encode.bytes,rrp.encode.bytes=tt-nt,writeUInt16BE(et,rrp.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mbox=name$1.decode(o,et)||".",et+=name$1.decode.bytes,nt.txt=name$1.decode(o,et)||".",et+=name$1.decode.bytes,rrp.decode.bytes=et-tt,nt},encodingLength(o){return 2+name$1.encodingLength(o.mbox||".")+name$1.encodingLength(o.txt||".")}}),typebitmap=codec({encode(o,et,tt){et||(et=new Uint8Array(typebitmap.encodingLength(o))),tt||(tt=0);const nt=tt,rt=[];for(let ot=0;ot>8]===void 0&&(rt[it>>8]=[]),rt[it>>8][it>>3&31]|=1<<7-(it&7)}for(let ot=0;ot>8]=Math.max(et[rt>>8]||0,rt&255)}let tt=0;for(let nt=0;nt>15&1)===1,tt.options=ropt.decode(o,et+8),et+=8+ropt.decode.bytes;else{const rt=readUInt16BE(o,et+2);tt.ttl=readUInt32BE(o,et+4),tt.class=toString$3(rt&NOT_FLUSH_MASK),tt.flush=!!(rt&FLUSH_MASK);const ot=renc(tt.type);tt.data=ot.decode(o,et+8),et+=8+ot.decode.bytes}return answer.decode.bytes=et-nt,tt},encodingLength(o){const et=o.data!==null&&o.data!==void 0?o.data:o.options;return name$1.encodingLength(o.name)+8+renc(o.type).encodingLength(et)}}),question=codec({encode(o,et,tt){et||(et=new Uint8Array(question.encodingLength(o))),tt||(tt=0);const nt=tt;return name$1.encode(o.name,et,tt),tt+=name$1.encode.bytes,writeUInt16BE(et,toType(o.type),tt),tt+=2,writeUInt16BE(et,toClass(o.class===void 0?"IN":o.class),tt),tt+=2,question.encode.bytes=tt-nt,o},decode(o,et){et||(et=0);const tt=et,nt={};return nt.name=name$1.decode(o,et),et+=name$1.decode.bytes,nt.type=toString$6(readUInt16BE(o,et)),et+=2,nt.class=toString$3(readUInt16BE(o,et)),et+=2,!!(nt.class&QU_MASK)&&(nt.class&=NOT_QU_MASK),question.decode.bytes=et-tt,nt},encodingLength(o){return name$1.encodingLength(o.name)+4}}),RECURSION_DESIRED=256,packet={encode:function(o,et,tt){const nt=!et;nt&&(et=new Uint8Array(encodingLength(o))),tt||(tt=0);const rt=tt;return o.questions||(o.questions=[]),o.answers||(o.answers=[]),o.authorities||(o.authorities=[]),o.additionals||(o.additionals=[]),header.encode(o,et,tt),tt+=header.encode.bytes,tt=encodeList(o.questions,question,et,tt),tt=encodeList(o.answers,answer,et,tt),tt=encodeList(o.authorities,answer,et,tt),tt=encodeList(o.additionals,answer,et,tt),packet.encode.bytes=tt-rt,nt&&encode.bytes!==et.length?et.slice(0,encode.bytes):et},decode:function(o,et){et||(et=0);const tt=et,nt=header.decode(o,et);return et+=header.decode.bytes,et=decodeList(nt.questions,question,o,et),et=decodeList(nt.answers,answer,o,et),et=decodeList(nt.authorities,answer,o,et),et=decodeList(nt.additionals,answer,o,et),packet.decode.bytes=et-tt,nt},encodingLength:function(o){return header.encodingLength(o)+encodingLengthList(o.questions||[],question)+encodingLengthList(o.answers||[],answer)+encodingLengthList(o.authorities||[],answer)+encodingLengthList(o.additionals||[],answer)}};packet.encode.bytes=0;packet.decode.bytes=0;const encode=packet.encode,decode$1=packet.decode,encodingLength=packet.encodingLength;function encodingLengthList(o,et){let tt=0;for(let nt=0;nt255)throw new Error(`Character #${at} in charset [code=${ct}, char=${et.charAt(at)}] is too high! (max=255)`);if(rt[ct]!==0)throw new Error(`Character [code=${ct}, char=${et.charAt(at)}] is more than once in the charset!`);rt[ct]=at,ot[at]=ct}const it=tt.charCodeAt(0),st={name:o,encodingLength(at){const ct=at.length,lt=ct*.75|0;return at.charCodeAt(ct-1)===it?at.charCodeAt(ct-2)===it?lt-2:lt-1:lt},encode(at,ct,lt){ct==null&&(ct=new Uint8Array(st.encodingLength(at))),lt==null&&(lt=0);let dt=at.length;at.charCodeAt(dt-1)===it&&(at.charCodeAt(dt-2)===it?dt-=2:dt-=1);const ht=dt%4,ft=dt-ht;let mt=lt,pt=0;for(;pt>16,ct[mt++]=yt>>8,ct[mt++]=yt,pt+=4}if(ht===3){const yt=rt[at.charCodeAt(pt)]<<10|rt[at.charCodeAt(pt+1)]<<4|rt[at.charCodeAt(pt+2)]>>2;ct[mt++]=yt>>8,ct[mt++]=yt}else ht===2&&(ct[mt++]=rt[at.charCodeAt(pt)]<<2|rt[at.charCodeAt(pt+1)]>>4);return st.encode.bytes=mt-lt,ct},decode(at,ct,lt){ct==null&&(ct=0),lt==null&&(lt=at.length);const dt=lt-ct,ht=dt%3,ft=ct+dt-ht,mt=[];for(let pt=ct;pt>18&63],ot[yt>>12&63],ot[yt>>6&63],ot[yt&63])}if(ht===2){const pt=(at[lt-2]<<8)+at[lt-1];mt.push(ot[pt>>10],ot[pt>>4&63],ot[pt<<2&63]),nt===PREFERS_PADDING&&mt.push(it)}else if(ht===1){const pt=at[lt-1];mt.push(ot[pt>>2],ot[pt<<4&63]),nt===PREFERS_PADDING&&mt.push(it,it)}return st.decode.bytes=dt,String.fromCharCode.apply(String,mt)}};return st}make("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",PREFERS_PADDING);const base64URL=make("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",PREFERS_NO_PADDING);let AbortError=typeof globalThis<"u"?globalThis.AbortError:typeof window<"u"?window.AbortError:null;AbortError||(AbortError=class extends Error{constructor(et="Request aborted."){super(et)}});AbortError.prototype.name="AbortError";AbortError.prototype.code="ABORT_ERR";const URL$1=typeof globalThis<"u"&&globalThis.URL||require("url").URL;class HTTPStatusError extends Error{constructor(et,tt,nt){super("status="+tt+" while requesting "+et+" ["+nt+"]"),this.uri=et,this.status=tt,this.method=nt}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}HTTPStatusError.prototype.name="HTTPStatusError";HTTPStatusError.prototype.code="HTTP_STATUS";class ResponseError extends Error{constructor(et,tt){super(et),this.cause=tt}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:reduceError(this.cause)}}}ResponseError.prototype.name="ResponseError";ResponseError.prototype.code="RESPONSE_ERR";class TimeoutError extends Error{constructor(et){super("Timeout (t="+et+")."),this.timeout=et}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}TimeoutError.prototype.name="TimeoutError";TimeoutError.prototype.code="ETIMEOUT";const v4Regex=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,v6Regex=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function reduceError(o){if(typeof o=="string")return{message:o};try{const tt=JSON.stringify(o);if(tt!=="{}")return JSON.parse(tt)}catch{}const et={message:String(o.message||o)};return o.code!==void 0&&(et.code=String(o.code)),et}const baseParts=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,httpFlags=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/ig,updFlags=/\[(((pk|name)=([^\]]+)))\]/ig;function parseEndpoint(o){const et=baseParts.exec(o),tt=et[2]||"https:",nt=et[3],rt=et[5],ot=et[6],it=et[7];if(tt==="https:"||tt==="http:"){const st=parseFlags(it,httpFlags);return{name:st.name,protocol:tt,ipv4:st.ipv4,ipv6:st.ipv6,host:nt,port:rt,path:ot,method:st.post?"POST":"GET"}}if(tt==="udp:"||tt==="udp4:"||tt==="udp6:"){const st=parseFlags(it,updFlags),at=/^\[(.*)\]$/.exec(nt);if(at&&tt==="udp4:")throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${o})`);if(!at&&tt==="udp6:")throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${o})`);return at?new UDP6Endpoint({protocol:"udp6:",ipv6:at[1],port:rt,pk:st.pk,name:st.name}):new UDP4Endpoint({protocol:"udp4:",ipv4:nt,port:rt,pk:st.pk,name:st.name})}throw new InvalidProtocolError(tt,o)}function parseFlags(o,et){et.lastIndex=0;const tt={};for(;;){const nt=et.exec(o);if(!nt)break;nt[2]?tt[nt[3].toLowerCase()]=nt[4]:tt[nt[1].toLowerCase()]=!0}return tt}class InvalidProtocolError extends Error{constructor(et,tt){super(`Invalid Endpoint: unsupported protocol "${et}" for endpoint: ${tt}, supported protocols: ${supportedProtocols.join(", ")}`),this.protocol=et,this.endpoint=tt}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}InvalidProtocolError.prototype.name="InvalidProtocolError";InvalidProtocolError.prototype.code="EPROTOCOL";const supportedProtocols=["http:","https:","udp4:","udp6:"];class BaseEndpoint{constructor(et,tt){this.name=et.name||null,this.protocol=et.protocol;const nt=typeof et.port=="string"?et.port=parseInt(et.port,10):et.port;if(nt==null)this.port=tt?this.protocol==="https:"?443:80:et.pk?443:53;else{if(typeof nt!="number"&&!isNaN(nt))throw new Error(`Invalid Endpoint: port "${et.port}" needs to be a number: ${JSON.stringify(et)}`);this.port=nt}}toJSON(){return this.toString()}}class UDPEndpoint extends BaseEndpoint{constructor(et){super(et,!1),this.pk=et.pk||null}toString(){const et=this.port!==(this.pk?443:53)?`:${this.port}`:"",tt=this.pk?` [pk=${this.pk}]`:"",nt=this.name?` [name=${this.name}]`:"";return`udp://${this.ipv4||`[${this.ipv6}]`}${et}${tt}${nt}`}}class UDP4Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp4:"},et)),!et.ipv4||typeof et.ipv4!="string")throw new Error(`Invalid Endpoint: .ipv4 "${et.ipv4}" needs to be set: ${JSON.stringify(et)}`);this.ipv4=et.ipv4}}class UDP6Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp6:"},et)),!et.ipv6||typeof et.ipv6!="string")throw new Error(`Invalid Endpoint: .ipv6 "${et.ipv6}" needs to be set: ${JSON.stringify(et)}`);this.ipv6=et.ipv6}}function safeHost(o){return v6Regex.test(o)&&!v4Regex.test(o)?`[${o}]`:o}class HTTPEndpoint extends BaseEndpoint{constructor(et){if(super(Object.assign({protocol:"https:"},et),!0),et.host||(et.ipv4&&(et.host=et.ipv4),et.ipv6&&(et.host=`[${et.ipv6}]`)),!et.host||typeof et.host!="string")throw new Error(`Invalid Endpoint: host "${et.path}" needs to be set: ${JSON.stringify(et)}`);if(this.host=et.host,this.path=et.path||"/dns-query",this.method=/^post$/i.test(et.method)?"POST":"GET",this.ipv4=et.ipv4,this.ipv6=et.ipv6,!this.ipv6){const nt=v6Regex.exec(this.host);nt&&(this.ipv6=nt[1])}this.ipv4||v4Regex.test(this.host)&&(this.ipv4=this.host);const tt=`${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`;try{this.url=new URL$1(tt)}catch(nt){throw new Error(nt.message+` [${tt}]`)}}toString(){const et=this.protocol==="https:"?"":"http://",tt=this.port!==(this.protocol==="https:"?443:80)?`:${this.port}`:"",nt=this.method!=="GET"?" [post]":"",rt=this.path==="/dns-query"?"":this.path,ot=this.name?` [name=${this.name}]`:"",it=this.ipv4&&this.ipv4!==this.host?` [ipv4=${this.ipv4}]`:"",st=this.ipv6&&this.ipv6!==this.host?` [ipv6=${this.ipv6}]`:"";return`${et}${safeHost(this.host)}${tt}${rt}${nt}${it}${st}${ot}`}}function toEndpoint(o){let et;if(typeof o=="string")et=parseEndpoint(o);else{if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Can not convert ${o} to an endpoint`);if(o instanceof BaseEndpoint)return o;et=o}(et.protocol===null||et.protocol===void 0)&&(et.protocol="https:");const tt=et.protocol;if(tt==="udp4:")return new UDP4Endpoint(et);if(tt==="udp6:")return new UDP6Endpoint(et);if(tt==="https:"||tt==="http:")return new HTTPEndpoint(et);throw new InvalidProtocolError(tt,JSON.stringify(et))}const contentType="application/dns-message";function noop$1(){}function queryDns(){throw new Error('Only "doh" endpoints are supported in the browser')}async function loadJSON(o,et,tt,nt){const rt=et?et.localStoragePrefix+et.name:null;if(rt)try{const st=JSON.parse(localStorage.getItem(rt));if(st&&st.time>et.maxTime)return st}catch{}const{data:ot}=await requestRaw(o,"GET",null,tt,nt),it={time:Date.now(),data:JSON.parse(decode$2(ot))};if(rt)try{localStorage.setItem(rt,JSON.stringify(it))}catch{it.time=null}return it}function requestRaw(o,et,tt,nt,rt){return new Promise((ot,it)=>{const st=new URL$1(o);et==="GET"&&tt&&(st.search="?dns="+base64URL.decode(tt));const at=st.toString(),ct=new XMLHttpRequest;ct.open(et,at,!0),ct.setRequestHeader("Accept",contentType),et==="POST"&&ct.setRequestHeader("Content-Type",contentType),ct.responseType="arraybuffer",ct.timeout=nt,ct.ontimeout=lt,ct.onreadystatechange=ht,ct.onerror=mt,ct.onload=dt,et==="POST"?ct.send(tt):ct.send(),rt&&rt.addEventListener("abort",pt);function lt(){ft(new TimeoutError(nt));try{ct.abort()}catch{}}function dt(){if(ct.status!==200)ft(new HTTPStatusError(at,ct.status,et));else{let yt;if(typeof ct.response=="string")yt=encode$1(ct.response);else if(ct.response instanceof Uint8Array)yt=ct.response;else if(Array.isArray(ct.response)||ct.response instanceof ArrayBuffer)yt=new Uint8Array(ct.response);else throw new Error("Unprocessable response "+ct.response);ft(null,yt)}}function ht(){if(ct.readyState>1&&ct.status!==200&&ct.status!==0){ft(new HTTPStatusError(at,ct.status,et));try{ct.abort()}catch{}}}let ft=function(yt,gt){ft=noop$1,rt&&rt.removeEventListener("abort",pt),ot(yt?{error:yt,response:ct}:{data:gt,response:ct})};function mt(){ft(ct.status===200?new Error("Inexplicable XHR Error"):new HTTPStatusError(at,ct.status,et))}function pt(){ft(new AbortError);try{ct.abort()}catch{}}})}function request(o,et,tt,nt,rt){return requestRaw(o,et,tt,nt,rt)}function processResolvers$1(o){return o.filter(et=>et.cors||et.endpoint.cors)}const resolvers={data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:`Public updns DoH service with advertising, tracker and malware filters. Hosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com`,country:"Germany",location:{lat:51.2993,long:9.491},filter:!0},{name:"adguard-dns-doh",endpoint:{protocol:"https:",host:"dns.adguard.com",ipv4:"94.140.15.15"},description:"Remove ads and protect your computer from malware (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-family-doh",endpoint:{protocol:"https:",host:"dns-family.adguard.com",ipv4:"94.140.15.16"},description:"Adguard DNS with safesearch and adult content blocking (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-unfiltered-doh",endpoint:{protocol:"https:",host:"dns-unfiltered.adguard.com",ipv4:"94.140.14.140"},description:"AdGuard public DNS servers without filters (over DoH)",country:"France",location:{lat:48.8582,long:2.3387}},{name:"ahadns-doh-chi",endpoint:{protocol:"https:",host:"doh.chi.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/ Server statistics can be seen at: https://statistics.ahadns.com/?server=chi`,country:"United States",location:{lat:41.8483,long:-87.6517},filter:!0,cors:!0},{name:"ahadns-doh-in",endpoint:{protocol:"https:",host:"doh.in.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/ Server statistics can be seen at: https://statistics.ahadns.com/?server=in`,country:"India",location:{lat:19.0748,long:72.8856},filter:!0,cors:!0},{name:"ahadns-doh-la",endpoint:{protocol:"https:",host:"doh.la.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/ @@ -4047,7 +4047,7 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(){var tt=typeof window=="object"?window:{},nt=!tt.HI_BASE32_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;nt&&(tt=globalThis);var rt=!tt.HI_BASE32_NO_COMMON_JS&&!0&&o.exports,ot="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),it={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},st=[0,0,0,0,0,0,0,0],at=function(gt,xt){xt.length>10&&(xt="..."+xt.substr(-10));var vt=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+gt+" bytes: "+xt+" <-");throw vt.position=gt,vt},ct=function(gt){for(var xt="",vt=gt.length,bt=0,Et=0,wt,kt;bt191&&wt<=223?(kt=wt&31,Et=1):wt<=239?(kt=wt&15,Et=2):wt<=247?(kt=wt&7,Et=3):at(bt,xt);for(var It=0;It191)&&at(bt,xt),kt<<=6,kt+=wt&63;kt>=55296&&kt<=57343&&at(bt,xt),kt>1114111&&at(bt,xt),kt<=65535?xt+=String.fromCharCode(kt):(kt-=65536,xt+=String.fromCharCode((kt>>10)+55296),xt+=String.fromCharCode((kt&1023)+56320))}return xt},lt=function(gt){if(gt==="")return[];if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");gt=gt.replace(/=/g,"");for(var xt,vt,bt,Et,wt,kt,It,Rt,Pt=[],jt=0,Ot=gt.length,Bt=0,zt=Ot>>3<<3;Bt>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255,Pt[jt++]=(wt<<7|kt<<2|It>>>3)&255,Pt[jt++]=(It<<5|Rt)&255;var Ft=Ot-zt;return Ft===2?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255):Ft===4?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255):Ft===5?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255):Ft===7&&(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255,Pt[jt++]=(wt<<7|kt<<2|It>>>3)&255),Pt},dt=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,Pt=parseInt(It/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var jt=It-Pt;return jt===1?(xt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):jt===2?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):jt===4&&(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt++),Et=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},ht=function(gt){var xt,vt,bt,Et,wt,kt,It=!1,Rt="",Pt=0,jt,Ot=0,Bt=gt.length;if(gt==="")return Rt;do{for(st[0]=st[5],st[1]=st[6],st[2]=st[7],jt=Ot;Pt>6,st[jt++]=128|kt&63):kt<55296||kt>=57344?(st[jt++]=224|kt>>12,st[jt++]=128|kt>>6&63,st[jt++]=128|kt&63):(kt=65536+((kt&1023)<<10|gt.charCodeAt(++Pt)&1023),st[jt++]=240|kt>>18,st[jt++]=128|kt>>12&63,st[jt++]=128|kt>>6&63,st[jt++]=128|kt&63);Ot=jt-5,Pt===Bt&&++Pt,Pt>Bt&&jt<6&&(It=!0),xt=st[0],jt>4?(vt=st[1],bt=st[2],Et=st[3],wt=st[4],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31]):jt===1?Rt+=ot[xt>>>3]+ot[xt<<2&31]+"======":jt===2?(vt=st[1],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(vt=st[1],bt=st[2],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):(vt=st[1],bt=st[2],Et=st[3],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"=")}while(!It);return Rt},pt=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,Pt=parseInt(It/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var jt=It-Pt;return jt===1?(xt=gt[Rt],kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):jt===2?(xt=gt[Rt++],vt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):jt===4&&(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt++],Et=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},mt=function(gt,xt){var vt=typeof gt!="string";return vt&>.constructor===ArrayBuffer&&(gt=new Uint8Array(gt)),vt?pt(gt):xt?dt(gt):ht(gt)},ft=function(gt,xt){if(!xt)return ct(lt(gt));if(gt==="")return"";if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");var vt,bt,Et,wt,kt,It,Rt,Pt,jt="",Ot=gt.indexOf("=");Ot===-1&&(Ot=gt.length);for(var Bt=0,zt=Ot>>3<<3;Bt>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)+String.fromCharCode((Rt<<5|Pt)&255);var Ft=Ot-zt;return Ft===2?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)):Ft===4?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)):Ft===5?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)):Ft===7&&(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],Rt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)),jt},yt={encode:mt,decode:ft};ft.asBytes=lt,rt?o.exports=yt:tt.base32=yt})()})(base32$1);var base32Exports=base32$1.exports;const base32=getDefaultExportFromCjs(base32Exports),Cr=class Cr{static parseAndVerifyRoot(et,tt){if(!et.startsWith(this.ROOT_PREFIX))throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);const nt=Cr.parseRootValues(et),rt=base32.decode.asBytes(tt),ot=et.split(" sig")[0],it=utf8ToBytes$1(ot),st=fromString(nt.signature,"base64url").slice(0,64);if(!verifySignature(st,keccak256(it),new Uint8Array(rt)))throw new Error("Unable to verify ENRTree root signature");return nt.eRoot}static parseRootValues(et){const tt=et.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree root entry");tt.shift();const[nt,rt,ot,it]=tt;if(!nt)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!rt)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!ot)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!it)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:nt,lRoot:rt,seq:Number(ot),signature:it}}static parseTree(et){if(!et.startsWith(this.TREE_PREFIX))throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);const tt=et.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree tree entry");tt.shift();const[nt,rt]=tt;if(!nt)throw new Error("Could not parse public key from ENRTree tree entry");if(!rt)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:nt,domain:rt}}static parseBranch(et){if(!et.startsWith(this.BRANCH_PREFIX))throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);return et.split(this.BRANCH_PREFIX)[1].split(",")}};Ct(Cr,"RECORD_PREFIX",ENR.RECORD_PREFIX),Ct(Cr,"TREE_PREFIX","enrtree:"),Ct(Cr,"BRANCH_PREFIX","enrtree-branch:"),Ct(Cr,"ROOT_PREFIX","enrtree-root:");let ENRTree=Cr;const log$6=new Logger$1("discovery:fetch_nodes");async function fetchNodesUntilCapabilitiesFulfilled(o,et,tt){const nt={relay:o.relay??0,store:o.store??0,filter:o.filter??0,lightPush:o.lightPush??0},rt=nt.relay+nt.store+nt.filter+nt.lightPush,ot={relay:0,store:0,filter:0,lightPush:0};let it=0;const st=[];for(;!isSatisfied(nt,ot)&&it=o.relay&&et.store>=o.store&&et.filter>=o.filter&&et.lightPush>=o.lightPush}function isNewPeer(o,et){if(!o.nodeId)return!1;for(const tt of et)if(o.nodeId===tt.nodeId)return!1;return!0}function addCapabilities(o,et){o.relay&&(et.relay+=1),o.store&&(et.store+=1),o.filter&&(et.filter+=1),o.lightPush&&(et.lightPush+=1)}function helpsSatisfyCapabilities(o,et,tt){if(isSatisfied(et,tt))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const nt=missingCapabilities(et,tt);return nt.relay&&o.relay||nt.store&&o.store||nt.filter&&o.filter||nt.lightPush&&o.lightPush}function missingCapabilities(o,et){return{relay:et.relaythis._search(ot,it));return log$5.info("retrieved peers: ",st.map(at=>{var ct,lt;return{id:(ct=at.peerId)==null?void 0:ct.toString(),multiaddrs:(lt=at.multiaddrs)==null?void 0:lt.map(dt=>dt.toString())}})),st}async*getNextPeer(et,tt){const nt=Math.floor(Math.random()*et.length),{publicKey:rt,domain:ot}=ENRTree.parseTree(et[nt]),it={domain:ot,publicKey:rt,visits:{}};for await(const st of yieldNodesUntilCapabilitiesFulfilled(tt,this._errorTolerance,()=>this._search(ot,it)))yield st}async _search(et,tt){try{const nt=await this._getTXTRecord(et,tt);tt.visits[et]=!0;let rt,ot;const it=getEntryType(nt);try{switch(it){case ENRTree.ROOT_PREFIX:return rt=ENRTree.parseAndVerifyRoot(nt,tt.publicKey),await this._search(rt,tt);case ENRTree.BRANCH_PREFIX:return ot=ENRTree.parseBranch(nt),rt=selectRandomPath(ot,tt),await this._search(rt,tt);case ENRTree.RECORD_PREFIX:return EnrDecoder.fromString(nt);default:return null}}catch(st){return log$5.error(`Failed to search DNS tree ${it} at subdomain ${et}: ${st}`),null}}catch(nt){return log$5.error(`Failed to retrieve TXT record at subdomain ${et}: ${nt}`),null}}async _getTXTRecord(et,tt){if(this._DNSTreeCache[et])return this._DNSTreeCache[et];const nt=et!==tt.domain?`${et}.${tt.domain}`:tt.domain,rt=await this.dns.resolveTXT(nt);if(!rt.length)throw new Error("Received empty result array while fetching TXT record");if(!rt[0].length)throw new Error("Received empty TXT record");const ot=rt.join("");return this._DNSTreeCache[et]=ot,ot}}function getEntryType(o){return o.startsWith(ENRTree.ROOT_PREFIX)?ENRTree.ROOT_PREFIX:o.startsWith(ENRTree.BRANCH_PREFIX)?ENRTree.BRANCH_PREFIX:o.startsWith(ENRTree.RECORD_PREFIX)?ENRTree.RECORD_PREFIX:""}function selectRandomPath(o,et){const tt={};for(const[rt,ot]of o.entries())et.visits[ot]&&(tt[rt]=!0);if(Object.keys(tt).length===o.length)throw new Error("Unresolvable circular path detected");let nt;do nt=Math.floor(Math.random()*o.length);while(tt[nt]);return o[nt]}const log$4=new Logger$1("peer-discovery-dns");class PeerDiscoveryDns extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"nextPeer");Ct(this,"_started");Ct(this,"_components");Ct(this,"_options");this._started=!1,this._components=tt,this._options=nt;const{enrUrls:rt}=nt;log$4.info("Use following EIP-1459 ENR Tree URLs: ",rt)}async start(){log$4.info("Starting peer discovery via dns"),this._started=!0,await this.findPeers()}async findPeers(){if(!this.nextPeer){let{enrUrls:tt}=this._options;Array.isArray(tt)||(tt=[tt]);const{wantedNodeCapabilityCount:nt}=this._options,rt=await DnsNodeDiscovery.dnsOverHttp();this.nextPeer=rt.getNextPeer.bind(rt,tt,nt)}for await(const tt of this.nextPeer()){if(!this._started)return;const{peerInfo:nt,shardInfo:rt}=tt;if(!nt)continue;const ot={[DEFAULT_BOOTSTRAP_TAG_NAME]:{value:this._options.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE,ttl:this._options.tagTTL??DEFAULT_BOOTSTRAP_TAG_TTL}};let it=!1;await this._components.peerStore.has(nt.id)?(await this._components.peerStore.get(nt.id)).tags.has(DEFAULT_BOOTSTRAP_TAG_NAME)||(it=!0,await this._components.peerStore.merge(nt.id,{tags:ot})):(it=!0,await this._components.peerStore.save(nt.id,{tags:ot,...rt&&{metadata:{shardInfo:encodeRelayShard(rt)}}})),it&&this.dispatchEvent(new CustomEvent("peer",{detail:nt}))}}stop(){this._started=!1}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return DNS_DISCOVERY_TAG}}function wakuDnsDiscovery(o,et=DEFAULT_NODE_REQUIREMENTS){return tt=>new PeerDiscoveryDns(tt,{enrUrls:o,wantedNodeCapabilityCount:et})}class PeerExchangeRPC{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et){const{numPeers:tt}=et;return new PeerExchangeRPC({query:{numPeers:tt},response:void 0})}encode(){return PeerExchangeRPC$1.encode(this.proto)}static decode(et){const tt=PeerExchangeRPC$1.decode(et);return new PeerExchangeRPC(tt)}get query(){return this.proto.query}get response(){return this.proto.response}}const PeerExchangeCodec="/vac/waku/peer-exchange/2.0.0-alpha1",log$3=new Logger$1("peer-exchange");class WakuPeerExchange extends BaseProtocol{constructor(et,tt){super(PeerExchangeCodec,et,log$3,tt)}async query(et){const{numPeers:tt,peerId:nt}=et,rt=PeerExchangeRPC.createRequest({numPeers:BigInt(tt)}),ot=await this.components.peerStore.get(nt);if(!ot)return{peerInfos:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let it;try{it=await this.getStream(ot)}catch(at){return log$3.error("Failed to get stream",at),{peerInfos:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const st=await pipe([rt.encode()],encode$5,it,decode$5,async at=>await all$2(at));try{const at=new Uint8ArrayList;st.forEach(dt=>{at.append(dt)});const{response:ct}=PeerExchangeRPC.decode(at);return ct?{peerInfos:await Promise.all(ct.peerInfos.map(dt=>dt.enr).filter(isDefined).map(async dt=>({ENR:await EnrDecoder.fromRLP(dt)}))),error:null}:(log$3.error("PeerExchangeRPC message did not contains a `response` field"),{peerInfos:null,error:ProtocolError$1.EMPTY_PAYLOAD})}catch(at){return log$3.error("Failed to decode push reply",at),{peerInfos:null,error:ProtocolError$1.DECODE_FAILED}}}}const log$2=new Logger$1("peer-exchange-discovery"),DEFAULT_PEER_EXCHANGE_REQUEST_NODES=10,DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS=10*1e3,DEFAULT_MAX_RETRIES=3,DEFAULT_PEER_EXCHANGE_TAG_NAME=Tags.PEER_EXCHANGE,DEFAULT_PEER_EXCHANGE_TAG_VALUE=50,DEFAULT_PEER_EXCHANGE_TAG_TTL=1e8;class PeerExchangeDiscovery extends TypedEventEmitter$3{constructor(tt,nt,rt={}){super();Ct(this,"components");Ct(this,"peerExchange");Ct(this,"options");Ct(this,"isStarted");Ct(this,"queryingPeers",new Set);Ct(this,"queryAttempts",new Map);Ct(this,"handleDiscoveredPeer",tt=>{const{protocols:nt,peerId:rt}=tt.detail;!nt.includes(PeerExchangeCodec)||this.queryingPeers.has(rt.toString())||(this.queryingPeers.add(rt.toString()),this.startRecurringQueries(rt).catch(ot=>log$2.error(`Error querying peer ${ot}`)))});Ct(this,"startRecurringQueries",async tt=>{const nt=tt.toString(),{queryInterval:rt=DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS,maxRetries:ot=DEFAULT_MAX_RETRIES}=this.options;log$2.info(`Querying peer: ${nt} (attempt ${this.queryAttempts.get(nt)??1})`),await this.query(tt);const it=this.queryAttempts.get(nt)??1;if(it>ot){this.abortQueriesForPeer(nt);return}setTimeout(()=>{this.queryAttempts.set(nt,it+1),this.startRecurringQueries(tt).catch(st=>{log$2.error(`Error in startRecurringQueries: ${st}`)})},rt*it)});this.components=tt,this.peerExchange=new WakuPeerExchange(tt,nt),this.options=rt,this.isStarted=!1}start(){this.isStarted||(this.dispatchEvent(new CustomEvent("waku:peer-exchange:started",{detail:!0})),log$2.info("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:identify",this.handleDiscoveredPeer))}stop(){this.isStarted&&(log$2.info("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:identify",this.handleDiscoveredPeer))}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return"@waku/peer-exchange"}async query(tt){const{error:nt,peerInfos:rt}=await this.peerExchange.query({numPeers:DEFAULT_PEER_EXCHANGE_REQUEST_NODES,peerId:tt});if(nt)return log$2.error("Peer exchange query failed",nt),{error:nt,peerInfos:null};for(const ot of rt){const{ENR:it}=ot;if(!it){log$2.warn("No ENR in peerInfo object, skipping");continue}const{peerId:st,peerInfo:at,shardInfo:ct}=it;if(!st||!at)continue;if(await this.components.peerStore.has(st)){const{hasMultiaddrDiff:dt,hasShardDiff:ht}=await this.checkPeerInfoDiff(at,ct);if(dt||ht){log$2.info(`Peer ${st.toString()} has updated multiaddrs or shardInfo, updating`),dt&&(log$2.info(`Peer ${st.toString()} has updated multiaddrs, updating`),await this.components.peerStore.patch(st,{multiaddrs:at.multiaddrs})),ht&&ct&&(log$2.info(`Peer ${st.toString()} has updated shardInfo, updating`),await this.components.peerStore.merge(st,{metadata:{shardInfo:encodeRelayShard(ct)}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}})));continue}}await this.components.peerStore.save(st,{tags:{[DEFAULT_PEER_EXCHANGE_TAG_NAME]:{value:this.options.tagValue??DEFAULT_PEER_EXCHANGE_TAG_VALUE,ttl:this.options.tagTTL??DEFAULT_PEER_EXCHANGE_TAG_TTL}},...ct&&{metadata:{shardInfo:encodeRelayShard(ct)}},...at.multiaddrs&&{multiaddrs:at.multiaddrs}}),log$2.info(`Discovered peer: ${st.toString()}`),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}}))}return{error:null,peerInfos:rt}}abortQueriesForPeer(tt){log$2.info(`Aborting queries for peer: ${tt}`),this.queryingPeers.delete(tt),this.queryAttempts.delete(tt)}async checkPeerInfoDiff(tt,nt){const{id:rt}=tt,ot=await this.components.peerStore.get(rt),it=ot.addresses.map(dt=>dt.multiaddr.toString()),st=tt.multiaddrs.map(dt=>dt.toString()),at=it.some(dt=>!st.includes(dt));let ct=!1;const lt=ot.metadata.get("shardInfo");if(lt){const dt=decodeRelayShard(lt);(dt||nt)&&(ct=dt.clusterId!==(nt==null?void 0:nt.clusterId)||dt.shards.some(ht=>!(nt!=null&&nt.shards.includes(ht))))}return{hasMultiaddrDiff:at,hasShardDiff:ct}}}function wakuPeerExchangeDiscovery(o){return et=>new PeerExchangeDiscovery(et,o)}const log$1=new Logger$1("peer-exchange-discovery"),DEFAULT_LOCAL_TAG_NAME=Tags.LOCAL,DEFAULT_LOCAL_TAG_VALUE=50,DEFAULT_LOCAL_TAG_TTL=1e8;class LocalPeerCacheDiscovery extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"components");Ct(this,"options");Ct(this,"isStarted");Ct(this,"peers",[]);Ct(this,"handleNewPeers",tt=>{const{peerId:nt,listenAddrs:rt}=tt.detail,ot=getWsMultiaddrFromMultiaddrs(rt),it=this.getPeersFromLocalStorage(),st=it.findIndex(at=>at.id===nt.toString());st>=0?it[st].address=ot.toString():it.push({id:nt.toString(),address:ot.toString()}),this.peers=it,this.savePeersToLocalStorage()});this.components=tt,this.options=nt,this.isStarted=!1,this.peers=this.getPeersFromLocalStorage()}get[Symbol.toStringTag](){return"@waku/local-peer-cache-discovery"}async start(){var tt,nt,rt;if(!this.isStarted){log$1.info("Starting Local Storage Discovery"),this.components.events.addEventListener("peer:identify",this.handleNewPeers);for(const{id:ot,address:it}of this.peers){const st=peerIdFromString$1(ot);await this.components.peerStore.has(st)||(await this.components.peerStore.save(st,{multiaddrs:[multiaddr(it)],tags:{[((tt=this.options)==null?void 0:tt.tagName)??DEFAULT_LOCAL_TAG_NAME]:{value:((nt=this.options)==null?void 0:nt.tagValue)??DEFAULT_LOCAL_TAG_VALUE,ttl:((rt=this.options)==null?void 0:rt.tagTTL)??DEFAULT_LOCAL_TAG_TTL}}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:[multiaddr(it)]}})))}log$1.info(`Discovered ${this.peers.length} peers`),this.isStarted=!0}}stop(){this.isStarted&&(log$1.info("Stopping Local Storage Discovery"),this.components.events.removeEventListener("peer:identify",this.handleNewPeers),this.isStarted=!1,this.savePeersToLocalStorage())}getPeersFromLocalStorage(){try{const tt=localStorage.getItem("waku:peers");return tt?JSON.parse(tt).filter(isValidStoredPeer):[]}catch(tt){return log$1.error("Error parsing peers from local storage:",tt),[]}}savePeersToLocalStorage(){try{localStorage.setItem("waku:peers",JSON.stringify(this.peers))}catch(tt){log$1.error("Error saving peers to local storage:",tt)}}}function isValidStoredPeer(o){return o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.address=="string"}function wakuLocalPeerCacheDiscovery(){return(o,et)=>new LocalPeerCacheDiscovery(o,et)}function defaultPeerDiscoveries(o){const et=[enrTree.SANDBOX,enrTree.TEST];return[wakuDnsDiscovery(et),wakuLocalPeerCacheDiscovery(),wakuPeerExchangeDiscovery(o)]}const log=new Logger$1("sdk:create");async function defaultLibp2p(o,et,tt){et!=null&&et.hideWebSocketInfo||(console.info("%cIgnore WebSocket connection failures","background: gray; color: white; font-size: x-large"),console.info("%cWaku tries to discover peers and some of them are expected to fail","background: gray; color: white; font-size: x-large"));const nt=o?{metadata:wakuMetadata(o)}:{},rt=(et==null?void 0:et.filterMultiaddrs)===!1?all$1:wss;return createLibp2p({transports:[webSockets({filter:rt})],streamMuxers:[mplex()],connectionEncrypters:[noise()],...et,services:{identify:identify({agentVersion:tt??DefaultUserAgent}),ping:ping({maxInboundStreams:(et==null?void 0:et.pingMaxInboundStreams)??DefaultPingMaxInboundStreams}),...nt,...et==null?void 0:et.services}})}async function createLibp2pAndUpdateOptions(o){const{networkConfig:et}=o,tt=derivePubsubTopicsFromNetworkConfig(et??DefaultNetworkConfig);log.info("Creating Waku node with pubsub topics",tt);const nt=(o==null?void 0:o.libp2p)??{},rt=nt.peerDiscovery??[];return o!=null&&o.defaultBootstrap&&rt.push(...defaultPeerDiscoveries(tt)),o!=null&&o.bootstrapPeers&&rt.push(bootstrap({list:o.bootstrapPeers})),nt.peerDiscovery=rt,{libp2p:await defaultLibp2p(tt,nt,o==null?void 0:o.userAgent),pubsubTopics:tt}}async function createLightNode(o={}){const{libp2p:et,pubsubTopics:tt}=await createLibp2pAndUpdateOptions(o);return new WakuNode(tt,o,et,{store:!0,lightpush:!0,filter:!0})}React.createContext({decoder:void 0,encoder:void 0});const useCreateNode=o=>{const{factory:et,options:tt,protocols:nt=[]}=o,[rt,ot]=React.useState(void 0),[it,st]=React.useState(!0),[at,ct]=React.useState(void 0);return React.useEffect(()=>{let lt=!1;return st(!0),et(tt).then(async dt=>{lt||(await dt.start(),await waitForRemotePeer(dt,nt),ot(dt),st(!1))}).catch(dt=>{st(!1),ct(`Failed at creating node: ${(dt==null?void 0:dt.message)||"no message"}`)}),()=>{lt=!0}},[]),{node:rt,error:at,isLoading:it}},useCreateLightNode=o=>useCreateNode({...o,factory:createLightNode}),WakuContext=React.createContext({node:void 0,isLoading:!1,error:void 0}),useWaku=()=>React.useContext(WakuContext),LightNodeProvider=o=>{const et=useCreateLightNode({options:o.options,protocols:o.protocols});return React.createElement(WakuContext.Provider,{value:et},o.children)};/** + */(function(){var tt=typeof window=="object"?window:{},nt=!tt.HI_BASE32_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;nt&&(tt=globalThis);var rt=!tt.HI_BASE32_NO_COMMON_JS&&!0&&o.exports,ot="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),it={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},st=[0,0,0,0,0,0,0,0],at=function(gt,xt){xt.length>10&&(xt="..."+xt.substr(-10));var vt=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+gt+" bytes: "+xt+" <-");throw vt.position=gt,vt},ct=function(gt){for(var xt="",vt=gt.length,bt=0,Et=0,wt,kt;bt191&&wt<=223?(kt=wt&31,Et=1):wt<=239?(kt=wt&15,Et=2):wt<=247?(kt=wt&7,Et=3):at(bt,xt);for(var It=0;It191)&&at(bt,xt),kt<<=6,kt+=wt&63;kt>=55296&&kt<=57343&&at(bt,xt),kt>1114111&&at(bt,xt),kt<=65535?xt+=String.fromCharCode(kt):(kt-=65536,xt+=String.fromCharCode((kt>>10)+55296),xt+=String.fromCharCode((kt&1023)+56320))}return xt},lt=function(gt){if(gt==="")return[];if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");gt=gt.replace(/=/g,"");for(var xt,vt,bt,Et,wt,kt,It,Rt,$t=[],Nt=0,Mt=gt.length,Bt=0,zt=Mt>>3<<3;Bt>>2)&255,$t[Nt++]=(vt<<6|bt<<1|Et>>>4)&255,$t[Nt++]=(Et<<4|wt>>>1)&255,$t[Nt++]=(wt<<7|kt<<2|It>>>3)&255,$t[Nt++]=(It<<5|Rt)&255;var Ft=Mt-zt;return Ft===2?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],$t[Nt++]=(xt<<3|vt>>>2)&255):Ft===4?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],$t[Nt++]=(xt<<3|vt>>>2)&255,$t[Nt++]=(vt<<6|bt<<1|Et>>>4)&255):Ft===5?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],$t[Nt++]=(xt<<3|vt>>>2)&255,$t[Nt++]=(vt<<6|bt<<1|Et>>>4)&255,$t[Nt++]=(Et<<4|wt>>>1)&255):Ft===7&&(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],$t[Nt++]=(xt<<3|vt>>>2)&255,$t[Nt++]=(vt<<6|bt<<1|Et>>>4)&255,$t[Nt++]=(Et<<4|wt>>>1)&255,$t[Nt++]=(wt<<7|kt<<2|It>>>3)&255),$t},dt=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,$t=parseInt(It/5)*5;Rt<$t;)xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt++),Et=gt.charCodeAt(Rt++),wt=gt.charCodeAt(Rt++),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var Nt=It-$t;return Nt===1?(xt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):Nt===2?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):Nt===3?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):Nt===4&&(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt++),Et=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},ht=function(gt){var xt,vt,bt,Et,wt,kt,It=!1,Rt="",$t=0,Nt,Mt=0,Bt=gt.length;if(gt==="")return Rt;do{for(st[0]=st[5],st[1]=st[6],st[2]=st[7],Nt=Mt;$t>6,st[Nt++]=128|kt&63):kt<55296||kt>=57344?(st[Nt++]=224|kt>>12,st[Nt++]=128|kt>>6&63,st[Nt++]=128|kt&63):(kt=65536+((kt&1023)<<10|gt.charCodeAt(++$t)&1023),st[Nt++]=240|kt>>18,st[Nt++]=128|kt>>12&63,st[Nt++]=128|kt>>6&63,st[Nt++]=128|kt&63);Mt=Nt-5,$t===Bt&&++$t,$t>Bt&&Nt<6&&(It=!0),xt=st[0],Nt>4?(vt=st[1],bt=st[2],Et=st[3],wt=st[4],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31]):Nt===1?Rt+=ot[xt>>>3]+ot[xt<<2&31]+"======":Nt===2?(vt=st[1],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):Nt===3?(vt=st[1],bt=st[2],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):(vt=st[1],bt=st[2],Et=st[3],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"=")}while(!It);return Rt},ft=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,$t=parseInt(It/5)*5;Rt<$t;)xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt++],Et=gt[Rt++],wt=gt[Rt++],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var Nt=It-$t;return Nt===1?(xt=gt[Rt],kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):Nt===2?(xt=gt[Rt++],vt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):Nt===3?(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):Nt===4&&(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt++],Et=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},mt=function(gt,xt){var vt=typeof gt!="string";return vt&>.constructor===ArrayBuffer&&(gt=new Uint8Array(gt)),vt?ft(gt):xt?dt(gt):ht(gt)},pt=function(gt,xt){if(!xt)return ct(lt(gt));if(gt==="")return"";if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");var vt,bt,Et,wt,kt,It,Rt,$t,Nt="",Mt=gt.indexOf("=");Mt===-1&&(Mt=gt.length);for(var Bt=0,zt=Mt>>3<<3;Bt>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)+String.fromCharCode((Rt<<5|$t)&255);var Ft=Mt-zt;return Ft===2?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Nt+=String.fromCharCode((vt<<3|bt>>>2)&255)):Ft===4?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],Nt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)):Ft===5?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],Nt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)):Ft===7&&(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],Rt=it[gt.charAt(Bt++)],Nt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)),Nt},yt={encode:mt,decode:pt};pt.asBytes=lt,rt?o.exports=yt:tt.base32=yt})()})(base32$1);var base32Exports=base32$1.exports;const base32=getDefaultExportFromCjs(base32Exports),Cr=class Cr{static parseAndVerifyRoot(et,tt){if(!et.startsWith(this.ROOT_PREFIX))throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);const nt=Cr.parseRootValues(et),rt=base32.decode.asBytes(tt),ot=et.split(" sig")[0],it=utf8ToBytes$1(ot),st=fromString(nt.signature,"base64url").slice(0,64);if(!verifySignature(st,keccak256(it),new Uint8Array(rt)))throw new Error("Unable to verify ENRTree root signature");return nt.eRoot}static parseRootValues(et){const tt=et.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree root entry");tt.shift();const[nt,rt,ot,it]=tt;if(!nt)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!rt)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!ot)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!it)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:nt,lRoot:rt,seq:Number(ot),signature:it}}static parseTree(et){if(!et.startsWith(this.TREE_PREFIX))throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);const tt=et.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree tree entry");tt.shift();const[nt,rt]=tt;if(!nt)throw new Error("Could not parse public key from ENRTree tree entry");if(!rt)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:nt,domain:rt}}static parseBranch(et){if(!et.startsWith(this.BRANCH_PREFIX))throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);return et.split(this.BRANCH_PREFIX)[1].split(",")}};Ct(Cr,"RECORD_PREFIX",ENR.RECORD_PREFIX),Ct(Cr,"TREE_PREFIX","enrtree:"),Ct(Cr,"BRANCH_PREFIX","enrtree-branch:"),Ct(Cr,"ROOT_PREFIX","enrtree-root:");let ENRTree=Cr;const log$6=new Logger$1("discovery:fetch_nodes");async function fetchNodesUntilCapabilitiesFulfilled(o,et,tt){const nt={relay:o.relay??0,store:o.store??0,filter:o.filter??0,lightPush:o.lightPush??0},rt=nt.relay+nt.store+nt.filter+nt.lightPush,ot={relay:0,store:0,filter:0,lightPush:0};let it=0;const st=[];for(;!isSatisfied(nt,ot)&&it=o.relay&&et.store>=o.store&&et.filter>=o.filter&&et.lightPush>=o.lightPush}function isNewPeer(o,et){if(!o.nodeId)return!1;for(const tt of et)if(o.nodeId===tt.nodeId)return!1;return!0}function addCapabilities(o,et){o.relay&&(et.relay+=1),o.store&&(et.store+=1),o.filter&&(et.filter+=1),o.lightPush&&(et.lightPush+=1)}function helpsSatisfyCapabilities(o,et,tt){if(isSatisfied(et,tt))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const nt=missingCapabilities(et,tt);return nt.relay&&o.relay||nt.store&&o.store||nt.filter&&o.filter||nt.lightPush&&o.lightPush}function missingCapabilities(o,et){return{relay:et.relaythis._search(ot,it));return log$5.info("retrieved peers: ",st.map(at=>{var ct,lt;return{id:(ct=at.peerId)==null?void 0:ct.toString(),multiaddrs:(lt=at.multiaddrs)==null?void 0:lt.map(dt=>dt.toString())}})),st}async*getNextPeer(et,tt){const nt=Math.floor(Math.random()*et.length),{publicKey:rt,domain:ot}=ENRTree.parseTree(et[nt]),it={domain:ot,publicKey:rt,visits:{}};for await(const st of yieldNodesUntilCapabilitiesFulfilled(tt,this._errorTolerance,()=>this._search(ot,it)))yield st}async _search(et,tt){try{const nt=await this._getTXTRecord(et,tt);tt.visits[et]=!0;let rt,ot;const it=getEntryType(nt);try{switch(it){case ENRTree.ROOT_PREFIX:return rt=ENRTree.parseAndVerifyRoot(nt,tt.publicKey),await this._search(rt,tt);case ENRTree.BRANCH_PREFIX:return ot=ENRTree.parseBranch(nt),rt=selectRandomPath(ot,tt),await this._search(rt,tt);case ENRTree.RECORD_PREFIX:return EnrDecoder.fromString(nt);default:return null}}catch(st){return log$5.error(`Failed to search DNS tree ${it} at subdomain ${et}: ${st}`),null}}catch(nt){return log$5.error(`Failed to retrieve TXT record at subdomain ${et}: ${nt}`),null}}async _getTXTRecord(et,tt){if(this._DNSTreeCache[et])return this._DNSTreeCache[et];const nt=et!==tt.domain?`${et}.${tt.domain}`:tt.domain,rt=await this.dns.resolveTXT(nt);if(!rt.length)throw new Error("Received empty result array while fetching TXT record");if(!rt[0].length)throw new Error("Received empty TXT record");const ot=rt.join("");return this._DNSTreeCache[et]=ot,ot}}function getEntryType(o){return o.startsWith(ENRTree.ROOT_PREFIX)?ENRTree.ROOT_PREFIX:o.startsWith(ENRTree.BRANCH_PREFIX)?ENRTree.BRANCH_PREFIX:o.startsWith(ENRTree.RECORD_PREFIX)?ENRTree.RECORD_PREFIX:""}function selectRandomPath(o,et){const tt={};for(const[rt,ot]of o.entries())et.visits[ot]&&(tt[rt]=!0);if(Object.keys(tt).length===o.length)throw new Error("Unresolvable circular path detected");let nt;do nt=Math.floor(Math.random()*o.length);while(tt[nt]);return o[nt]}const log$4=new Logger$1("peer-discovery-dns");class PeerDiscoveryDns extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"nextPeer");Ct(this,"_started");Ct(this,"_components");Ct(this,"_options");this._started=!1,this._components=tt,this._options=nt;const{enrUrls:rt}=nt;log$4.info("Use following EIP-1459 ENR Tree URLs: ",rt)}async start(){log$4.info("Starting peer discovery via dns"),this._started=!0,await this.findPeers()}async findPeers(){if(!this.nextPeer){let{enrUrls:tt}=this._options;Array.isArray(tt)||(tt=[tt]);const{wantedNodeCapabilityCount:nt}=this._options,rt=await DnsNodeDiscovery.dnsOverHttp();this.nextPeer=rt.getNextPeer.bind(rt,tt,nt)}for await(const tt of this.nextPeer()){if(!this._started)return;const{peerInfo:nt,shardInfo:rt}=tt;if(!nt)continue;const ot={[DEFAULT_BOOTSTRAP_TAG_NAME]:{value:this._options.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE,ttl:this._options.tagTTL??DEFAULT_BOOTSTRAP_TAG_TTL}};let it=!1;await this._components.peerStore.has(nt.id)?(await this._components.peerStore.get(nt.id)).tags.has(DEFAULT_BOOTSTRAP_TAG_NAME)||(it=!0,await this._components.peerStore.merge(nt.id,{tags:ot})):(it=!0,await this._components.peerStore.save(nt.id,{tags:ot,...rt&&{metadata:{shardInfo:encodeRelayShard(rt)}}})),it&&this.dispatchEvent(new CustomEvent("peer",{detail:nt}))}}stop(){this._started=!1}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return DNS_DISCOVERY_TAG}}function wakuDnsDiscovery(o,et=DEFAULT_NODE_REQUIREMENTS){return tt=>new PeerDiscoveryDns(tt,{enrUrls:o,wantedNodeCapabilityCount:et})}var RateLimitProof$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.contentTopic!=null&&rt.contentTopic!==""&&(ot.uint32(10),ot.string(rt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={contentTopic:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.contentTopic=rt.string();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.ContentFilter||(o.ContentFilter={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(nt.uint32(8),nt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(nt.uint32(18),nt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)nt.uint32(26),o.ContentFilter.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=rt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===rt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(o.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.messages!=null)for(const ot of tt.messages)nt.uint32(10),WakuMessage$3.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.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=rt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),FilterRequest.codec().encode(tt.request,nt)),tt.push!=null&&(nt.uint32(26),MessagePush$1.codec().encode(tt.push,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(o){let et;(function(rt){rt.SUBSCRIBER_PING="SUBSCRIBER_PING",rt.SUBSCRIBE="SUBSCRIBE",rt.UNSUBSCRIBE="UNSUBSCRIBE",rt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let tt;(function(rt){rt[rt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",rt[rt.SUBSCRIBE=1]="SUBSCRIBE",rt[rt.UNSUBSCRIBE=2]="UNSUBSCRIBE",rt[rt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(rt){rt.codec=()=>enumeration(tt)}(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let nt;o.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),rt.requestId!=null&&rt.requestId!==""&&(ot.uint32(10),ot.string(rt.requestId)),rt.filterSubscribeType!=null&&tt[rt.filterSubscribeType]!==0&&(ot.uint32(16),o.FilterSubscribeType.codec().encode(rt.filterSubscribeType,ot)),rt.pubsubTopic!=null&&(ot.uint32(82),ot.string(rt.pubsubTopic)),rt.contentTopics!=null)for(const st of rt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:et.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.requestId=rt.string();break}case 2:{st.filterSubscribeType=o.FilterSubscribeType.codec().decode(rt);break}case 10:{st.pubsubTopic=rt.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(rt.string());break}default:{rt.skipType(lt&7);break}}}return st})),nt),o.encode=rt=>encodeMessage(rt,o.codec()),o.decode=(rt,ot)=>decodeMessage(rt,o.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={requestId:"",statusCode:0},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterSubscribeResponse||(FilterSubscribeResponse={}));var MessagePush;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.wakuMessage!=null&&(nt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,nt)),tt.pubsubTopic!=null&&(nt.uint32(18),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(nt.uint32(10),nt.string(tt.pubsubTopic)),tt.message!=null&&(nt.uint32(18),WakuMessage$1.codec().encode(tt.message,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={pubsubTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRequest||(PushRequest={}));var PushResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(nt.uint32(8),nt.bool(tt.isSuccess)),tt.info!=null&&(nt.uint32(18),nt.string(tt.info)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={isSuccess:!1},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushResponse||(PushResponse={}));var PushRpc;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),PushRequest.codec().encode(tt.request,nt)),tt.response!=null&&(nt.uint32(26),PushResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRpc||(PushRpc={}));var RateLimitProof$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.messageHash!=null&&(nt.uint32(10),nt.bytes(tt.messageHash)),tt.message!=null&&(nt.uint32(18),WakuMessage.codec().encode(tt.message,nt)),tt.pubsubTopic!=null&&(nt.uint32(26),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(nt.uint32(16),nt.bool(tt.includeData)),tt.pubsubTopic!=null&&(nt.uint32(82),nt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)nt.uint32(90),nt.string(ot);if(tt.timeStart!=null&&(nt.uint32(96),nt.sint64(tt.timeStart)),tt.timeEnd!=null&&(nt.uint32(104),nt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)nt.uint32(162),nt.bytes(ot);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(nt.uint32(416),nt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(nt.uint32(424),nt.uint64(tt.paginationLimit)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===rt.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=rt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryRequest||(StoreQueryRequest={}));var StoreQueryResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)nt.uint32(162),WakuMessageKeyValue.codec().encode(ot,nt);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",messages:[]},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.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=rt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryResponse||(StoreQueryResponse={}));var RateLimitProof;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;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=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.enr!=null&&(nt.uint32(10),nt.bytes(tt.enr)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.numPeers!=null&&(nt.uint32(8),nt.uint64(tt.numPeers)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)nt.uint32(10),PeerInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerInfos:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===rt.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=rt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.query!=null&&(nt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,nt)),tt.response!=null&&(nt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.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})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataResponse||(WakuMetadataResponse={}));class PeerExchangeRPC{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et){const{numPeers:tt}=et;return new PeerExchangeRPC({query:{numPeers:tt},response:void 0})}encode(){return PeerExchangeRPC$1.encode(this.proto)}static decode(et){const tt=PeerExchangeRPC$1.decode(et);return new PeerExchangeRPC(tt)}get query(){return this.proto.query}get response(){return this.proto.response}}const PeerExchangeCodec="/vac/waku/peer-exchange/2.0.0-alpha1",log$3=new Logger$1("peer-exchange");class WakuPeerExchange extends BaseProtocol{constructor(et,tt){super(PeerExchangeCodec,et,log$3,tt)}async query(et){const{numPeers:tt,peerId:nt}=et,rt=PeerExchangeRPC.createRequest({numPeers:BigInt(tt)}),ot=await this.components.peerStore.get(nt);if(!ot)return{peerInfos:null,error:ProtocolError.NO_PEER_AVAILABLE};let it;try{it=await this.getStream(ot)}catch(at){return log$3.error("Failed to get stream",at),{peerInfos:null,error:ProtocolError.NO_STREAM_AVAILABLE}}const st=await pipe([rt.encode()],encode$5,it,decode$5,async at=>await all$2(at));try{const at=new Uint8ArrayList;st.forEach(dt=>{at.append(dt)});const{response:ct}=PeerExchangeRPC.decode(at);return ct?{peerInfos:await Promise.all(ct.peerInfos.map(dt=>dt.enr).filter(isDefined).map(async dt=>({ENR:await EnrDecoder.fromRLP(dt)}))),error:null}:(log$3.error("PeerExchangeRPC message did not contains a `response` field"),{peerInfos:null,error:ProtocolError.EMPTY_PAYLOAD})}catch(at){return log$3.error("Failed to decode push reply",at),{peerInfos:null,error:ProtocolError.DECODE_FAILED}}}}const log$2=new Logger$1("peer-exchange-discovery"),DEFAULT_PEER_EXCHANGE_REQUEST_NODES=10,DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS=10*1e3,DEFAULT_MAX_RETRIES=3,DEFAULT_PEER_EXCHANGE_TAG_NAME=Tags.PEER_EXCHANGE,DEFAULT_PEER_EXCHANGE_TAG_VALUE=50,DEFAULT_PEER_EXCHANGE_TAG_TTL=1e8;class PeerExchangeDiscovery extends TypedEventEmitter$3{constructor(tt,nt,rt={}){super();Ct(this,"components");Ct(this,"peerExchange");Ct(this,"options");Ct(this,"isStarted");Ct(this,"queryingPeers",new Set);Ct(this,"queryAttempts",new Map);Ct(this,"handleDiscoveredPeer",tt=>{const{protocols:nt,peerId:rt}=tt.detail;!nt.includes(PeerExchangeCodec)||this.queryingPeers.has(rt.toString())||(this.queryingPeers.add(rt.toString()),this.startRecurringQueries(rt).catch(ot=>log$2.error(`Error querying peer ${ot}`)))});Ct(this,"startRecurringQueries",async tt=>{const nt=tt.toString(),{queryInterval:rt=DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS,maxRetries:ot=DEFAULT_MAX_RETRIES}=this.options;log$2.info(`Querying peer: ${nt} (attempt ${this.queryAttempts.get(nt)??1})`),await this.query(tt);const it=this.queryAttempts.get(nt)??1;if(it>ot){this.abortQueriesForPeer(nt);return}setTimeout(()=>{this.queryAttempts.set(nt,it+1),this.startRecurringQueries(tt).catch(st=>{log$2.error(`Error in startRecurringQueries: ${st}`)})},rt*it)});this.components=tt,this.peerExchange=new WakuPeerExchange(tt,nt),this.options=rt,this.isStarted=!1}start(){this.isStarted||(this.dispatchEvent(new CustomEvent("waku:peer-exchange:started",{detail:!0})),log$2.info("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:identify",this.handleDiscoveredPeer))}stop(){this.isStarted&&(log$2.info("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:identify",this.handleDiscoveredPeer))}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return"@waku/peer-exchange"}async query(tt){const{error:nt,peerInfos:rt}=await this.peerExchange.query({numPeers:DEFAULT_PEER_EXCHANGE_REQUEST_NODES,peerId:tt});if(nt)return log$2.error("Peer exchange query failed",nt),{error:nt,peerInfos:null};for(const ot of rt){const{ENR:it}=ot;if(!it){log$2.warn("No ENR in peerInfo object, skipping");continue}const{peerId:st,peerInfo:at,shardInfo:ct}=it;if(!st||!at)continue;if(await this.components.peerStore.has(st)){const{hasMultiaddrDiff:dt,hasShardDiff:ht}=await this.checkPeerInfoDiff(at,ct);if(dt||ht){log$2.info(`Peer ${st.toString()} has updated multiaddrs or shardInfo, updating`),dt&&(log$2.info(`Peer ${st.toString()} has updated multiaddrs, updating`),await this.components.peerStore.patch(st,{multiaddrs:at.multiaddrs})),ht&&ct&&(log$2.info(`Peer ${st.toString()} has updated shardInfo, updating`),await this.components.peerStore.merge(st,{metadata:{shardInfo:encodeRelayShard(ct)}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}})));continue}}await this.components.peerStore.save(st,{tags:{[DEFAULT_PEER_EXCHANGE_TAG_NAME]:{value:this.options.tagValue??DEFAULT_PEER_EXCHANGE_TAG_VALUE,ttl:this.options.tagTTL??DEFAULT_PEER_EXCHANGE_TAG_TTL}},...ct&&{metadata:{shardInfo:encodeRelayShard(ct)}},...at.multiaddrs&&{multiaddrs:at.multiaddrs}}),log$2.info(`Discovered peer: ${st.toString()}`),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}}))}return{error:null,peerInfos:rt}}abortQueriesForPeer(tt){log$2.info(`Aborting queries for peer: ${tt}`),this.queryingPeers.delete(tt),this.queryAttempts.delete(tt)}async checkPeerInfoDiff(tt,nt){const{id:rt}=tt,ot=await this.components.peerStore.get(rt),it=ot.addresses.map(dt=>dt.multiaddr.toString()),st=tt.multiaddrs.map(dt=>dt.toString()),at=it.some(dt=>!st.includes(dt));let ct=!1;const lt=ot.metadata.get("shardInfo");if(lt){const dt=decodeRelayShard(lt);(dt||nt)&&(ct=dt.clusterId!==(nt==null?void 0:nt.clusterId)||dt.shards.some(ht=>!(nt!=null&&nt.shards.includes(ht))))}return{hasMultiaddrDiff:at,hasShardDiff:ct}}}function wakuPeerExchangeDiscovery(o){return et=>new PeerExchangeDiscovery(et,o)}const log$1=new Logger$1("peer-exchange-discovery"),DEFAULT_LOCAL_TAG_NAME=Tags.LOCAL,DEFAULT_LOCAL_TAG_VALUE=50,DEFAULT_LOCAL_TAG_TTL=1e8;class LocalPeerCacheDiscovery extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"components");Ct(this,"options");Ct(this,"isStarted");Ct(this,"peers",[]);Ct(this,"handleNewPeers",tt=>{const{peerId:nt,listenAddrs:rt}=tt.detail,ot=getWsMultiaddrFromMultiaddrs(rt),it=this.getPeersFromLocalStorage(),st=it.findIndex(at=>at.id===nt.toString());st>=0?it[st].address=ot.toString():it.push({id:nt.toString(),address:ot.toString()}),this.peers=it,this.savePeersToLocalStorage()});this.components=tt,this.options=nt,this.isStarted=!1,this.peers=this.getPeersFromLocalStorage()}get[Symbol.toStringTag](){return"@waku/local-peer-cache-discovery"}async start(){var tt,nt,rt;if(!this.isStarted){log$1.info("Starting Local Storage Discovery"),this.components.events.addEventListener("peer:identify",this.handleNewPeers);for(const{id:ot,address:it}of this.peers){const st=peerIdFromString$1(ot);await this.components.peerStore.has(st)||(await this.components.peerStore.save(st,{multiaddrs:[multiaddr(it)],tags:{[((tt=this.options)==null?void 0:tt.tagName)??DEFAULT_LOCAL_TAG_NAME]:{value:((nt=this.options)==null?void 0:nt.tagValue)??DEFAULT_LOCAL_TAG_VALUE,ttl:((rt=this.options)==null?void 0:rt.tagTTL)??DEFAULT_LOCAL_TAG_TTL}}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:[multiaddr(it)]}})))}log$1.info(`Discovered ${this.peers.length} peers`),this.isStarted=!0}}stop(){this.isStarted&&(log$1.info("Stopping Local Storage Discovery"),this.components.events.removeEventListener("peer:identify",this.handleNewPeers),this.isStarted=!1,this.savePeersToLocalStorage())}getPeersFromLocalStorage(){try{const tt=localStorage.getItem("waku:peers");return tt?JSON.parse(tt).filter(isValidStoredPeer):[]}catch(tt){return log$1.error("Error parsing peers from local storage:",tt),[]}}savePeersToLocalStorage(){try{localStorage.setItem("waku:peers",JSON.stringify(this.peers))}catch(tt){log$1.error("Error saving peers to local storage:",tt)}}}function isValidStoredPeer(o){return o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.address=="string"}function wakuLocalPeerCacheDiscovery(){return(o,et)=>new LocalPeerCacheDiscovery(o,et)}function defaultPeerDiscoveries(o){const et=[enrTree.SANDBOX,enrTree.TEST];return[wakuDnsDiscovery(et),wakuLocalPeerCacheDiscovery(),wakuPeerExchangeDiscovery(o)]}const log=new Logger$1("sdk:create");async function defaultLibp2p(o,et,tt){et!=null&&et.hideWebSocketInfo||(console.info("%cIgnore WebSocket connection failures","background: gray; color: white; font-size: x-large"),console.info("%cWaku tries to discover peers and some of them are expected to fail","background: gray; color: white; font-size: x-large"));const nt=o?{metadata:wakuMetadata(o)}:{},rt=(et==null?void 0:et.filterMultiaddrs)===!1?all$1:wss;return createLibp2p({transports:[webSockets({filter:rt})],streamMuxers:[mplex()],connectionEncrypters:[noise()],...et,services:{identify:identify({agentVersion:tt??DefaultUserAgent}),ping:ping({maxInboundStreams:(et==null?void 0:et.pingMaxInboundStreams)??DefaultPingMaxInboundStreams}),...nt,...et==null?void 0:et.services}})}async function createLibp2pAndUpdateOptions(o){const{networkConfig:et}=o,tt=derivePubsubTopicsFromNetworkConfig(et??DefaultNetworkConfig);log.info("Creating Waku node with pubsub topics",tt);const nt=(o==null?void 0:o.libp2p)??{},rt=nt.peerDiscovery??[];return o!=null&&o.defaultBootstrap&&rt.push(...defaultPeerDiscoveries(tt)),o!=null&&o.bootstrapPeers&&rt.push(bootstrap({list:o.bootstrapPeers})),nt.peerDiscovery=rt,{libp2p:await defaultLibp2p(tt,nt,o==null?void 0:o.userAgent),pubsubTopics:tt}}async function createLightNode(o={}){const{libp2p:et,pubsubTopics:tt}=await createLibp2pAndUpdateOptions(o);return new WakuNode(tt,o,et,{store:!0,lightpush:!0,filter:!0})}React.createContext({decoder:void 0,encoder:void 0});const useCreateNode=o=>{const{factory:et,options:tt,protocols:nt=[]}=o,[rt,ot]=React.useState(void 0),[it,st]=React.useState(!0),[at,ct]=React.useState(void 0);return React.useEffect(()=>{let lt=!1;return st(!0),et(tt).then(async dt=>{lt||(await dt.start(),await waitForRemotePeer(dt,nt),ot(dt),st(!1))}).catch(dt=>{st(!1),ct(`Failed at creating node: ${(dt==null?void 0:dt.message)||"no message"}`)}),()=>{lt=!0}},[]),{node:rt,error:at,isLoading:it}},useCreateLightNode=o=>useCreateNode({...o,factory:createLightNode}),WakuContext=React.createContext({node:void 0,isLoading:!1,error:void 0}),useWaku=()=>React.useContext(WakuContext),LightNodeProvider=o=>{const et=useCreateLightNode({options:o.options,protocols:o.protocols});return React.createElement(WakuContext.Provider,{value:et},o.children)};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. @@ -4092,7 +4092,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:o})=>{const{address:et,isConnected:tt}=useAccount(),{disconnect:nt}=useDisconnect(),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:et});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:"flex items-center gap-2",children:!rt&&!ot&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Filter:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Store:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.store)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Peers:"}),rt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("div",{className:"w-2 h-2 md:w-3 md:h-3 rounded-full bg-red-500"}):jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${st>0?"bg-green-500":"bg-yellow-500"}`})]})]})}),jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children: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||(et?`${et.slice(0,4)}...${et.slice(-4)}`:"")}),jsxRuntimeExports.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>nt(),children:[jsxRuntimeExports.jsx("span",{className:"md:hidden",children:"×"}),jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:"Logout"})]})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})})]})]})})})})},Input=reactExports.forwardRef(({className:o,type:et,...tt},nt)=>jsxRuntimeExports.jsx("input",{type:et,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]",o),ref:nt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:o,...et},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",o),ref:tt,...et}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((o,et)=>{const tt=reactExports.forwardRef((nt,rt)=>{const{asChild:ot,...it}=nt,st=ot?Slot:et;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:rt})});return tt.displayName=`Primitive.${et}`,{...o,[et]:tt}},{});function dispatchDiscreteCustomEvent(o,et){o&&reactDomExports.flushSync(()=>o.dispatchEvent(et))}var NAME="Label",Label$1=reactExports.forwardRef((o,et)=>jsxRuntimeExports.jsx(Primitive.label,{...o,ref:et,onMouseDown:tt=>{var rt;tt.target.closest("button, input, select, textarea")||((rt=o.onMouseDown)==null||rt.call(o,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:o,...et},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),o),...et}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:o,...et},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",o),...et}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",o),...et}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",o),...et}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",o),...et}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",o),...et}));CardFooter.displayName="CardFooter";function composeEventHandlers(o,et,{checkForDefaultPrevented:tt=!0}={}){return function(rt){if(o==null||o(rt),tt===!1||!rt.defaultPrevented)return et==null?void 0:et(rt)}}function createContext2(o,et){const tt=reactExports.createContext(et),nt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};nt.displayName=o+"Provider";function rt(ot){const it=reactExports.useContext(tt);if(it)return it;if(et!==void 0)return et;throw new Error(`\`${ot}\` must be used within \`${o}\``)}return[nt,rt]}function createContextScope(o,et=[]){let tt=[];function nt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:pt,...mt}=dt,ft=((gt=ht==null?void 0:ht[o])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>mt,Object.values(mt));return jsxRuntimeExports.jsx(ft.Provider,{value:yt,children:pt})};ct.displayName=ot+"Provider";function lt(dt,ht){var ft;const pt=((ft=ht==null?void 0:ht[o])==null?void 0:ft[at])||st,mt=reactExports.useContext(pt);if(mt)return mt;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const rt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[o])||ot;return reactExports.useMemo(()=>({[`__scope${o}`]:{...st,[o]:at}}),[st,at])}};return rt.scopeName=o,[nt,composeContextScopes(rt,...et)]}function composeContextScopes(...o){const et=o[0];if(o.length===1)return et;const tt=()=>{const nt=o.map(rt=>({useScope:rt(),scopeName:rt.scopeName}));return function(ot){const it=nt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${et.scopeName}`]:it}),[it])}};return tt.scopeName=et.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(o){const[et,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{o||tt(nt=>nt??String(count$1++))},[o]),o||(et?`radix-${et}`:"")}function useCallbackRef$1(o){const et=reactExports.useRef(o);return reactExports.useEffect(()=>{et.current=o}),reactExports.useMemo(()=>(...tt)=>{var nt;return(nt=et.current)==null?void 0:nt.call(et,...tt)},[])}function useControllableState({prop:o,defaultProp:et,onChange:tt=()=>{}}){const[nt,rt]=useUncontrolledState({defaultProp:et,onChange:tt}),ot=o!==void 0,it=ot?o:nt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(o):ct;dt!==o&&st(dt)}else rt(ct)},[ot,o,rt,st]);return[it,at]}function useUncontrolledState({defaultProp:o,onChange:et}){const tt=reactExports.useState(o),[nt]=tt,rt=reactExports.useRef(nt),ot=useCallbackRef$1(et);return reactExports.useEffect(()=>{rt.current!==nt&&(ot(nt),rt.current=nt)},[nt,rt,ot]),tt}function useEscapeKeydown(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o);reactExports.useEffect(()=>{const nt=rt=>{rt.key==="Escape"&&tt(rt)};return et.addEventListener("keydown",nt,{capture:!0}),()=>et.removeEventListener("keydown",nt,{capture:!0})},[tt,et])}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((o,et)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:nt,onPointerDownOutside:rt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=o,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,pt]=reactExports.useState({}),mt=useComposedRefs(et,kt=>dt(kt)),ft=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=ft.indexOf(yt),xt=lt?ft.indexOf(lt):-1,vt=ct.layersWithOutsidePointerEventsDisabled.size>0,bt=xt>=gt,Et=usePointerDownOutside(kt=>{const It=kt.target,Rt=[...ct.branches].some(Pt=>Pt.contains(It));!bt||Rt||(rt==null||rt(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht),wt=useFocusOutside(kt=>{const It=kt.target;[...ct.branches].some(Pt=>Pt.contains(It))||(ot==null||ot(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(kt=>{xt===ct.layers.size-1&&(nt==null||nt(kt),!kt.defaultPrevented&&st&&(kt.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 kt=()=>pt({});return document.addEventListener(CONTEXT_UPDATE,kt),()=>document.removeEventListener(CONTEXT_UPDATE,kt)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:mt,style:{pointerEvents:vt?bt?"auto":"none":void 0,...o.style},onFocusCapture:composeEventHandlers(o.onFocusCapture,wt.onFocusCapture),onBlurCapture:composeEventHandlers(o.onBlurCapture,wt.onBlurCapture),onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((o,et)=>{const tt=reactExports.useContext(DismissableLayerContext),nt=reactExports.useRef(null),rt=useComposedRefs(et,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...o,ref:rt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1),rt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!nt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(et.removeEventListener("click",rt.current),rt.current=at,et.addEventListener("click",rt.current,{once:!0})):at()}else et.removeEventListener("click",rt.current);nt.current=!1},it=window.setTimeout(()=>{et.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),et.removeEventListener("pointerdown",ot),et.removeEventListener("click",rt.current)}},[et,tt]),{onPointerDownCapture:()=>nt.current=!0}}function useFocusOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const rt=ot=>{ot.target&&!nt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return et.addEventListener("focusin",rt),()=>et.removeEventListener("focusin",rt)},[et,tt]),{onFocusCapture:()=>nt.current=!0,onBlurCapture:()=>nt.current=!1}}function dispatchUpdate(){const o=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(o)}function handleAndDispatchCustomEvent(o,et,tt,{discrete:nt}){const rt=tt.originalEvent.target,ot=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:tt});et&&rt.addEventListener(o,et,{once:!0}),nt?dispatchDiscreteCustomEvent(rt,ot):rt.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((o,et)=>{const{loop:tt=!1,trapped:nt=!1,onMountAutoFocus:rt,onUnmountAutoFocus:ot,...it}=o,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(rt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(et,ft=>at(ft)),pt=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(nt){let ft=function(vt){if(pt.paused||!st)return;const bt=vt.target;st.contains(bt)?dt.current=bt:focus(dt.current,{select:!0})},yt=function(vt){if(pt.paused||!st)return;const bt=vt.relatedTarget;bt!==null&&(st.contains(bt)||focus(dt.current,{select:!0}))},gt=function(vt){if(document.activeElement===document.body)for(const Et of vt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",ft),document.addEventListener("focusout",yt);const xt=new MutationObserver(gt);return st&&xt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",ft),document.removeEventListener("focusout",yt),xt.disconnect()}}},[nt,st,pt.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(pt);const ft=document.activeElement;if(!st.contains(ft)){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===ft&&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(ft??document.body,{select:!0}),st.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lt),focusScopesStack.remove(pt)},0)}}},[st,ct,lt,pt]);const mt=reactExports.useCallback(ft=>{if(!tt&&!nt||pt.paused)return;const yt=ft.key==="Tab"&&!ft.altKey&&!ft.ctrlKey&&!ft.metaKey,gt=document.activeElement;if(yt&>){const xt=ft.currentTarget,[vt,bt]=getTabbableEdges(xt);vt&&bt?!ft.shiftKey&>===bt?(ft.preventDefault(),tt&&focus(vt,{select:!0})):ft.shiftKey&>===vt&&(ft.preventDefault(),tt&&focus(bt,{select:!0})):gt===xt&&ft.preventDefault()}},[tt,nt,pt.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:mt})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(o,{select:et=!1}={}){const tt=document.activeElement;for(const nt of o)if(focus(nt,{select:et}),document.activeElement!==tt)return}function getTabbableEdges(o){const et=getTabbableCandidates(o),tt=findVisible(et,o),nt=findVisible(et.reverse(),o);return[tt,nt]}function getTabbableCandidates(o){const et=[],tt=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:nt=>{const rt=nt.tagName==="INPUT"&&nt.type==="hidden";return nt.disabled||nt.hidden||rt?NodeFilter.FILTER_SKIP:nt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)et.push(tt.currentNode);return et}function findVisible(o,et){for(const tt of o)if(!isHidden(tt,{upTo:et}))return tt}function isHidden(o,{upTo:et}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(et!==void 0&&o===et)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function isSelectableInput(o){return o instanceof HTMLInputElement&&"select"in o}function focus(o,{select:et=!1}={}){if(o&&o.focus){const tt=document.activeElement;o.focus({preventScroll:!0}),o!==tt&&isSelectableInput(o)&&et&&o.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let o=[];return{add(et){const tt=o[0];et!==tt&&(tt==null||tt.pause()),o=arrayRemove(o,et),o.unshift(et)},remove(et){var tt;o=arrayRemove(o,et),(tt=o[0])==null||tt.resume()}}}function arrayRemove(o,et){const tt=[...o],nt=tt.indexOf(et);return nt!==-1&&tt.splice(nt,1),tt}function removeLinks(o){return o.filter(et=>et.tagName!=="A")}var PORTAL_NAME$1="Portal",Portal$1=reactExports.forwardRef((o,et)=>{var st;const{container:tt,...nt}=o,[rt,ot]=reactExports.useState(!1);useLayoutEffect2(()=>ot(!0),[]);const it=tt||rt&&((st=globalThis==null?void 0:globalThis.document)==null?void 0:st.body);return it?ReactDOM.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et}),it):null});Portal$1.displayName=PORTAL_NAME$1;function useStateMachine$1(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var Presence=o=>{const{present:et,children:tt}=o,nt=usePresence(et),rt=typeof tt=="function"?tt({present:nt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(nt.ref,getElementRef(rt));return typeof tt=="function"||nt.isPresent?reactExports.cloneElement(rt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(o){const[et,tt]=reactExports.useState(),nt=reactExports.useRef({}),rt=reactExports.useRef(o),ot=reactExports.useRef("none"),it=o?"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(nt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=nt.current,lt=rt.current;if(lt!==o){const ht=ot.current,pt=getAnimationName(ct);o?at("MOUNT"):pt==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==pt?"ANIMATION_OUT":"UNMOUNT"),rt.current=o}},[o,at]),useLayoutEffect2(()=>{if(et){let ct;const lt=et.ownerDocument.defaultView??window,dt=pt=>{const ft=getAnimationName(nt.current).includes(pt.animationName);if(pt.target===et&&ft&&(at("ANIMATION_END"),!rt.current)){const yt=et.style.animationFillMode;et.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{et.style.animationFillMode==="forwards"&&(et.style.animationFillMode=yt)})}},ht=pt=>{pt.target===et&&(ot.current=getAnimationName(nt.current))};return et.addEventListener("animationstart",ht),et.addEventListener("animationcancel",dt),et.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),et.removeEventListener("animationstart",ht),et.removeEventListener("animationcancel",dt),et.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[et,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(nt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(o){return(o==null?void 0:o.animationName)||"none"}function getElementRef(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const o=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",o[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",o[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(et=>et.remove()),count--}},[])}function createFocusGuard(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(o,et){return typeof o=="function"?o(et):o&&(o.current=et),o}function useCallbackRef(o,et){var tt=reactExports.useState(function(){return{value:o,callback:et,facade:{get current(){return tt.value},set current(nt){var rt=tt.value;rt!==nt&&(tt.value=nt,tt.callback(nt,rt))}}}})[0];return tt.callback=et,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(o,et){var tt=useCallbackRef(null,function(nt){return o.forEach(function(rt){return assignRef(rt,nt)})});return useIsomorphicLayoutEffect(function(){var nt=currentValues.get(tt);if(nt){var rt=new Set(nt),ot=new Set(o),it=tt.current;rt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){rt.has(st)||assignRef(st,it)})}currentValues.set(tt,o)},[o]),tt}function ItoI(o){return o}function innerCreateMedium(o,et){et===void 0&&(et=ItoI);var tt=[],nt=!1,rt={read:function(){if(nt)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]:o},useMedium:function(ot){var it=et(ot,nt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(nt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){nt=!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 rt}function createSidecarMedium(o){o===void 0&&(o={});var et=innerCreateMedium(null);return et.options=__assign({async:!0,ssr:!1},o),et}var SideCar$1=function(o){var et=o.sideCar,tt=__rest(o,["sideCar"]);if(!et)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var nt=et.read();if(!nt)throw new Error("Sidecar medium not found");return reactExports.createElement(nt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(o,et){return o.useMedium(et),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(o,et){var tt=reactExports.useRef(null),nt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),rt=nt[0],ot=nt[1],it=o.forwardProps,st=o.children,at=o.className,ct=o.removeScrollBar,lt=o.enabled,dt=o.shards,ht=o.sideCar,pt=o.noIsolation,mt=o.inert,ft=o.allowPinchZoom,yt=o.as,gt=yt===void 0?"div":yt,xt=o.gapMode,vt=__rest(o,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),bt=ht,Et=useMergeRefs([tt,et]),wt=__assign(__assign({},vt),rt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(bt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:pt,inert:mt,setCallbacks:ot,allowPinchZoom:!!ft,lockRef:tt,gapMode:xt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},wt),{ref:Et})):reactExports.createElement(gt,__assign({},wt,{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 o=document.createElement("style");o.type="text/css";var et=getNonce();return et&&o.setAttribute("nonce",et),o}function injectStyles(o,et){o.styleSheet?o.styleSheet.cssText=et:o.appendChild(document.createTextNode(et))}function insertStyleTag(o){var et=document.head||document.getElementsByTagName("head")[0];et.appendChild(o)}var stylesheetSingleton=function(){var o=0,et=null;return{add:function(tt){o==0&&(et=makeStyleTag())&&(injectStyles(et,tt),insertStyleTag(et)),o++},remove:function(){o--,!o&&et&&(et.parentNode&&et.parentNode.removeChild(et),et=null)}}},styleHookSingleton=function(){var o=stylesheetSingleton();return function(et,tt){reactExports.useEffect(function(){return o.add(et),function(){o.remove()}},[et&&tt])}},styleSingleton=function(){var o=styleHookSingleton(),et=function(tt){var nt=tt.styles,rt=tt.dynamic;return o(nt,rt),null};return et},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(o){return parseInt(o||"",10)||0},getOffset=function(o){var et=window.getComputedStyle(document.body),tt=et[o==="padding"?"paddingLeft":"marginLeft"],nt=et[o==="padding"?"paddingTop":"marginTop"],rt=et[o==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(nt),parse$2(rt)]},getGapWidth=function(o){if(o===void 0&&(o="margin"),typeof window>"u")return zeroGap;var et=getOffset(o),tt=document.documentElement.clientWidth,nt=window.innerWidth;return{left:et[0],top:et[1],right:et[2],gap:Math.max(0,nt-tt+et[2]-et[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(o,et,tt,nt){var rt=o.left,ot=o.top,it=o.right,st=o.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:o})=>{const{address:et,isConnected:tt}=useAccount(),{disconnect:nt}=useDisconnect(),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:et});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:"flex items-center gap-2",children:!rt&&!ot&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Connection:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"History:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.store)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1 hidden",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Peers:"}),rt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("div",{className:"w-2 h-2 md:w-3 md:h-3 rounded-full bg-red-500"}):jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${st>0?"bg-green-500":"bg-yellow-500"}`})]})]})}),jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children: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||(et?`${et.slice(0,4)}...${et.slice(-4)}`:"")}),jsxRuntimeExports.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>nt(),children:[jsxRuntimeExports.jsx("span",{className:"md:hidden",children:"×"}),jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:"Logout"})]})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})})]})]})})})})},Input=reactExports.forwardRef(({className:o,type:et,...tt},nt)=>jsxRuntimeExports.jsx("input",{type:et,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]",o),ref:nt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:o,...et},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",o),ref:tt,...et}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((o,et)=>{const tt=reactExports.forwardRef((nt,rt)=>{const{asChild:ot,...it}=nt,st=ot?Slot:et;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:rt})});return tt.displayName=`Primitive.${et}`,{...o,[et]:tt}},{});function dispatchDiscreteCustomEvent(o,et){o&&reactDomExports.flushSync(()=>o.dispatchEvent(et))}var NAME="Label",Label$1=reactExports.forwardRef((o,et)=>jsxRuntimeExports.jsx(Primitive.label,{...o,ref:et,onMouseDown:tt=>{var rt;tt.target.closest("button, input, select, textarea")||((rt=o.onMouseDown)==null||rt.call(o,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:o,...et},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),o),...et}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:o,...et},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",o),...et}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",o),...et}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",o),...et}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",o),...et}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",o),...et}));CardFooter.displayName="CardFooter";function composeEventHandlers(o,et,{checkForDefaultPrevented:tt=!0}={}){return function(rt){if(o==null||o(rt),tt===!1||!rt.defaultPrevented)return et==null?void 0:et(rt)}}function createContext2(o,et){const tt=reactExports.createContext(et),nt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};nt.displayName=o+"Provider";function rt(ot){const it=reactExports.useContext(tt);if(it)return it;if(et!==void 0)return et;throw new Error(`\`${ot}\` must be used within \`${o}\``)}return[nt,rt]}function createContextScope(o,et=[]){let tt=[];function nt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:ft,...mt}=dt,pt=((gt=ht==null?void 0:ht[o])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>mt,Object.values(mt));return jsxRuntimeExports.jsx(pt.Provider,{value:yt,children:ft})};ct.displayName=ot+"Provider";function lt(dt,ht){var pt;const ft=((pt=ht==null?void 0:ht[o])==null?void 0:pt[at])||st,mt=reactExports.useContext(ft);if(mt)return mt;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const rt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[o])||ot;return reactExports.useMemo(()=>({[`__scope${o}`]:{...st,[o]:at}}),[st,at])}};return rt.scopeName=o,[nt,composeContextScopes(rt,...et)]}function composeContextScopes(...o){const et=o[0];if(o.length===1)return et;const tt=()=>{const nt=o.map(rt=>({useScope:rt(),scopeName:rt.scopeName}));return function(ot){const it=nt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${et.scopeName}`]:it}),[it])}};return tt.scopeName=et.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(o){const[et,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{o||tt(nt=>nt??String(count$1++))},[o]),o||(et?`radix-${et}`:"")}function useCallbackRef$1(o){const et=reactExports.useRef(o);return reactExports.useEffect(()=>{et.current=o}),reactExports.useMemo(()=>(...tt)=>{var nt;return(nt=et.current)==null?void 0:nt.call(et,...tt)},[])}function useControllableState({prop:o,defaultProp:et,onChange:tt=()=>{}}){const[nt,rt]=useUncontrolledState({defaultProp:et,onChange:tt}),ot=o!==void 0,it=ot?o:nt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(o):ct;dt!==o&&st(dt)}else rt(ct)},[ot,o,rt,st]);return[it,at]}function useUncontrolledState({defaultProp:o,onChange:et}){const tt=reactExports.useState(o),[nt]=tt,rt=reactExports.useRef(nt),ot=useCallbackRef$1(et);return reactExports.useEffect(()=>{rt.current!==nt&&(ot(nt),rt.current=nt)},[nt,rt,ot]),tt}function useEscapeKeydown(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o);reactExports.useEffect(()=>{const nt=rt=>{rt.key==="Escape"&&tt(rt)};return et.addEventListener("keydown",nt,{capture:!0}),()=>et.removeEventListener("keydown",nt,{capture:!0})},[tt,et])}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((o,et)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:nt,onPointerDownOutside:rt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=o,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,ft]=reactExports.useState({}),mt=useComposedRefs(et,kt=>dt(kt)),pt=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=pt.indexOf(yt),xt=lt?pt.indexOf(lt):-1,vt=ct.layersWithOutsidePointerEventsDisabled.size>0,bt=xt>=gt,Et=usePointerDownOutside(kt=>{const It=kt.target,Rt=[...ct.branches].some($t=>$t.contains(It));!bt||Rt||(rt==null||rt(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht),wt=useFocusOutside(kt=>{const It=kt.target;[...ct.branches].some($t=>$t.contains(It))||(ot==null||ot(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(kt=>{xt===ct.layers.size-1&&(nt==null||nt(kt),!kt.defaultPrevented&&st&&(kt.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 kt=()=>ft({});return document.addEventListener(CONTEXT_UPDATE,kt),()=>document.removeEventListener(CONTEXT_UPDATE,kt)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:mt,style:{pointerEvents:vt?bt?"auto":"none":void 0,...o.style},onFocusCapture:composeEventHandlers(o.onFocusCapture,wt.onFocusCapture),onBlurCapture:composeEventHandlers(o.onBlurCapture,wt.onBlurCapture),onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((o,et)=>{const tt=reactExports.useContext(DismissableLayerContext),nt=reactExports.useRef(null),rt=useComposedRefs(et,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...o,ref:rt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1),rt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!nt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(et.removeEventListener("click",rt.current),rt.current=at,et.addEventListener("click",rt.current,{once:!0})):at()}else et.removeEventListener("click",rt.current);nt.current=!1},it=window.setTimeout(()=>{et.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),et.removeEventListener("pointerdown",ot),et.removeEventListener("click",rt.current)}},[et,tt]),{onPointerDownCapture:()=>nt.current=!0}}function useFocusOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const rt=ot=>{ot.target&&!nt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return et.addEventListener("focusin",rt),()=>et.removeEventListener("focusin",rt)},[et,tt]),{onFocusCapture:()=>nt.current=!0,onBlurCapture:()=>nt.current=!1}}function dispatchUpdate(){const o=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(o)}function handleAndDispatchCustomEvent(o,et,tt,{discrete:nt}){const rt=tt.originalEvent.target,ot=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:tt});et&&rt.addEventListener(o,et,{once:!0}),nt?dispatchDiscreteCustomEvent(rt,ot):rt.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((o,et)=>{const{loop:tt=!1,trapped:nt=!1,onMountAutoFocus:rt,onUnmountAutoFocus:ot,...it}=o,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(rt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(et,pt=>at(pt)),ft=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(nt){let pt=function(vt){if(ft.paused||!st)return;const bt=vt.target;st.contains(bt)?dt.current=bt:focus(dt.current,{select:!0})},yt=function(vt){if(ft.paused||!st)return;const bt=vt.relatedTarget;bt!==null&&(st.contains(bt)||focus(dt.current,{select:!0}))},gt=function(vt){if(document.activeElement===document.body)for(const Et of vt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",pt),document.addEventListener("focusout",yt);const xt=new MutationObserver(gt);return st&&xt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",pt),document.removeEventListener("focusout",yt),xt.disconnect()}}},[nt,st,ft.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(ft);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(ft)},0)}}},[st,ct,lt,ft]);const mt=reactExports.useCallback(pt=>{if(!tt&&!nt||ft.paused)return;const yt=pt.key==="Tab"&&!pt.altKey&&!pt.ctrlKey&&!pt.metaKey,gt=document.activeElement;if(yt&>){const xt=pt.currentTarget,[vt,bt]=getTabbableEdges(xt);vt&&bt?!pt.shiftKey&>===bt?(pt.preventDefault(),tt&&focus(vt,{select:!0})):pt.shiftKey&>===vt&&(pt.preventDefault(),tt&&focus(bt,{select:!0})):gt===xt&&pt.preventDefault()}},[tt,nt,ft.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:mt})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(o,{select:et=!1}={}){const tt=document.activeElement;for(const nt of o)if(focus(nt,{select:et}),document.activeElement!==tt)return}function getTabbableEdges(o){const et=getTabbableCandidates(o),tt=findVisible(et,o),nt=findVisible(et.reverse(),o);return[tt,nt]}function getTabbableCandidates(o){const et=[],tt=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:nt=>{const rt=nt.tagName==="INPUT"&&nt.type==="hidden";return nt.disabled||nt.hidden||rt?NodeFilter.FILTER_SKIP:nt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)et.push(tt.currentNode);return et}function findVisible(o,et){for(const tt of o)if(!isHidden(tt,{upTo:et}))return tt}function isHidden(o,{upTo:et}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(et!==void 0&&o===et)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function isSelectableInput(o){return o instanceof HTMLInputElement&&"select"in o}function focus(o,{select:et=!1}={}){if(o&&o.focus){const tt=document.activeElement;o.focus({preventScroll:!0}),o!==tt&&isSelectableInput(o)&&et&&o.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let o=[];return{add(et){const tt=o[0];et!==tt&&(tt==null||tt.pause()),o=arrayRemove(o,et),o.unshift(et)},remove(et){var tt;o=arrayRemove(o,et),(tt=o[0])==null||tt.resume()}}}function arrayRemove(o,et){const tt=[...o],nt=tt.indexOf(et);return nt!==-1&&tt.splice(nt,1),tt}function removeLinks(o){return o.filter(et=>et.tagName!=="A")}var PORTAL_NAME$1="Portal",Portal$1=reactExports.forwardRef((o,et)=>{var st;const{container:tt,...nt}=o,[rt,ot]=reactExports.useState(!1);useLayoutEffect2(()=>ot(!0),[]);const it=tt||rt&&((st=globalThis==null?void 0:globalThis.document)==null?void 0:st.body);return it?ReactDOM.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et}),it):null});Portal$1.displayName=PORTAL_NAME$1;function useStateMachine$1(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var Presence=o=>{const{present:et,children:tt}=o,nt=usePresence(et),rt=typeof tt=="function"?tt({present:nt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(nt.ref,getElementRef(rt));return typeof tt=="function"||nt.isPresent?reactExports.cloneElement(rt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(o){const[et,tt]=reactExports.useState(),nt=reactExports.useRef({}),rt=reactExports.useRef(o),ot=reactExports.useRef("none"),it=o?"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(nt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=nt.current,lt=rt.current;if(lt!==o){const ht=ot.current,ft=getAnimationName(ct);o?at("MOUNT"):ft==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==ft?"ANIMATION_OUT":"UNMOUNT"),rt.current=o}},[o,at]),useLayoutEffect2(()=>{if(et){let ct;const lt=et.ownerDocument.defaultView??window,dt=ft=>{const pt=getAnimationName(nt.current).includes(ft.animationName);if(ft.target===et&&pt&&(at("ANIMATION_END"),!rt.current)){const yt=et.style.animationFillMode;et.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{et.style.animationFillMode==="forwards"&&(et.style.animationFillMode=yt)})}},ht=ft=>{ft.target===et&&(ot.current=getAnimationName(nt.current))};return et.addEventListener("animationstart",ht),et.addEventListener("animationcancel",dt),et.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),et.removeEventListener("animationstart",ht),et.removeEventListener("animationcancel",dt),et.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[et,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(nt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(o){return(o==null?void 0:o.animationName)||"none"}function getElementRef(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const o=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",o[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",o[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(et=>et.remove()),count--}},[])}function createFocusGuard(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(o,et){return typeof o=="function"?o(et):o&&(o.current=et),o}function useCallbackRef(o,et){var tt=reactExports.useState(function(){return{value:o,callback:et,facade:{get current(){return tt.value},set current(nt){var rt=tt.value;rt!==nt&&(tt.value=nt,tt.callback(nt,rt))}}}})[0];return tt.callback=et,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(o,et){var tt=useCallbackRef(null,function(nt){return o.forEach(function(rt){return assignRef(rt,nt)})});return useIsomorphicLayoutEffect(function(){var nt=currentValues.get(tt);if(nt){var rt=new Set(nt),ot=new Set(o),it=tt.current;rt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){rt.has(st)||assignRef(st,it)})}currentValues.set(tt,o)},[o]),tt}function ItoI(o){return o}function innerCreateMedium(o,et){et===void 0&&(et=ItoI);var tt=[],nt=!1,rt={read:function(){if(nt)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]:o},useMedium:function(ot){var it=et(ot,nt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(nt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){nt=!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 rt}function createSidecarMedium(o){o===void 0&&(o={});var et=innerCreateMedium(null);return et.options=__assign({async:!0,ssr:!1},o),et}var SideCar$1=function(o){var et=o.sideCar,tt=__rest(o,["sideCar"]);if(!et)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var nt=et.read();if(!nt)throw new Error("Sidecar medium not found");return reactExports.createElement(nt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(o,et){return o.useMedium(et),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(o,et){var tt=reactExports.useRef(null),nt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),rt=nt[0],ot=nt[1],it=o.forwardProps,st=o.children,at=o.className,ct=o.removeScrollBar,lt=o.enabled,dt=o.shards,ht=o.sideCar,ft=o.noIsolation,mt=o.inert,pt=o.allowPinchZoom,yt=o.as,gt=yt===void 0?"div":yt,xt=o.gapMode,vt=__rest(o,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),bt=ht,Et=useMergeRefs([tt,et]),wt=__assign(__assign({},vt),rt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(bt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:ft,inert:mt,setCallbacks:ot,allowPinchZoom:!!pt,lockRef:tt,gapMode:xt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},wt),{ref:Et})):reactExports.createElement(gt,__assign({},wt,{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 o=document.createElement("style");o.type="text/css";var et=getNonce();return et&&o.setAttribute("nonce",et),o}function injectStyles(o,et){o.styleSheet?o.styleSheet.cssText=et:o.appendChild(document.createTextNode(et))}function insertStyleTag(o){var et=document.head||document.getElementsByTagName("head")[0];et.appendChild(o)}var stylesheetSingleton=function(){var o=0,et=null;return{add:function(tt){o==0&&(et=makeStyleTag())&&(injectStyles(et,tt),insertStyleTag(et)),o++},remove:function(){o--,!o&&et&&(et.parentNode&&et.parentNode.removeChild(et),et=null)}}},styleHookSingleton=function(){var o=stylesheetSingleton();return function(et,tt){reactExports.useEffect(function(){return o.add(et),function(){o.remove()}},[et&&tt])}},styleSingleton=function(){var o=styleHookSingleton(),et=function(tt){var nt=tt.styles,rt=tt.dynamic;return o(nt,rt),null};return et},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(o){return parseInt(o||"",10)||0},getOffset=function(o){var et=window.getComputedStyle(document.body),tt=et[o==="padding"?"paddingLeft":"marginLeft"],nt=et[o==="padding"?"paddingTop":"marginTop"],rt=et[o==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(nt),parse$2(rt)]},getGapWidth=function(o){if(o===void 0&&(o="margin"),typeof window>"u")return zeroGap;var et=getOffset(o),tt=document.documentElement.clientWidth,nt=window.innerWidth;return{left:et[0],top:et[1],right:et[2],gap:Math.max(0,nt-tt+et[2]-et[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(o,et,tt,nt){var rt=o.left,ot=o.top,it=o.right,st=o.gap;return tt===void 0&&(tt="margin"),` .`.concat(noScrollbarsClassName,` { overflow: hidden `).concat(nt,`; padding-right: `).concat(st,"px ").concat(nt,`; @@ -4129,10 +4129,10 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 body[`).concat(lockAttribute,`] { `).concat(removedBarSizeVariable,": ").concat(st,`px; } -`)},getCurrentUseCounter=function(){var o=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(o)?o:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var o=getCurrentUseCounter()-1;o<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,o.toString())}},[])},RemoveScrollBar=function(o){var et=o.noRelative,tt=o.noImportant,nt=o.gapMode,rt=nt===void 0?"margin":nt;useLockAttribute();var ot=reactExports.useMemo(function(){return getGapWidth(rt)},[rt]);return reactExports.createElement(Style,{styles:getStyles(ot,!et,rt,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(o){return o.tagName==="TEXTAREA"},elementCanBeScrolled=function(o,et){if(!(o instanceof Element))return!1;var tt=window.getComputedStyle(o);return tt[et]!=="hidden"&&!(tt.overflowY===tt.overflowX&&!alwaysContainsScroll(o)&&tt[et]==="visible")},elementCouldBeVScrolled=function(o){return elementCanBeScrolled(o,"overflowY")},elementCouldBeHScrolled=function(o){return elementCanBeScrolled(o,"overflowX")},locationCouldBeScrolled=function(o,et){var tt=et.ownerDocument,nt=et;do{typeof ShadowRoot<"u"&&nt instanceof ShadowRoot&&(nt=nt.host);var rt=elementCouldBeScrolled(o,nt);if(rt){var ot=getScrollVariables(o,nt),it=ot[1],st=ot[2];if(it>st)return!0}nt=nt.parentNode}while(nt&&nt!==tt.body);return!1},getVScrollVariables=function(o){var et=o.scrollTop,tt=o.scrollHeight,nt=o.clientHeight;return[et,tt,nt]},getHScrollVariables=function(o){var et=o.scrollLeft,tt=o.scrollWidth,nt=o.clientWidth;return[et,tt,nt]},elementCouldBeScrolled=function(o,et){return o==="v"?elementCouldBeVScrolled(et):elementCouldBeHScrolled(et)},getScrollVariables=function(o,et){return o==="v"?getVScrollVariables(et):getHScrollVariables(et)},getDirectionFactor=function(o,et){return o==="h"&&et==="rtl"?-1:1},handleScroll=function(o,et,tt,nt,rt){var ot=getDirectionFactor(o,window.getComputedStyle(et).direction),it=ot*nt,st=tt.target,at=et.contains(st),ct=!1,lt=it>0,dt=0,ht=0;do{var pt=getScrollVariables(o,st),mt=pt[0],ft=pt[1],yt=pt[2],gt=ft-yt-ot*mt;(mt||gt)&&elementCouldBeScrolled(o,st)&&(dt+=gt,ht+=mt),st instanceof ShadowRoot?st=st.host:st=st.parentNode}while(!at&&st!==document.body||at&&(et.contains(st)||et===st));return(lt&&(Math.abs(dt)<1||!rt)||!lt&&(Math.abs(ht)<1||!rt))&&(ct=!0),ct},getTouchXY=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(o){return[o.deltaX,o.deltaY]},extractRef=function(o){return o&&"current"in o?o.current:o},deltaCompare=function(o,et){return o[0]===et[0]&&o[1]===et[1]},generateStyle=function(o){return` +`)},getCurrentUseCounter=function(){var o=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(o)?o:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var o=getCurrentUseCounter()-1;o<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,o.toString())}},[])},RemoveScrollBar=function(o){var et=o.noRelative,tt=o.noImportant,nt=o.gapMode,rt=nt===void 0?"margin":nt;useLockAttribute();var ot=reactExports.useMemo(function(){return getGapWidth(rt)},[rt]);return reactExports.createElement(Style,{styles:getStyles(ot,!et,rt,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(o){return o.tagName==="TEXTAREA"},elementCanBeScrolled=function(o,et){if(!(o instanceof Element))return!1;var tt=window.getComputedStyle(o);return tt[et]!=="hidden"&&!(tt.overflowY===tt.overflowX&&!alwaysContainsScroll(o)&&tt[et]==="visible")},elementCouldBeVScrolled=function(o){return elementCanBeScrolled(o,"overflowY")},elementCouldBeHScrolled=function(o){return elementCanBeScrolled(o,"overflowX")},locationCouldBeScrolled=function(o,et){var tt=et.ownerDocument,nt=et;do{typeof ShadowRoot<"u"&&nt instanceof ShadowRoot&&(nt=nt.host);var rt=elementCouldBeScrolled(o,nt);if(rt){var ot=getScrollVariables(o,nt),it=ot[1],st=ot[2];if(it>st)return!0}nt=nt.parentNode}while(nt&&nt!==tt.body);return!1},getVScrollVariables=function(o){var et=o.scrollTop,tt=o.scrollHeight,nt=o.clientHeight;return[et,tt,nt]},getHScrollVariables=function(o){var et=o.scrollLeft,tt=o.scrollWidth,nt=o.clientWidth;return[et,tt,nt]},elementCouldBeScrolled=function(o,et){return o==="v"?elementCouldBeVScrolled(et):elementCouldBeHScrolled(et)},getScrollVariables=function(o,et){return o==="v"?getVScrollVariables(et):getHScrollVariables(et)},getDirectionFactor=function(o,et){return o==="h"&&et==="rtl"?-1:1},handleScroll=function(o,et,tt,nt,rt){var ot=getDirectionFactor(o,window.getComputedStyle(et).direction),it=ot*nt,st=tt.target,at=et.contains(st),ct=!1,lt=it>0,dt=0,ht=0;do{var ft=getScrollVariables(o,st),mt=ft[0],pt=ft[1],yt=ft[2],gt=pt-yt-ot*mt;(mt||gt)&&elementCouldBeScrolled(o,st)&&(dt+=gt,ht+=mt),st instanceof ShadowRoot?st=st.host:st=st.parentNode}while(!at&&st!==document.body||at&&(et.contains(st)||et===st));return(lt&&(Math.abs(dt)<1||!rt)||!lt&&(Math.abs(ht)<1||!rt))&&(ct=!0),ct},getTouchXY=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(o){return[o.deltaX,o.deltaY]},extractRef=function(o){return o&&"current"in o?o.current:o},deltaCompare=function(o,et){return o[0]===et[0]&&o[1]===et[1]},generateStyle=function(o){return` .block-interactivity-`.concat(o,` {pointer-events: none;} .allow-interactivity-`).concat(o,` {pointer-events: all;} -`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(o){var et=reactExports.useRef([]),tt=reactExports.useRef([0,0]),nt=reactExports.useRef(),rt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(o);reactExports.useEffect(function(){it.current=o},[o]),reactExports.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(rt));var ft=__spreadArray([o.lockRef.current],(o.shards||[]).map(extractRef),!0).filter(Boolean);return ft.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(rt))}),function(){document.body.classList.remove("block-interactivity-".concat(rt)),ft.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(rt))})}}},[o.inert,o.lockRef.current,o.shards]);var st=reactExports.useCallback(function(ft,yt){if("touches"in ft&&ft.touches.length===2||ft.type==="wheel"&&ft.ctrlKey)return!it.current.allowPinchZoom;var gt=getTouchXY(ft),xt=tt.current,vt="deltaX"in ft?ft.deltaX:xt[0]-gt[0],bt="deltaY"in ft?ft.deltaY:xt[1]-gt[1],Et,wt=ft.target,kt=Math.abs(vt)>Math.abs(bt)?"h":"v";if("touches"in ft&&kt==="h"&&wt.type==="range")return!1;var It=locationCouldBeScrolled(kt,wt);if(!It)return!0;if(It?Et=kt:(Et=kt==="v"?"h":"v",It=locationCouldBeScrolled(kt,wt)),!It)return!1;if(!nt.current&&"changedTouches"in ft&&(vt||bt)&&(nt.current=Et),!Et)return!0;var Rt=nt.current||Et;return handleScroll(Rt,yt,ft,Rt==="h"?vt:bt,!0)},[]),at=reactExports.useCallback(function(ft){var yt=ft;if(!(!lockStack.length||lockStack[lockStack.length-1]!==ot)){var gt="deltaY"in yt?getDeltaXY(yt):getTouchXY(yt),xt=et.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(xt&&xt.should){yt.cancelable&&yt.preventDefault();return}if(!xt){var vt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),bt=vt.length>0?st(yt,vt[0]):!it.current.noIsolation;bt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(ft,yt,gt,xt){var vt={name:ft,delta:yt,target:gt,should:xt,shadowParent:getOutermostShadowParent(gt)};et.current.push(vt),setTimeout(function(){et.current=et.current.filter(function(bt){return bt!==vt})},1)},[]),lt=reactExports.useCallback(function(ft){tt.current=getTouchXY(ft),nt.current=void 0},[]),dt=reactExports.useCallback(function(ft){ct(ft.type,getDeltaXY(ft),ft.target,st(ft,o.lockRef.current))},[]),ht=reactExports.useCallback(function(ft){ct(ft.type,getTouchXY(ft),ft.target,st(ft,o.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),o.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(ft){return ft!==ot}),document.removeEventListener("wheel",at,nonPassive),document.removeEventListener("touchmove",at,nonPassive),document.removeEventListener("touchstart",lt,nonPassive)}},[]);var pt=o.removeScrollBar,mt=o.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(ot,{styles:generateStyle(rt)}):null,pt?reactExports.createElement(RemoveScrollBar,{gapMode:o.gapMode}):null)}function getOutermostShadowParent(o){for(var et=null;o!==null;)o instanceof ShadowRoot&&(et=o.host,o=o.host),o=o.parentNode;return et}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(o,et){return reactExports.createElement(RemoveScroll,__assign({},o,{ref:et,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(o){if(typeof document>"u")return null;var et=Array.isArray(o)?o[0]:o;return et.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(o){return o&&(o.host||unwrapHost(o.parentNode))},correctTargets=function(o,et){return et.map(function(tt){if(o.contains(tt))return tt;var nt=unwrapHost(tt);return nt&&o.contains(nt)?nt:(console.error("aria-hidden",tt,"in not contained inside",o,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(o,et,tt,nt){var rt=correctTargets(et,Array.isArray(o)?o:[o]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(rt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};rt.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 pt=ht.getAttribute(nt),mt=pt!==null&&pt!=="false",ft=(counterMap.get(ht)||0)+1,yt=(ot.get(ht)||0)+1;counterMap.set(ht,ft),ot.set(ht,yt),it.push(ht),ft===1&&mt&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),mt||ht.setAttribute(nt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(et),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,pt=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,pt),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(nt),uncontrolledNodes.delete(dt)),pt||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(o,et,tt){tt===void 0&&(tt="data-aria-hidden");var nt=Array.from(Array.isArray(o)?o:[o]),rt=getDefaultParent(o);return rt?(nt.push.apply(nt,Array.from(rt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(nt,rt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=o=>{const{__scopeDialog:et,children:tt,open:nt,defaultOpen:rt,onOpenChange:ot,modal:it=!0}=o,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:nt,defaultProp:rt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:et,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((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(et,rt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":rt.open,"aria-controls":rt.contentId,"data-state":getState(rt.open),...nt,ref:ot,onClick:composeEventHandlers(o.onClick,rt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),DialogPortal$1=o=>{const{__scopeDialog:et,forceMount:tt,children:nt,container:rt}=o,ot=useDialogContext(PORTAL_NAME,et);return jsxRuntimeExports.jsx(PortalProvider,{scope:et,forceMount:tt,children:reactExports.Children.map(nt,it=>jsxRuntimeExports.jsx(Presence,{present:tt||ot.open,children:jsxRuntimeExports.jsx(Portal$1,{asChild:!0,container:rt,children:it})}))})};DialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(OVERLAY_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(OVERLAY_NAME,o.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...rt,ref:et})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[rt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(rt.open),...nt,ref:et,style:{pointerEvents:"auto",...nt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(CONTENT_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(CONTENT_NAME,o.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...rt,ref:et}):jsxRuntimeExports.jsx(DialogContentNonModal,{...rt,ref:et})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(null),rt=useComposedRefs(et,tt.contentRef,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:rt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(o.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(o.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(o.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(!1),rt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:et,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=o.onCloseAutoFocus)==null||it.call(o,ot),ot.defaultPrevented||(nt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),nt.current=!1,rt.current=!1},onInteractOutside:ot=>{var at,ct;(at=o.onInteractOutside)==null||at.call(o,ot),ot.defaultPrevented||(nt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(rt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&rt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,trapFocus:nt,onOpenAutoFocus:rt,onCloseAutoFocus:ot,...it}=o,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:nt,onMountAutoFocus:rt,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((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:rt.titleId,...nt,ref:et})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:rt.descriptionId,...nt,ref:et})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...nt,ref:et,onClick:composeEventHandlers(o.onClick,()=>rt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(o){return o?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:o})=>{const et=useWarningContext(TITLE_WARNING_NAME),tt=`\`${et.contentName}\` requires a \`${et.titleName}\` for the component to be accessible for screen reader users. +`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(o){var et=reactExports.useRef([]),tt=reactExports.useRef([0,0]),nt=reactExports.useRef(),rt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(o);reactExports.useEffect(function(){it.current=o},[o]),reactExports.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(rt));var pt=__spreadArray([o.lockRef.current],(o.shards||[]).map(extractRef),!0).filter(Boolean);return pt.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(rt))}),function(){document.body.classList.remove("block-interactivity-".concat(rt)),pt.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(rt))})}}},[o.inert,o.lockRef.current,o.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),xt=tt.current,vt="deltaX"in pt?pt.deltaX:xt[0]-gt[0],bt="deltaY"in pt?pt.deltaY:xt[1]-gt[1],Et,wt=pt.target,kt=Math.abs(vt)>Math.abs(bt)?"h":"v";if("touches"in pt&&kt==="h"&&wt.type==="range")return!1;var It=locationCouldBeScrolled(kt,wt);if(!It)return!0;if(It?Et=kt:(Et=kt==="v"?"h":"v",It=locationCouldBeScrolled(kt,wt)),!It)return!1;if(!nt.current&&"changedTouches"in pt&&(vt||bt)&&(nt.current=Et),!Et)return!0;var Rt=nt.current||Et;return handleScroll(Rt,yt,pt,Rt==="h"?vt:bt,!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),xt=et.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(xt&&xt.should){yt.cancelable&&yt.preventDefault();return}if(!xt){var vt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),bt=vt.length>0?st(yt,vt[0]):!it.current.noIsolation;bt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(pt,yt,gt,xt){var vt={name:pt,delta:yt,target:gt,should:xt,shadowParent:getOutermostShadowParent(gt)};et.current.push(vt),setTimeout(function(){et.current=et.current.filter(function(bt){return bt!==vt})},1)},[]),lt=reactExports.useCallback(function(pt){tt.current=getTouchXY(pt),nt.current=void 0},[]),dt=reactExports.useCallback(function(pt){ct(pt.type,getDeltaXY(pt),pt.target,st(pt,o.lockRef.current))},[]),ht=reactExports.useCallback(function(pt){ct(pt.type,getTouchXY(pt),pt.target,st(pt,o.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),o.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 ft=o.removeScrollBar,mt=o.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(ot,{styles:generateStyle(rt)}):null,ft?reactExports.createElement(RemoveScrollBar,{gapMode:o.gapMode}):null)}function getOutermostShadowParent(o){for(var et=null;o!==null;)o instanceof ShadowRoot&&(et=o.host,o=o.host),o=o.parentNode;return et}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(o,et){return reactExports.createElement(RemoveScroll,__assign({},o,{ref:et,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(o){if(typeof document>"u")return null;var et=Array.isArray(o)?o[0]:o;return et.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(o){return o&&(o.host||unwrapHost(o.parentNode))},correctTargets=function(o,et){return et.map(function(tt){if(o.contains(tt))return tt;var nt=unwrapHost(tt);return nt&&o.contains(nt)?nt:(console.error("aria-hidden",tt,"in not contained inside",o,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(o,et,tt,nt){var rt=correctTargets(et,Array.isArray(o)?o:[o]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(rt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};rt.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 ft=ht.getAttribute(nt),mt=ft!==null&&ft!=="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&&mt&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),mt||ht.setAttribute(nt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(et),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,ft=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,ft),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(nt),uncontrolledNodes.delete(dt)),ft||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(o,et,tt){tt===void 0&&(tt="data-aria-hidden");var nt=Array.from(Array.isArray(o)?o:[o]),rt=getDefaultParent(o);return rt?(nt.push.apply(nt,Array.from(rt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(nt,rt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=o=>{const{__scopeDialog:et,children:tt,open:nt,defaultOpen:rt,onOpenChange:ot,modal:it=!0}=o,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:nt,defaultProp:rt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:et,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((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(et,rt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":rt.open,"aria-controls":rt.contentId,"data-state":getState(rt.open),...nt,ref:ot,onClick:composeEventHandlers(o.onClick,rt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),DialogPortal$1=o=>{const{__scopeDialog:et,forceMount:tt,children:nt,container:rt}=o,ot=useDialogContext(PORTAL_NAME,et);return jsxRuntimeExports.jsx(PortalProvider,{scope:et,forceMount:tt,children:reactExports.Children.map(nt,it=>jsxRuntimeExports.jsx(Presence,{present:tt||ot.open,children:jsxRuntimeExports.jsx(Portal$1,{asChild:!0,container:rt,children:it})}))})};DialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(OVERLAY_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(OVERLAY_NAME,o.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...rt,ref:et})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[rt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(rt.open),...nt,ref:et,style:{pointerEvents:"auto",...nt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(CONTENT_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(CONTENT_NAME,o.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...rt,ref:et}):jsxRuntimeExports.jsx(DialogContentNonModal,{...rt,ref:et})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(null),rt=useComposedRefs(et,tt.contentRef,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:rt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(o.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(o.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(o.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(!1),rt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:et,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=o.onCloseAutoFocus)==null||it.call(o,ot),ot.defaultPrevented||(nt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),nt.current=!1,rt.current=!1},onInteractOutside:ot=>{var at,ct;(at=o.onInteractOutside)==null||at.call(o,ot),ot.defaultPrevented||(nt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(rt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&rt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,trapFocus:nt,onOpenAutoFocus:rt,onCloseAutoFocus:ot,...it}=o,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:nt,onMountAutoFocus:rt,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((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:rt.titleId,...nt,ref:et})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:rt.descriptionId,...nt,ref:et})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...nt,ref:et,onClick:composeEventHandlers(o.onClick,()=>rt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(o){return o?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:o})=>{const et=useWarningContext(TITLE_WARNING_NAME),tt=`\`${et.contentName}\` requires a \`${et.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${et.titleName}\`, you can wrap it with our VisuallyHidden component. @@ -4140,44 +4140,27 @@ For more information, see https://radix-ui.com/primitives/docs/components/${et.d * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT - */var qrcodegen;(o=>{const et=class Cn{constructor(at,ct,lt,dt){if(this.version=at,this.errorCorrectionLevel=ct,this.modules=[],this.isFunction=[],atCn.MAX_VERSION)throw new RangeError("Version value out of range");if(dt<-1||dt>7)throw new RangeError("Mask value out of range");this.size=at*4+17;let ht=[];for(let mt=0;mt7)throw new RangeError("Invalid value");let mt,ft;for(mt=lt;;mt++){const vt=Cn.getNumDataCodewords(mt,ct)*8,bt=it.getTotalBits(at,mt);if(bt<=vt){ft=bt;break}if(mt>=dt)throw new RangeError("Data too long")}for(const vt of[Cn.Ecc.MEDIUM,Cn.Ecc.QUARTILE,Cn.Ecc.HIGH])pt&&ft<=Cn.getNumDataCodewords(mt,vt)*8&&(ct=vt);let yt=[];for(const vt of at){tt(vt.mode.modeBits,4,yt),tt(vt.numChars,vt.mode.numCharCountBits(mt),yt);for(const bt of vt.getData())yt.push(bt)}rt(yt.length==ft);const gt=Cn.getNumDataCodewords(mt,ct)*8;rt(yt.length<=gt),tt(0,Math.min(4,gt-yt.length),yt),tt(0,(8-yt.length%8)%8,yt),rt(yt.length%8==0);for(let vt=236;yt.lengthxt[bt>>>3]|=vt<<7-(bt&7)),new Cn(mt,ct,xt,ht)}getModule(at,ct){return 0<=at&&at>>9)*1335;const dt=(ct<<10|lt)^21522;rt(dt>>>15==0);for(let ht=0;ht<=5;ht++)this.setFunctionModule(8,ht,nt(dt,ht));this.setFunctionModule(8,7,nt(dt,6)),this.setFunctionModule(8,8,nt(dt,7)),this.setFunctionModule(7,8,nt(dt,8));for(let ht=9;ht<15;ht++)this.setFunctionModule(14-ht,8,nt(dt,ht));for(let ht=0;ht<8;ht++)this.setFunctionModule(this.size-1-ht,8,nt(dt,ht));for(let ht=8;ht<15;ht++)this.setFunctionModule(8,this.size-15+ht,nt(dt,ht));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let at=this.version;for(let lt=0;lt<12;lt++)at=at<<1^(at>>>11)*7973;const ct=this.version<<12|at;rt(ct>>>18==0);for(let lt=0;lt<18;lt++){const dt=nt(ct,lt),ht=this.size-11+lt%3,pt=Math.floor(lt/3);this.setFunctionModule(ht,pt,dt),this.setFunctionModule(pt,ht,dt)}}drawFinderPattern(at,ct){for(let lt=-4;lt<=4;lt++)for(let dt=-4;dt<=4;dt++){const ht=Math.max(Math.abs(dt),Math.abs(lt)),pt=at+dt,mt=ct+lt;0<=pt&&pt{(vt!=ft-ht||Et>=mt)&&xt.push(bt[vt])});return rt(xt.length==pt),xt}drawCodewords(at){if(at.length!=Math.floor(Cn.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let ct=0;for(let lt=this.size-1;lt>=1;lt-=2){lt==6&&(lt=5);for(let dt=0;dt>>3],7-(ct&7)),ct++)}}rt(ct==at.length*8)}applyMask(at){if(at<0||at>7)throw new RangeError("Mask value out of range");for(let ct=0;ct5&&at++):(this.finderPenaltyAddHistory(mt,ft),pt||(at+=this.finderPenaltyCountPatterns(ft)*Cn.PENALTY_N3),pt=this.modules[ht][yt],mt=1);at+=this.finderPenaltyTerminateAndCount(pt,mt,ft)*Cn.PENALTY_N3}for(let ht=0;ht5&&at++):(this.finderPenaltyAddHistory(mt,ft),pt||(at+=this.finderPenaltyCountPatterns(ft)*Cn.PENALTY_N3),pt=this.modules[yt][ht],mt=1);at+=this.finderPenaltyTerminateAndCount(pt,mt,ft)*Cn.PENALTY_N3}for(let ht=0;htpt+(mt?1:0),ct);const lt=this.size*this.size,dt=Math.ceil(Math.abs(ct*20-lt*10)/lt)-1;return rt(0<=dt&&dt<=9),at+=dt*Cn.PENALTY_N4,rt(0<=at&&at<=2568888),at}getAlignmentPatternPositions(){if(this.version==1)return[];{const at=Math.floor(this.version/7)+2,ct=this.version==32?26:Math.ceil((this.version*4+4)/(at*2-2))*2;let lt=[6];for(let dt=this.size-7;lt.lengthCn.MAX_VERSION)throw new RangeError("Version number out of range");let ct=(16*at+128)*at+64;if(at>=2){const lt=Math.floor(at/7)+2;ct-=(25*lt-10)*lt-55,at>=7&&(ct-=36)}return rt(208<=ct&&ct<=29648),ct}static getNumDataCodewords(at,ct){return Math.floor(Cn.getNumRawDataModules(at)/8)-Cn.ECC_CODEWORDS_PER_BLOCK[ct.ordinal][at]*Cn.NUM_ERROR_CORRECTION_BLOCKS[ct.ordinal][at]}static reedSolomonComputeDivisor(at){if(at<1||at>255)throw new RangeError("Degree out of range");let ct=[];for(let dt=0;dt0);for(const dt of at){const ht=dt^lt.shift();lt.push(0),ct.forEach((pt,mt)=>lt[mt]^=Cn.reedSolomonMultiply(pt,ht))}return lt}static reedSolomonMultiply(at,ct){if(at>>>8||ct>>>8)throw new RangeError("Byte out of range");let lt=0;for(let dt=7;dt>=0;dt--)lt=lt<<1^(lt>>>7)*285,lt^=(ct>>>dt&1)*at;return rt(lt>>>8==0),lt}finderPenaltyCountPatterns(at){const ct=at[1];rt(ct<=this.size*3);const lt=ct>0&&at[2]==ct&&at[3]==ct*3&&at[4]==ct&&at[5]==ct;return(lt&&at[0]>=ct*4&&at[6]>=ct?1:0)+(lt&&at[6]>=ct*4&&at[0]>=ct?1:0)}finderPenaltyTerminateAndCount(at,ct,lt){return at&&(this.finderPenaltyAddHistory(ct,lt),ct=0),ct+=this.size,this.finderPenaltyAddHistory(ct,lt),this.finderPenaltyCountPatterns(lt)}finderPenaltyAddHistory(at,ct){ct[0]==0&&(at+=this.size),ct.pop(),ct.unshift(at)}};et.MIN_VERSION=1,et.MAX_VERSION=40,et.PENALTY_N1=3,et.PENALTY_N2=3,et.PENALTY_N3=40,et.PENALTY_N4=10,et.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],et.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],o.QrCode=et;function tt(st,at,ct){if(at<0||at>31||st>>>at)throw new RangeError("Value out of range");for(let lt=at-1;lt>=0;lt--)ct.push(st>>>lt&1)}function nt(st,at){return(st>>>at&1)!=0}function rt(st){if(!st)throw new Error("Assertion error")}const ot=class Ln{constructor(at,ct,lt){if(this.mode=at,this.numChars=ct,this.bitData=lt,ct<0)throw new RangeError("Invalid argument");this.bitData=lt.slice()}static makeBytes(at){let ct=[];for(const lt of at)tt(lt,8,ct);return new Ln(Ln.Mode.BYTE,at.length,ct)}static makeNumeric(at){if(!Ln.isNumeric(at))throw new RangeError("String contains non-numeric characters");let ct=[];for(let lt=0;lt=1<{(et=>{const tt=class{constructor(rt,ot){this.ordinal=rt,this.formatBits=ot}};tt.LOW=new tt(0,1),tt.MEDIUM=new tt(1,0),tt.QUARTILE=new tt(2,3),tt.HIGH=new tt(3,2),et.Ecc=tt})(o.QrCode||(o.QrCode={}))})(qrcodegen||(qrcodegen={}));(o=>{(et=>{const tt=class{constructor(rt,ot){this.modeBits=rt,this.numBitsCharCount=ot}numCharCountBits(rt){return this.numBitsCharCount[Math.floor((rt+7)/17)]}};tt.NUMERIC=new tt(1,[10,12,14]),tt.ALPHANUMERIC=new tt(2,[9,11,13]),tt.BYTE=new tt(4,[8,16,16]),tt.KANJI=new tt(8,[8,10,12]),tt.ECI=new tt(7,[0,0,0]),et.Mode=tt})(o.QrSegment||(o.QrSegment={}))})(qrcodegen||(qrcodegen={}));var qrcodegen_default=qrcodegen;/** + */var qrcodegen;(o=>{const et=class Cn{constructor(at,ct,lt,dt){if(this.version=at,this.errorCorrectionLevel=ct,this.modules=[],this.isFunction=[],atCn.MAX_VERSION)throw new RangeError("Version value out of range");if(dt<-1||dt>7)throw new RangeError("Mask value out of range");this.size=at*4+17;let ht=[];for(let mt=0;mt7)throw new RangeError("Invalid value");let mt,pt;for(mt=lt;;mt++){const vt=Cn.getNumDataCodewords(mt,ct)*8,bt=it.getTotalBits(at,mt);if(bt<=vt){pt=bt;break}if(mt>=dt)throw new RangeError("Data too long")}for(const vt of[Cn.Ecc.MEDIUM,Cn.Ecc.QUARTILE,Cn.Ecc.HIGH])ft&&pt<=Cn.getNumDataCodewords(mt,vt)*8&&(ct=vt);let yt=[];for(const vt of at){tt(vt.mode.modeBits,4,yt),tt(vt.numChars,vt.mode.numCharCountBits(mt),yt);for(const bt of vt.getData())yt.push(bt)}rt(yt.length==pt);const gt=Cn.getNumDataCodewords(mt,ct)*8;rt(yt.length<=gt),tt(0,Math.min(4,gt-yt.length),yt),tt(0,(8-yt.length%8)%8,yt),rt(yt.length%8==0);for(let vt=236;yt.lengthxt[bt>>>3]|=vt<<7-(bt&7)),new Cn(mt,ct,xt,ht)}getModule(at,ct){return 0<=at&&at>>9)*1335;const dt=(ct<<10|lt)^21522;rt(dt>>>15==0);for(let ht=0;ht<=5;ht++)this.setFunctionModule(8,ht,nt(dt,ht));this.setFunctionModule(8,7,nt(dt,6)),this.setFunctionModule(8,8,nt(dt,7)),this.setFunctionModule(7,8,nt(dt,8));for(let ht=9;ht<15;ht++)this.setFunctionModule(14-ht,8,nt(dt,ht));for(let ht=0;ht<8;ht++)this.setFunctionModule(this.size-1-ht,8,nt(dt,ht));for(let ht=8;ht<15;ht++)this.setFunctionModule(8,this.size-15+ht,nt(dt,ht));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let at=this.version;for(let lt=0;lt<12;lt++)at=at<<1^(at>>>11)*7973;const ct=this.version<<12|at;rt(ct>>>18==0);for(let lt=0;lt<18;lt++){const dt=nt(ct,lt),ht=this.size-11+lt%3,ft=Math.floor(lt/3);this.setFunctionModule(ht,ft,dt),this.setFunctionModule(ft,ht,dt)}}drawFinderPattern(at,ct){for(let lt=-4;lt<=4;lt++)for(let dt=-4;dt<=4;dt++){const ht=Math.max(Math.abs(dt),Math.abs(lt)),ft=at+dt,mt=ct+lt;0<=ft&&ft{(vt!=pt-ht||Et>=mt)&&xt.push(bt[vt])});return rt(xt.length==ft),xt}drawCodewords(at){if(at.length!=Math.floor(Cn.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let ct=0;for(let lt=this.size-1;lt>=1;lt-=2){lt==6&&(lt=5);for(let dt=0;dt>>3],7-(ct&7)),ct++)}}rt(ct==at.length*8)}applyMask(at){if(at<0||at>7)throw new RangeError("Mask value out of range");for(let ct=0;ct5&&at++):(this.finderPenaltyAddHistory(mt,pt),ft||(at+=this.finderPenaltyCountPatterns(pt)*Cn.PENALTY_N3),ft=this.modules[ht][yt],mt=1);at+=this.finderPenaltyTerminateAndCount(ft,mt,pt)*Cn.PENALTY_N3}for(let ht=0;ht5&&at++):(this.finderPenaltyAddHistory(mt,pt),ft||(at+=this.finderPenaltyCountPatterns(pt)*Cn.PENALTY_N3),ft=this.modules[yt][ht],mt=1);at+=this.finderPenaltyTerminateAndCount(ft,mt,pt)*Cn.PENALTY_N3}for(let ht=0;htft+(mt?1:0),ct);const lt=this.size*this.size,dt=Math.ceil(Math.abs(ct*20-lt*10)/lt)-1;return rt(0<=dt&&dt<=9),at+=dt*Cn.PENALTY_N4,rt(0<=at&&at<=2568888),at}getAlignmentPatternPositions(){if(this.version==1)return[];{const at=Math.floor(this.version/7)+2,ct=this.version==32?26:Math.ceil((this.version*4+4)/(at*2-2))*2;let lt=[6];for(let dt=this.size-7;lt.lengthCn.MAX_VERSION)throw new RangeError("Version number out of range");let ct=(16*at+128)*at+64;if(at>=2){const lt=Math.floor(at/7)+2;ct-=(25*lt-10)*lt-55,at>=7&&(ct-=36)}return rt(208<=ct&&ct<=29648),ct}static getNumDataCodewords(at,ct){return Math.floor(Cn.getNumRawDataModules(at)/8)-Cn.ECC_CODEWORDS_PER_BLOCK[ct.ordinal][at]*Cn.NUM_ERROR_CORRECTION_BLOCKS[ct.ordinal][at]}static reedSolomonComputeDivisor(at){if(at<1||at>255)throw new RangeError("Degree out of range");let ct=[];for(let dt=0;dt0);for(const dt of at){const ht=dt^lt.shift();lt.push(0),ct.forEach((ft,mt)=>lt[mt]^=Cn.reedSolomonMultiply(ft,ht))}return lt}static reedSolomonMultiply(at,ct){if(at>>>8||ct>>>8)throw new RangeError("Byte out of range");let lt=0;for(let dt=7;dt>=0;dt--)lt=lt<<1^(lt>>>7)*285,lt^=(ct>>>dt&1)*at;return rt(lt>>>8==0),lt}finderPenaltyCountPatterns(at){const ct=at[1];rt(ct<=this.size*3);const lt=ct>0&&at[2]==ct&&at[3]==ct*3&&at[4]==ct&&at[5]==ct;return(lt&&at[0]>=ct*4&&at[6]>=ct?1:0)+(lt&&at[6]>=ct*4&&at[0]>=ct?1:0)}finderPenaltyTerminateAndCount(at,ct,lt){return at&&(this.finderPenaltyAddHistory(ct,lt),ct=0),ct+=this.size,this.finderPenaltyAddHistory(ct,lt),this.finderPenaltyCountPatterns(lt)}finderPenaltyAddHistory(at,ct){ct[0]==0&&(at+=this.size),ct.pop(),ct.unshift(at)}};et.MIN_VERSION=1,et.MAX_VERSION=40,et.PENALTY_N1=3,et.PENALTY_N2=3,et.PENALTY_N3=40,et.PENALTY_N4=10,et.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],et.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],o.QrCode=et;function tt(st,at,ct){if(at<0||at>31||st>>>at)throw new RangeError("Value out of range");for(let lt=at-1;lt>=0;lt--)ct.push(st>>>lt&1)}function nt(st,at){return(st>>>at&1)!=0}function rt(st){if(!st)throw new Error("Assertion error")}const ot=class Pn{constructor(at,ct,lt){if(this.mode=at,this.numChars=ct,this.bitData=lt,ct<0)throw new RangeError("Invalid argument");this.bitData=lt.slice()}static makeBytes(at){let ct=[];for(const lt of at)tt(lt,8,ct);return new Pn(Pn.Mode.BYTE,at.length,ct)}static makeNumeric(at){if(!Pn.isNumeric(at))throw new RangeError("String contains non-numeric characters");let ct=[];for(let lt=0;lt=1<{(et=>{const tt=class{constructor(rt,ot){this.ordinal=rt,this.formatBits=ot}};tt.LOW=new tt(0,1),tt.MEDIUM=new tt(1,0),tt.QUARTILE=new tt(2,3),tt.HIGH=new tt(3,2),et.Ecc=tt})(o.QrCode||(o.QrCode={}))})(qrcodegen||(qrcodegen={}));(o=>{(et=>{const tt=class{constructor(rt,ot){this.modeBits=rt,this.numBitsCharCount=ot}numCharCountBits(rt){return this.numBitsCharCount[Math.floor((rt+7)/17)]}};tt.NUMERIC=new tt(1,[10,12,14]),tt.ALPHANUMERIC=new tt(2,[9,11,13]),tt.BYTE=new tt(4,[8,16,16]),tt.KANJI=new tt(8,[8,10,12]),tt.ECI=new tt(7,[0,0,0]),et.Mode=tt})(o.QrSegment||(o.QrSegment={}))})(qrcodegen||(qrcodegen={}));var qrcodegen_default=qrcodegen;/** * @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(o,et=0){const tt=[];return o.forEach(function(nt,rt){let ot=null;nt.forEach(function(it,st){if(!it&&ot!==null){tt.push(`M${ot+et} ${rt+et}h${st-ot}v1H${ot+et}z`),ot=null;return}if(st===nt.length-1){if(!it)return;ot===null?tt.push(`M${st+et},${rt+et} h1v1H${st+et}z`):tt.push(`M${ot+et},${rt+et} h${st+1-ot}v1H${ot+et}z`);return}it&&ot===null&&(ot=st)})}),tt.join("")}function excavateModules(o,et){return o.slice().map((tt,nt)=>nt=et.y+et.h?tt:tt.map((rt,ot)=>ot=et.x+et.w?rt:!1))}function getImageSettings(o,et,tt,nt){if(nt==null)return null;const rt=o.length+tt*2,ot=Math.floor(et*DEFAULT_IMG_SCALE),it=rt/et,st=(nt.width||ot)*it,at=(nt.height||ot)*it,ct=nt.x==null?o.length/2-st/2:nt.x*it,lt=nt.y==null?o.length/2-at/2:nt.y*it,dt=nt.opacity==null?1:nt.opacity;let ht=null;if(nt.excavate){let mt=Math.floor(ct),ft=Math.floor(lt),yt=Math.ceil(st+ct-mt),gt=Math.ceil(at+lt-ft);ht={x:mt,y:ft,w:yt,h:gt}}const pt=nt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:pt}}function getMarginSize(o,et){return et!=null?Math.max(Math.floor(et),0):o?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:o,level:et,minVersion:tt,includeMargin:nt,marginSize:rt,imageSettings:ot,size:it,boostLevel:st}){let at=React.useMemo(()=>{const mt=(Array.isArray(o)?o:[o]).reduce((ft,yt)=>(ft.push(...qrcodegen_default.QrSegment.makeSegments(yt)),ft),[]);return qrcodegen_default.QrCode.encodeSegments(mt,ERROR_LEVEL_MAP[et],tt,void 0,void 0,st)},[o,et,tt,st]);const{cells:ct,margin:lt,numCells:dt,calculatedImageSettings:ht}=React.useMemo(()=>{let pt=at.getModules();const mt=getMarginSize(nt,rt),ft=pt.length+mt*2,yt=getImageSettings(pt,it,mt,ot);return{cells:pt,margin:mt,numCells:ft,calculatedImageSettings:yt}},[at,it,ot,nt,rt]);return{qrcode:at,margin:lt,cells:ct,numCells:dt,calculatedImageSettings:ht}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,marginSize:ht,imageSettings:pt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:yt}=ft,gt=__objRest(ft,["style"]),xt=pt==null?void 0:pt.src,vt=React.useRef(null),bt=React.useRef(null),Et=React.useCallback(zt=>{vt.current=zt,typeof tt=="function"?tt(zt):tt&&(tt.current=zt)},[tt]),[wt,kt]=React.useState(!1),{margin:It,cells:Rt,numCells:Pt,calculatedImageSettings:jt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:ht,imageSettings:pt,size:ot});React.useEffect(()=>{if(vt.current!=null){const zt=vt.current,Ft=zt.getContext("2d");if(!Ft)return;let Yt=Rt;const Ht=bt.current,Ut=jt!=null&&Ht!==null&&Ht.complete&&Ht.naturalHeight!==0&&Ht.naturalWidth!==0;Ut&&jt.excavation!=null&&(Yt=excavateModules(Rt,jt.excavation));const qt=window.devicePixelRatio||1;zt.height=zt.width=ot*qt;const Lt=ot/Pt*qt;Ft.scale(Lt,Lt),Ft.fillStyle=st,Ft.fillRect(0,0,Pt,Pt),Ft.fillStyle=at,SUPPORTS_PATH2D?Ft.fill(new Path2D(generatePath(Yt,It))):Rt.forEach(function(Zt,Qt){Zt.forEach(function(Nt,Gt){Nt&&Ft.fillRect(Gt+It,Qt+It,1,1)})}),jt&&(Ft.globalAlpha=jt.opacity),Ut&&Ft.drawImage(Ht,jt.x+It,jt.y+It,jt.w,jt.h)}}),React.useEffect(()=>{kt(!1)},[xt]);const Ot=__spreadValues({height:ot,width:ot},yt);let Bt=null;return xt!=null&&(Bt=React.createElement("img",{src:xt,key:xt,style:{display:"none"},onLoad:()=>{kt(!0)},ref:bt,crossOrigin:jt==null?void 0:jt.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Ot,height:ot,width:ot,ref:Et,role:"img"},gt)),Bt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,title:ht,marginSize:pt,imageSettings:mt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:yt,cells:gt,numCells:xt,calculatedImageSettings:vt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:pt,imageSettings:mt,size:ot});let bt=gt,Et=null;mt!=null&&vt!=null&&(vt.excavation!=null&&(bt=excavateModules(gt,vt.excavation)),Et=React.createElement("image",{href:mt.src,height:vt.h,width:vt.w,x:vt.x+yt,y:vt.y+yt,preserveAspectRatio:"none",opacity:vt.opacity,crossOrigin:vt.crossOrigin}));const wt=generatePath(bt,yt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${xt} ${xt}`,ref:tt,role:"img"},ft),!!ht&&React.createElement("title",null,ht),React.createElement("path",{fill:st,d:`M0,0 h${xt}v${xt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:wt,shapeRendering:"crispEdges"}),Et)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:o,width:et=256,height:tt=256,showCopyButton:nt="both",title:rt,description:ot})=>{const[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(Math.min(et,tt));reactExports.useEffect(()=>{const mt=()=>{ct(window.innerWidth<640),dt(window.innerWidth<640?Math.min(window.innerWidth-80,200):Math.min(et,tt))};return mt(),window.addEventListener("resize",mt),()=>window.removeEventListener("resize",mt)},[et,tt]);const ht=async()=>{await navigator.clipboard.writeText(o),st(!0),setTimeout(()=>st(!1),2e3)},pt=async()=>{if(navigator.share)try{await navigator.share({title:rt||"Share Chain",text:ot||"Sign this chain",url:o})}catch(mt){mt instanceof Error&&mt.name!=="AbortError"&&console.error("Error sharing:",mt)}else ht()};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center w-full space-y-4",children:[jsxRuntimeExports.jsx("div",{className:"flex justify-center w-full",children:jsxRuntimeExports.jsx(QRCodeSVG,{value:o,size:lt,className:"max-w-full"})}),nt!=="text"&&jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 w-full",children:[jsxRuntimeExports.jsx("input",{type:"text",value:o,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:ht,className:"shrink-0",children:it?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]}),nt==="text"&&jsxRuntimeExports.jsx(Button,{onClick:at&&"share"in navigator?pt:ht,variant:"secondary",className:"w-full sm:w-auto",children:at&&"share"in navigator?"Share":it?"Copied!":"Copy Link"})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(o,et=0){return(byteToHex[o[et+0]]+byteToHex[o[et+1]]+byteToHex[o[et+2]]+byteToHex[o[et+3]]+"-"+byteToHex[o[et+4]]+byteToHex[o[et+5]]+"-"+byteToHex[o[et+6]]+byteToHex[o[et+7]]+"-"+byteToHex[o[et+8]]+byteToHex[o[et+9]]+"-"+byteToHex[o[et+10]]+byteToHex[o[et+11]]+byteToHex[o[et+12]]+byteToHex[o[et+13]]+byteToHex[o[et+14]]+byteToHex[o[et+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(o,et,tt){if(native.randomUUID&&!et&&!o)return native.randomUUID();o=o||{};var nt=o.random||(o.rng||rng)();return nt[6]=nt[6]&15|64,nt[8]=nt[8]&63|128,unsafeStringify(nt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(o,et){for(var tt=new Array(arguments.length-1),nt=0,rt=2,ot=!0;rt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),nt=new Array(123),rt=0;rt<64;)nt[tt[rt]=rt<26?rt+65:rt<52?rt+71:rt<62?rt-4:rt-59|43]=rt++;et.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,pt=0,mt;at>2],mt=(ft&3)<<4,pt=1;break;case 1:dt[ht++]=tt[mt|ft>>4],mt=(ft&15)<<2,pt=2;break;case 2:dt[ht++]=tt[mt|ft>>6],dt[ht++]=tt[ft&63],pt=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return pt&&(dt[ht++]=tt[mt],dt[ht++]=61,pt===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";et.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,pt=0;pt1)break;if((mt=nt[mt])===void 0)throw Error(ot);switch(dt){case 0:ht=mt,dt=1;break;case 1:at[ct++]=ht<<2|(mt&48)>>4,ht=mt,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(mt&60)>>2,ht=mt,dt=3;break;case 3:at[ct++]=(ht&3)<<6|mt,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},et.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(et,tt,nt){return(this._listeners[et]||(this._listeners[et]=[])).push({fn:tt,ctx:nt||this}),this};EventEmitter.prototype.off=function(et,tt){if(et===void 0)this._listeners={};else if(tt===void 0)this._listeners[et]=[];else for(var nt=this._listeners[et],rt=0;rt0?0:2147483648,ot,it);else if(isNaN(rt))nt(2143289344,ot,it);else if(rt>34028234663852886e22)nt((st<<31|2139095040)>>>0,ot,it);else if(rt<11754943508222875e-54)nt((st<<31|Math.round(rt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(rt)/Math.LN2),ct=Math.round(rt*Math.pow(2,-at)*8388608)&8388607;nt((st<<31|at+127<<23|ct)>>>0,ot,it)}}o.writeFloatLE=et.bind(null,writeUintLE),o.writeFloatBE=et.bind(null,writeUintBE);function tt(nt,rt,ot){var it=nt(rt,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)}o.readFloatLE=tt.bind(null,readUintLE),o.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var et=new Float64Array([-0]),tt=new Uint8Array(et.buffer),nt=tt[7]===128;function rt(at,ct,lt){et[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){et[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]}o.writeDoubleLE=nt?rt:ot,o.writeDoubleBE=nt?ot:rt;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],et[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],et[0]}o.readDoubleLE=nt?it:st,o.readDoubleBE=nt?st:it}():function(){function et(nt,rt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)nt(0,st,at+rt),nt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))nt(0,st,at+rt),nt(2146959360,st,at+ot);else if(it>17976931348623157e292)nt(0,st,at+rt),nt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,nt(lt>>>0,st,at+rt),nt((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),nt(lt*4503599627370496>>>0,st,at+rt),nt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}o.writeDoubleLE=et.bind(null,writeUintLE,0,4),o.writeDoubleBE=et.bind(null,writeUintBE,4,0);function tt(nt,rt,ot,it,st){var at=nt(it,st+rt),ct=nt(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)}o.readDoubleLE=tt.bind(null,readUintLE,0,4),o.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeUintBE(o,et,tt){et[tt]=o>>>24,et[tt+1]=o>>>16&255,et[tt+2]=o>>>8&255,et[tt+3]=o&255}function readUintLE(o,et){return(o[et]|o[et+1]<<8|o[et+2]<<16|o[et+3]<<24)>>>0}function readUintBE(o,et){return(o[et]<<24|o[et+1]<<16|o[et+2]<<8|o[et+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(o){}return null}var utf8$2={};(function(o){var et=o;et.length=function(nt){for(var rt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|nt[rt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(nt[rt++]&63)<<12|(nt[rt++]&63)<<6|nt[rt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(nt[rt++]&63)<<6|nt[rt++]&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))},et.write=function(nt,rt,ot){for(var it=ot,st,at,ct=0;ct>6|192,rt[ot++]=st&63|128):(st&64512)===55296&&((at=nt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,rt[ot++]=st>>18|240,rt[ot++]=st>>12&63|128,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128):(rt[ot++]=st>>12|224,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(o,et,tt){var nt=tt||8192,rt=nt>>>1,ot=null,it=nt;return function(at){if(at<1||at>rt)return o(at);it+at>nt&&(ot=o(nt),it=0);var ct=et.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=et;var o=requireMinimal();function et(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=et.zero=new et(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var nt=et.zeroHash="\0\0\0\0\0\0\0\0";et.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 et(at,ct)},et.from=function(it){if(typeof it=="number")return et.fromNumber(it);if(o.isString(it))if(o.Long)it=o.Long.fromString(it);else return et.fromNumber(parseInt(it,10));return it.low||it.high?new et(it.low>>>0,it.high>>>0):tt},et.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},et.prototype.toLong=function(it){return o.Long?new o.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var rt=String.prototype.charCodeAt;return et.fromHash=function(it){return it===nt?tt:new et((rt.call(it,0)|rt.call(it,1)<<8|rt.call(it,2)<<16|rt.call(it,3)<<24)>>>0,(rt.call(it,4)|rt.call(it,5)<<8|rt.call(it,6)<<16|rt.call(it,7)<<24)>>>0)},et.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)},et.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},et.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},et.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(o){var et=o;et.asPromise=aspromise,et.base64=base64$1,et.EventEmitter=eventemitter,et.float=float,et.inquire=inquire_1,et.utf8=utf8$2,et.pool=pool_1,et.LongBits=requireLongbits(),et.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),et.global=et.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,et.emptyArray=Object.freeze?Object.freeze([]):[],et.emptyObject=Object.freeze?Object.freeze({}):{},et.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},et.isString=function(ot){return typeof ot=="string"||ot instanceof String},et.isObject=function(ot){return ot&&typeof ot=="object"},et.isset=et.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},et.Buffer=function(){try{var rt=et.inquire("buffer").Buffer;return rt.prototype.utf8Write?rt:null}catch{return null}}(),et._Buffer_from=null,et._Buffer_allocUnsafe=null,et.newBuffer=function(ot){return typeof ot=="number"?et.Buffer?et._Buffer_allocUnsafe(ot):new et.Array(ot):et.Buffer?et._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},et.Array=typeof Uint8Array<"u"?Uint8Array:Array,et.Long=et.global.dcodeIO&&et.global.dcodeIO.Long||et.global.Long||et.inquire("long"),et.key2Re=/^true|false|0|1$/,et.key32Re=/^-?(?:0|[1-9][0-9]*)$/,et.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,et.longToHash=function(ot){return ot?et.LongBits.from(ot).toHash():et.LongBits.zeroHash},et.longFromHash=function(ot,it){var st=et.LongBits.fromHash(ot);return et.Long?et.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(rt,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]}},et.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}function VarintOp(o,et){this.len=o,this.next=void 0,this.val=et}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(et){return this.len+=(this.tail=this.tail.next=new VarintOp((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this};Writer$1.prototype.int32=function o(et){return et<0?this._push(writeVarint64,10,LongBits$1.fromNumber(et)):this.uint32(et)};Writer$1.prototype.sint32=function o(et){return this.uint32((et<<1^et>>31)>>>0)};function writeVarint64(o,et,tt){for(;o.hi;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}Writer$1.prototype.uint64=function o(et){var tt=LongBits$1.from(et);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(et){var tt=LongBits$1.from(et).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function o(et){return this._push(writeByte,1,et?1:0)};function writeFixed32(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}Writer$1.prototype.fixed32=function o(et){return this._push(writeFixed32,4,et>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(et){var tt=LongBits$1.from(et);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 o(et){return this._push(util$7.float.writeFloatLE,4,et)};Writer$1.prototype.double=function o(et){return this._push(util$7.float.writeDoubleLE,8,et)};var writeBytes=util$7.Array.prototype.set?function o(et,tt,nt){tt.set(et,nt)}:function o(et,tt,nt){for(var rt=0;rt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(et)){var nt=Writer$1.alloc(tt=base64.length(et));base64.decode(et,nt,0),et=nt}return this.uint32(tt)._push(writeBytes,tt,et)};Writer$1.prototype.string=function o(et){var tt=utf8$1.length(et);return tt?this.uint32(tt)._push(utf8$1.write,tt,et):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){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 o(){var et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this};Writer$1.prototype.finish=function o(){for(var et=this.head.next,tt=this.constructor.alloc(this.len),nt=0;et;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt};Writer$1._configure=function(o){BufferWriter$1=o,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(et,tt,nt){tt.set(et,nt)}:function(et,tt,nt){if(et.copy)et.copy(tt,nt,0,et.length);else for(var rt=0;rt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,et),this};function writeStringBuffer(o,et,tt){o.length<40?util$6.utf8.write(o,et,tt):et.utf8Write?et.utf8Write(o,tt):et.write(o,tt)}BufferWriter.prototype.string=function o(et){var tt=util$6.Buffer.byteLength(et);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,et),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(o,et){return RangeError("index out of range: "+o.pos+" + "+(et||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(et){if(et instanceof Uint8Array||Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")}:function o(et){if(Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")},create$1=function o(){return util$5.Buffer?function(tt){return(Reader$1.create=function(rt){return util$5.Buffer.isBuffer(rt)?new BufferReader$1(rt):create_array(rt)})(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 o(){var et=4294967295;return function(){if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return et}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var et=this.uint32();return et>>>1^-(et&1)|0};function readLongVarint(){var o=new LongBits(0,0),et=0;if(this.len-this.pos>4){for(;et<4;++et)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;et=0}else{for(;et<3;++et){if(this.pos>=this.len)throw indexOutOfRange(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(;et<5;++et)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;et<5;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){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 o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,et};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,et};Reader$1.prototype.bytes=function o(){var et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange(this,et);if(this.pos+=et,Array.isArray(this.buf))return this.buf.slice(tt,nt);if(tt===nt){var rt=util$5.Buffer;return rt?rt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,nt)};Reader$1.prototype.string=function o(){var et=this.bytes();return utf8.read(et,0,et.length)};Reader$1.prototype.skip=function o(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(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};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create$1(),BufferReader$1._configure();var et=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[et](!1)},uint64:function(){return readLongVarint.call(this)[et](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[et](!1)},fixed64:function(){return readFixed64.call(this)[et](!0)},sfixed64:function(){return readFixed64.call(this)[et](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var et=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+et,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+et,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(o,et,tt){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!et,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function o(et,tt,nt,rt,ot){if(!rt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(o,it,et,tt,nt,rt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(et,tt[it.requestDelimited?"encodeDelimited":"encode"](rt).finish(),function(at,ct){if(at)return it.emit("error",at,et),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof nt))try{ct=nt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,et),ot(lt)}return it.emit("data",ct,et),ot(null,ct)})}catch(st){it.emit("error",st,et),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function o(et){return this.rpcImpl&&(et||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var et=o;et.Service=service$1})(rpc);var roots={};(function(o){var et=o;et.build="minimal",et.Writer=writer,et.BufferWriter=writer_buffer,et.Reader=reader,et.BufferReader=reader_buffer,et.util=requireMinimal(),et.rpc=rpc,et.roots=roots,et.configure=tt;function tt(){et.util._configure(),et.Writer._configure(et.BufferWriter),et.Reader._configure(et.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(o,et){typeof o=="string"&&(et=o,o=void 0);var tt=[];function nt(ot){if(typeof ot!="string"){var it=rt();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;ltnt=et.y+et.h?tt:tt.map((rt,ot)=>ot=et.x+et.w?rt:!1))}function getImageSettings(o,et,tt,nt){if(nt==null)return null;const rt=o.length+tt*2,ot=Math.floor(et*DEFAULT_IMG_SCALE),it=rt/et,st=(nt.width||ot)*it,at=(nt.height||ot)*it,ct=nt.x==null?o.length/2-st/2:nt.x*it,lt=nt.y==null?o.length/2-at/2:nt.y*it,dt=nt.opacity==null?1:nt.opacity;let ht=null;if(nt.excavate){let mt=Math.floor(ct),pt=Math.floor(lt),yt=Math.ceil(st+ct-mt),gt=Math.ceil(at+lt-pt);ht={x:mt,y:pt,w:yt,h:gt}}const ft=nt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:ft}}function getMarginSize(o,et){return et!=null?Math.max(Math.floor(et),0):o?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:o,level:et,minVersion:tt,includeMargin:nt,marginSize:rt,imageSettings:ot,size:it,boostLevel:st}){let at=React.useMemo(()=>{const mt=(Array.isArray(o)?o:[o]).reduce((pt,yt)=>(pt.push(...qrcodegen_default.QrSegment.makeSegments(yt)),pt),[]);return qrcodegen_default.QrCode.encodeSegments(mt,ERROR_LEVEL_MAP[et],tt,void 0,void 0,st)},[o,et,tt,st]);const{cells:ct,margin:lt,numCells:dt,calculatedImageSettings:ht}=React.useMemo(()=>{let ft=at.getModules();const mt=getMarginSize(nt,rt),pt=ft.length+mt*2,yt=getImageSettings(ft,it,mt,ot);return{cells:ft,margin:mt,numCells:pt,calculatedImageSettings:yt}},[at,it,ot,nt,rt]);return{qrcode:at,margin:lt,cells:ct,numCells:dt,calculatedImageSettings:ht}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,marginSize:ht,imageSettings:ft}=nt,pt=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:yt}=pt,gt=__objRest(pt,["style"]),xt=ft==null?void 0:ft.src,vt=React.useRef(null),bt=React.useRef(null),Et=React.useCallback(zt=>{vt.current=zt,typeof tt=="function"?tt(zt):tt&&(tt.current=zt)},[tt]),[wt,kt]=React.useState(!1),{margin:It,cells:Rt,numCells:$t,calculatedImageSettings:Nt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:ht,imageSettings:ft,size:ot});React.useEffect(()=>{if(vt.current!=null){const zt=vt.current,Ft=zt.getContext("2d");if(!Ft)return;let Yt=Rt;const Ht=bt.current,Ut=Nt!=null&&Ht!==null&&Ht.complete&&Ht.naturalHeight!==0&&Ht.naturalWidth!==0;Ut&&Nt.excavation!=null&&(Yt=excavateModules(Rt,Nt.excavation));const qt=window.devicePixelRatio||1;zt.height=zt.width=ot*qt;const Pt=ot/$t*qt;Ft.scale(Pt,Pt),Ft.fillStyle=st,Ft.fillRect(0,0,$t,$t),Ft.fillStyle=at,SUPPORTS_PATH2D?Ft.fill(new Path2D(generatePath(Yt,It))):Rt.forEach(function(Zt,Qt){Zt.forEach(function(Lt,Gt){Lt&&Ft.fillRect(Gt+It,Qt+It,1,1)})}),Nt&&(Ft.globalAlpha=Nt.opacity),Ut&&Ft.drawImage(Ht,Nt.x+It,Nt.y+It,Nt.w,Nt.h)}}),React.useEffect(()=>{kt(!1)},[xt]);const Mt=__spreadValues({height:ot,width:ot},yt);let Bt=null;return xt!=null&&(Bt=React.createElement("img",{src:xt,key:xt,style:{display:"none"},onLoad:()=>{kt(!0)},ref:bt,crossOrigin:Nt==null?void 0:Nt.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Mt,height:ot,width:ot,ref:Et,role:"img"},gt)),Bt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,title:ht,marginSize:ft,imageSettings:mt}=nt,pt=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:yt,cells:gt,numCells:xt,calculatedImageSettings:vt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:ft,imageSettings:mt,size:ot});let bt=gt,Et=null;mt!=null&&vt!=null&&(vt.excavation!=null&&(bt=excavateModules(gt,vt.excavation)),Et=React.createElement("image",{href:mt.src,height:vt.h,width:vt.w,x:vt.x+yt,y:vt.y+yt,preserveAspectRatio:"none",opacity:vt.opacity,crossOrigin:vt.crossOrigin}));const wt=generatePath(bt,yt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${xt} ${xt}`,ref:tt,role:"img"},pt),!!ht&&React.createElement("title",null,ht),React.createElement("path",{fill:st,d:`M0,0 h${xt}v${xt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:wt,shapeRendering:"crispEdges"}),Et)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:o,width:et=256,height:tt=256,showCopyButton:nt="both",title:rt,description:ot})=>{const[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(Math.min(et,tt));reactExports.useEffect(()=>{const mt=()=>{ct(window.innerWidth<640),dt(window.innerWidth<640?Math.min(window.innerWidth-80,200):Math.min(et,tt))};return mt(),window.addEventListener("resize",mt),()=>window.removeEventListener("resize",mt)},[et,tt]);const ht=async()=>{await navigator.clipboard.writeText(o),st(!0),setTimeout(()=>st(!1),2e3)},ft=async()=>{if(navigator.share)try{await navigator.share({title:rt||"Share Chain",text:ot||"Sign this chain",url:o})}catch(mt){mt instanceof Error&&mt.name!=="AbortError"&&console.error("Error sharing:",mt)}else ht()};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center w-full space-y-4",children:[jsxRuntimeExports.jsx("div",{className:"flex justify-center w-full",children:jsxRuntimeExports.jsx(QRCodeSVG,{value:o,size:lt,className:"max-w-full"})}),nt!=="text"&&jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 w-full",children:[jsxRuntimeExports.jsx("input",{type:"text",value:o,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:ht,className:"shrink-0",children:it?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]}),nt==="text"&&jsxRuntimeExports.jsx(Button,{onClick:at&&"share"in navigator?ft:ht,variant:"secondary",className:"w-full sm:w-auto",children:at&&"share"in navigator?"Share":it?"Copied!":"Copy Link"})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(o,et=0){return(byteToHex[o[et+0]]+byteToHex[o[et+1]]+byteToHex[o[et+2]]+byteToHex[o[et+3]]+"-"+byteToHex[o[et+4]]+byteToHex[o[et+5]]+"-"+byteToHex[o[et+6]]+byteToHex[o[et+7]]+"-"+byteToHex[o[et+8]]+byteToHex[o[et+9]]+"-"+byteToHex[o[et+10]]+byteToHex[o[et+11]]+byteToHex[o[et+12]]+byteToHex[o[et+13]]+byteToHex[o[et+14]]+byteToHex[o[et+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(o,et,tt){if(native.randomUUID&&!et&&!o)return native.randomUUID();o=o||{};var nt=o.random||(o.rng||rng)();return nt[6]=nt[6]&15|64,nt[8]=nt[8]&63|128,unsafeStringify(nt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(o,et){for(var tt=new Array(arguments.length-1),nt=0,rt=2,ot=!0;rt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),nt=new Array(123),rt=0;rt<64;)nt[tt[rt]=rt<26?rt+65:rt<52?rt+71:rt<62?rt-4:rt-59|43]=rt++;et.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,ft=0,mt;at>2],mt=(pt&3)<<4,ft=1;break;case 1:dt[ht++]=tt[mt|pt>>4],mt=(pt&15)<<2,ft=2;break;case 2:dt[ht++]=tt[mt|pt>>6],dt[ht++]=tt[pt&63],ft=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return ft&&(dt[ht++]=tt[mt],dt[ht++]=61,ft===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";et.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,ft=0;ft1)break;if((mt=nt[mt])===void 0)throw Error(ot);switch(dt){case 0:ht=mt,dt=1;break;case 1:at[ct++]=ht<<2|(mt&48)>>4,ht=mt,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(mt&60)>>2,ht=mt,dt=3;break;case 3:at[ct++]=(ht&3)<<6|mt,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},et.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(et,tt,nt){return(this._listeners[et]||(this._listeners[et]=[])).push({fn:tt,ctx:nt||this}),this};EventEmitter.prototype.off=function(et,tt){if(et===void 0)this._listeners={};else if(tt===void 0)this._listeners[et]=[];else for(var nt=this._listeners[et],rt=0;rt0?0:2147483648,ot,it);else if(isNaN(rt))nt(2143289344,ot,it);else if(rt>34028234663852886e22)nt((st<<31|2139095040)>>>0,ot,it);else if(rt<11754943508222875e-54)nt((st<<31|Math.round(rt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(rt)/Math.LN2),ct=Math.round(rt*Math.pow(2,-at)*8388608)&8388607;nt((st<<31|at+127<<23|ct)>>>0,ot,it)}}o.writeFloatLE=et.bind(null,writeUintLE),o.writeFloatBE=et.bind(null,writeUintBE);function tt(nt,rt,ot){var it=nt(rt,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)}o.readFloatLE=tt.bind(null,readUintLE),o.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var et=new Float64Array([-0]),tt=new Uint8Array(et.buffer),nt=tt[7]===128;function rt(at,ct,lt){et[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){et[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]}o.writeDoubleLE=nt?rt:ot,o.writeDoubleBE=nt?ot:rt;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],et[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],et[0]}o.readDoubleLE=nt?it:st,o.readDoubleBE=nt?st:it}():function(){function et(nt,rt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)nt(0,st,at+rt),nt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))nt(0,st,at+rt),nt(2146959360,st,at+ot);else if(it>17976931348623157e292)nt(0,st,at+rt),nt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,nt(lt>>>0,st,at+rt),nt((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),nt(lt*4503599627370496>>>0,st,at+rt),nt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}o.writeDoubleLE=et.bind(null,writeUintLE,0,4),o.writeDoubleBE=et.bind(null,writeUintBE,4,0);function tt(nt,rt,ot,it,st){var at=nt(it,st+rt),ct=nt(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)}o.readDoubleLE=tt.bind(null,readUintLE,0,4),o.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeUintBE(o,et,tt){et[tt]=o>>>24,et[tt+1]=o>>>16&255,et[tt+2]=o>>>8&255,et[tt+3]=o&255}function readUintLE(o,et){return(o[et]|o[et+1]<<8|o[et+2]<<16|o[et+3]<<24)>>>0}function readUintBE(o,et){return(o[et]<<24|o[et+1]<<16|o[et+2]<<8|o[et+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(o){}return null}var utf8$2={};(function(o){var et=o;et.length=function(nt){for(var rt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|nt[rt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(nt[rt++]&63)<<12|(nt[rt++]&63)<<6|nt[rt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(nt[rt++]&63)<<6|nt[rt++]&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))},et.write=function(nt,rt,ot){for(var it=ot,st,at,ct=0;ct>6|192,rt[ot++]=st&63|128):(st&64512)===55296&&((at=nt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,rt[ot++]=st>>18|240,rt[ot++]=st>>12&63|128,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128):(rt[ot++]=st>>12|224,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(o,et,tt){var nt=tt||8192,rt=nt>>>1,ot=null,it=nt;return function(at){if(at<1||at>rt)return o(at);it+at>nt&&(ot=o(nt),it=0);var ct=et.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=et;var o=requireMinimal();function et(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=et.zero=new et(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var nt=et.zeroHash="\0\0\0\0\0\0\0\0";et.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 et(at,ct)},et.from=function(it){if(typeof it=="number")return et.fromNumber(it);if(o.isString(it))if(o.Long)it=o.Long.fromString(it);else return et.fromNumber(parseInt(it,10));return it.low||it.high?new et(it.low>>>0,it.high>>>0):tt},et.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},et.prototype.toLong=function(it){return o.Long?new o.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var rt=String.prototype.charCodeAt;return et.fromHash=function(it){return it===nt?tt:new et((rt.call(it,0)|rt.call(it,1)<<8|rt.call(it,2)<<16|rt.call(it,3)<<24)>>>0,(rt.call(it,4)|rt.call(it,5)<<8|rt.call(it,6)<<16|rt.call(it,7)<<24)>>>0)},et.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)},et.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},et.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},et.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(o){var et=o;et.asPromise=aspromise,et.base64=base64$1,et.EventEmitter=eventemitter,et.float=float,et.inquire=inquire_1,et.utf8=utf8$2,et.pool=pool_1,et.LongBits=requireLongbits(),et.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),et.global=et.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,et.emptyArray=Object.freeze?Object.freeze([]):[],et.emptyObject=Object.freeze?Object.freeze({}):{},et.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},et.isString=function(ot){return typeof ot=="string"||ot instanceof String},et.isObject=function(ot){return ot&&typeof ot=="object"},et.isset=et.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},et.Buffer=function(){try{var rt=et.inquire("buffer").Buffer;return rt.prototype.utf8Write?rt:null}catch{return null}}(),et._Buffer_from=null,et._Buffer_allocUnsafe=null,et.newBuffer=function(ot){return typeof ot=="number"?et.Buffer?et._Buffer_allocUnsafe(ot):new et.Array(ot):et.Buffer?et._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},et.Array=typeof Uint8Array<"u"?Uint8Array:Array,et.Long=et.global.dcodeIO&&et.global.dcodeIO.Long||et.global.Long||et.inquire("long"),et.key2Re=/^true|false|0|1$/,et.key32Re=/^-?(?:0|[1-9][0-9]*)$/,et.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,et.longToHash=function(ot){return ot?et.LongBits.from(ot).toHash():et.LongBits.zeroHash},et.longFromHash=function(ot,it){var st=et.LongBits.fromHash(ot);return et.Long?et.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(rt,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]}},et.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}function VarintOp(o,et){this.len=o,this.next=void 0,this.val=et}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(et){return this.len+=(this.tail=this.tail.next=new VarintOp((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this};Writer$1.prototype.int32=function o(et){return et<0?this._push(writeVarint64,10,LongBits$1.fromNumber(et)):this.uint32(et)};Writer$1.prototype.sint32=function o(et){return this.uint32((et<<1^et>>31)>>>0)};function writeVarint64(o,et,tt){for(;o.hi;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}Writer$1.prototype.uint64=function o(et){var tt=LongBits$1.from(et);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(et){var tt=LongBits$1.from(et).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function o(et){return this._push(writeByte,1,et?1:0)};function writeFixed32(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}Writer$1.prototype.fixed32=function o(et){return this._push(writeFixed32,4,et>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(et){var tt=LongBits$1.from(et);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 o(et){return this._push(util$7.float.writeFloatLE,4,et)};Writer$1.prototype.double=function o(et){return this._push(util$7.float.writeDoubleLE,8,et)};var writeBytes=util$7.Array.prototype.set?function o(et,tt,nt){tt.set(et,nt)}:function o(et,tt,nt){for(var rt=0;rt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(et)){var nt=Writer$1.alloc(tt=base64.length(et));base64.decode(et,nt,0),et=nt}return this.uint32(tt)._push(writeBytes,tt,et)};Writer$1.prototype.string=function o(et){var tt=utf8$1.length(et);return tt?this.uint32(tt)._push(utf8$1.write,tt,et):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){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 o(){var et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this};Writer$1.prototype.finish=function o(){for(var et=this.head.next,tt=this.constructor.alloc(this.len),nt=0;et;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt};Writer$1._configure=function(o){BufferWriter$1=o,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(et,tt,nt){tt.set(et,nt)}:function(et,tt,nt){if(et.copy)et.copy(tt,nt,0,et.length);else for(var rt=0;rt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,et),this};function writeStringBuffer(o,et,tt){o.length<40?util$6.utf8.write(o,et,tt):et.utf8Write?et.utf8Write(o,tt):et.write(o,tt)}BufferWriter.prototype.string=function o(et){var tt=util$6.Buffer.byteLength(et);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,et),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(o,et){return RangeError("index out of range: "+o.pos+" + "+(et||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(et){if(et instanceof Uint8Array||Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")}:function o(et){if(Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")},create$1=function o(){return util$5.Buffer?function(tt){return(Reader$1.create=function(rt){return util$5.Buffer.isBuffer(rt)?new BufferReader$1(rt):create_array(rt)})(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 o(){var et=4294967295;return function(){if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return et}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var et=this.uint32();return et>>>1^-(et&1)|0};function readLongVarint(){var o=new LongBits(0,0),et=0;if(this.len-this.pos>4){for(;et<4;++et)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;et=0}else{for(;et<3;++et){if(this.pos>=this.len)throw indexOutOfRange(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(;et<5;++et)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;et<5;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){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 o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,et};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,et};Reader$1.prototype.bytes=function o(){var et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange(this,et);if(this.pos+=et,Array.isArray(this.buf))return this.buf.slice(tt,nt);if(tt===nt){var rt=util$5.Buffer;return rt?rt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,nt)};Reader$1.prototype.string=function o(){var et=this.bytes();return utf8.read(et,0,et.length)};Reader$1.prototype.skip=function o(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(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};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create$1(),BufferReader$1._configure();var et=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[et](!1)},uint64:function(){return readLongVarint.call(this)[et](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[et](!1)},fixed64:function(){return readFixed64.call(this)[et](!0)},sfixed64:function(){return readFixed64.call(this)[et](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var et=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+et,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+et,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(o,et,tt){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!et,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function o(et,tt,nt,rt,ot){if(!rt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(o,it,et,tt,nt,rt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(et,tt[it.requestDelimited?"encodeDelimited":"encode"](rt).finish(),function(at,ct){if(at)return it.emit("error",at,et),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof nt))try{ct=nt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,et),ot(lt)}return it.emit("data",ct,et),ot(null,ct)})}catch(st){it.emit("error",st,et),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function o(et){return this.rpcImpl&&(et||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var et=o;et.Service=service$1})(rpc);var roots={};(function(o){var et=o;et.build="minimal",et.Writer=writer,et.BufferWriter=writer_buffer,et.Reader=reader,et.BufferReader=reader_buffer,et.util=requireMinimal(),et.rpc=rpc,et.roots=roots,et.configure=tt;function tt(){et.util._configure(),et.Writer._configure(et.BufferWriter),et.Reader._configure(et.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(o,et){typeof o=="string"&&(et=o,o=void 0);var tt=[];function nt(ot){if(typeof ot!="string"){var it=rt();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("/")};et.resolve=function(ot,it,st){return st||(it=nt(it)),tt(it)?it:(st||(ot=nt(ot)),(ot=ot.replace(/(?:\/|^)[^/]+$/,"")).length?nt(ot+"/"+it):it)}})(path);var types$2={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(o){var et=o,tt=requireUtil(),nt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function rt(ot,it){var st=0,at={};for(it|=0;st-1&&this.oneof.splice(st,1),it.partOf=null,this},nt.prototype.onAdd=function(it){o.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 pt=0;pt0;){var mt=dt.shift();if(pt.nested&&pt.nested[mt]){if(pt=pt.nested[mt],!(pt instanceof at))throw Error("path conflicts with non-namespace objects")}else pt.add(pt=new at(mt))}return ht&&pt.addJSON(ht),pt},at.prototype.resolveAll=function(){for(var dt=this.nestedArray,ht=0;ht-1)return mt}else if(mt instanceof at&&(mt=mt.lookup(dt.slice(1),ht,!0)))return mt}else for(var ft=0;ft>>3){");for(var st=0;st>>3){")("case 1: k=r.%s(); break",at.keyType)("case 2:"),et.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")("}")("}"),et.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),et.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":mt=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":it("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",ct,ct,mt)('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,mt?"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}et.fromObject=function(st){var at=st.fieldsArray,ct=nt.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}et.toObject=function(st){var at=st.fieldsArray.slice().sort(nt.compareFieldsById);if(!at.length)return nt.codegen()("return {}");for(var ct=nt.codegen(["m","o"],st.name+"$toObject")("if(!o)")("o={}")("var d={}"),lt=[],dt=[],ht=[],pt=0;pt-1){var jt=Rt.substring(Pt);if(jt in st)return jt}return null}function bt(Rt,Pt){try{if(rt.isString(Pt)&&Pt.charAt(0)==="{"&&(Pt=JSON.parse(Pt)),!rt.isString(Pt))yt.setOptions(Pt.options).addJSON(Pt.nested);else{it.filename=Rt;var jt=it(Pt,yt,mt),Ot,Bt=0;if(jt.imports)for(;Bt-1)){if(yt.files.push(Rt),Rt in st){gt?bt(Rt,st[Rt]):(++wt,setTimeout(function(){--wt,bt(Rt,st[Rt])}));return}if(gt){var jt;try{jt=rt.fs.readFileSync(Rt).toString("utf8")}catch(Ot){Pt||xt(Ot);return}bt(Rt,jt)}else++wt,yt.fetch(Rt,function(Ot,Bt){if(--wt,!!ft){if(Ot){Pt?wt||xt(null,yt):xt(Ot);return}bt(Rt,Bt)}})}}var wt=0;rt.isString(pt)&&(pt=[pt]);for(var kt=0,It;kt-1&&this.deferred.splice(mt,1)}}else if(pt instanceof tt)lt.test(pt.name)&&delete pt.parent[pt.name];else if(pt instanceof o){for(var ft=0;ft0)pt[yt]=ht(pt[yt]||{},mt,ft);else{var gt=pt[yt];gt&&(ft=[].concat(gt).concat(ft)),pt[yt]=ft}return pt}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(o,"decorateRoot",{get:function(){return et.decorated||(et.decorated=new(requireRoot()))}}),util$2.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=tt,tt.className="ReflectionObject";var o=requireUtil(),et;function tt(nt,rt){if(!o.isString(nt))throw TypeError("name must be a string");if(rt&&!o.isObject(rt))throw TypeError("options must be an object");this.options=rt,this.parsedOptions=null,this.name=nt,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(tt.prototype,{root:{get:function(){for(var nt=this;nt.parent!==null;)nt=nt.parent;return nt}},fullName:{get:function(){for(var nt=[this.name],rt=this.parent;rt;)nt.unshift(rt.name),rt=rt.parent;return nt.join(".")}}}),tt.prototype.toJSON=function(){throw Error()},tt.prototype.onAdd=function(rt){this.parent&&this.parent!==rt&&this.parent.remove(this),this.parent=rt,this.resolved=!1;var ot=rt.root;ot instanceof et&&ot._handleAdd(this)},tt.prototype.onRemove=function(rt){var ot=rt.root;ot instanceof et&&ot._handleRemove(this),this.parent=null,this.resolved=!1},tt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof et&&(this.resolved=!0),this)},tt.prototype.getOption=function(rt){if(this.options)return this.options[rt]},tt.prototype.setOption=function(rt,ot,it){return(!it||!this.options||this.options[rt]===void 0)&&((this.options||(this.options={}))[rt]=ot),this},tt.prototype.setParsedOption=function(rt,ot,it){this.parsedOptions||(this.parsedOptions=[]);var st=this.parsedOptions;if(it){var at=st.find(function(dt){return Object.prototype.hasOwnProperty.call(dt,rt)});if(at){var ct=at[rt];o.setProperty(ct,it,ot)}else at={},at[rt]=o.setProperty({},it,ot),st.push(at)}else{var lt={};lt[rt]=ot,st.push(lt)}return this},tt.prototype.setOptions=function(rt,ot){if(rt)for(var it=Object.keys(rt),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 rt(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|et.mapKey[lt.keyType],lt.keyType),pt===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|pt,ht,at),it("}")("}")):lt.repeated?(it("if(%s!=null&&%s.length){",at,at),lt.packed&&et.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),pt===void 0?nt(it,lt,dt,at+"[i]"):it("w.uint32(%i).%s(%s[i])",(lt.id<<3|pt)>>>0,ht,at)),it("}")):(lt.optional&&it("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",at,lt.name),pt===void 0?nt(it,lt,dt,at):it("w.uint32(%i).%s(%s)",(lt.id<<3|pt)>>>0,ht,at))}return it("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(o,et,tt){return typeof et=="function"?(tt=et,et=new protobuf$2.Root):et||(et=new protobuf$2.Root),et.load(o,tt)}protobuf$2.load=load;function loadSync(o,et){return et||(et=new protobuf$2.Root),et.loadSync(o)}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:` -`,t:" "};function unescape$1(o){return o.replace(unescapeRe,function(et,tt){switch(tt){case"\\":case"":return tt;default:return unescapeMap[tt]||""}})}tokenize$1.unescape=unescape$1;function tokenize$1(o,et){o=o.toString();var tt=0,nt=o.length,rt=1,ot=0,it={},st=[],at=null;function ct(bt){return Error("illegal "+bt+" (line "+rt+")")}function lt(){var bt=at==="'"?stringSingleRe:stringDoubleRe;bt.lastIndex=tt-1;var Et=bt.exec(o);if(!Et)throw ct("string");return tt=bt.lastIndex,yt(at),at=null,unescape$1(Et[1])}function dt(bt){return o.charAt(bt)}function ht(bt,Et,wt){var kt={type:o.charAt(bt++),lineEmpty:!1,leading:wt},It;et?It=2:It=3;var Rt=bt-It,Pt;do if(--Rt<0||(Pt=o.charAt(Rt))===` -`){kt.lineEmpty=!0;break}while(Pt===" "||Pt===" ");for(var jt=o.substring(bt,Et).split(setCommentSplitRe),Ot=0;Ot0)return st.shift();if(at)return lt();var bt,Et,wt,kt,It,Rt=tt===0;do{if(tt===nt)return null;for(bt=!1;whitespaceRe.test(wt=dt(tt));)if(wt===` -`&&(Rt=!0,++rt),++tt===nt)return null;if(dt(tt)==="/"){if(++tt===nt)throw ct("comment");if(dt(tt)==="/")if(et){if(kt=tt,It=!1,pt(tt-1)){It=!0;do if(tt=mt(tt),tt===nt||(tt++,!Rt))break;while(pt(tt))}else tt=Math.min(nt,mt(tt)+1);It&&(ht(kt,tt,Rt),Rt=!0),rt++,bt=!0}else{for(It=dt(kt=tt+1)==="/";dt(++tt)!==` +}`}return nt.toString=rt,nt}codegen.verbose=!1;var fetch_1=fetch$1,asPromise=aspromise,inquire=inquire_1,fs=inquire("fs");function fetch$1(o,et,tt){return typeof et=="function"?(tt=et,et={}):et||(et={}),tt?!et.xhr&&fs&&fs.readFile?fs.readFile(o,function(rt,ot){return rt&&typeof XMLHttpRequest<"u"?fetch$1.xhr(o,et,tt):rt?tt(rt):tt(null,et.binary?ot:ot.toString("utf8"))}):fetch$1.xhr(o,et,tt):asPromise(fetch$1,this,o,et)}fetch$1.xhr=function o(et,tt,nt){var rt=new XMLHttpRequest;rt.onreadystatechange=function(){if(rt.readyState===4){if(rt.status!==0&&rt.status!==200)return nt(Error("status "+rt.status));if(tt.binary){var it=rt.response;if(!it){it=[];for(var st=0;st0&&it[ct-1]!==".."?it.splice(--ct,2):st?it.splice(ct,1):++ct:it[ct]==="."?it.splice(ct,1):++ct;return at+it.join("/")};et.resolve=function(ot,it,st){return st||(it=nt(it)),tt(it)?it:(st||(ot=nt(ot)),(ot=ot.replace(/(?:\/|^)[^/]+$/,"")).length?nt(ot+"/"+it):it)}})(path);var types$2={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(o){var et=o,tt=requireUtil(),nt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function rt(ot,it){var st=0,at={};for(it|=0;st-1&&this.oneof.splice(st,1),it.partOf=null,this},nt.prototype.onAdd=function(it){o.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 ft=0;ft0;){var mt=dt.shift();if(ft.nested&&ft.nested[mt]){if(ft=ft.nested[mt],!(ft instanceof at))throw Error("path conflicts with non-namespace objects")}else ft.add(ft=new at(mt))}return ht&&ft.addJSON(ht),ft},at.prototype.resolveAll=function(){for(var dt=this.nestedArray,ht=0;ht-1)return mt}else if(mt instanceof at&&(mt=mt.lookup(dt.slice(1),ht,!0)))return mt}else for(var pt=0;pt>>3){");for(var st=0;st>>3){")("case 1: k=r.%s(); break",at.keyType)("case 2:"),et.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")("}")("}"),et.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),et.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":mt=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":it("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",ct,ct,mt)('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,mt?"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}et.fromObject=function(st){var at=st.fieldsArray,ct=nt.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}et.toObject=function(st){var at=st.fieldsArray.slice().sort(nt.compareFieldsById);if(!at.length)return nt.codegen()("return {}");for(var ct=nt.codegen(["m","o"],st.name+"$toObject")("if(!o)")("o={}")("var d={}"),lt=[],dt=[],ht=[],ft=0;ft-1){var Nt=Rt.substring($t);if(Nt in st)return Nt}return null}function bt(Rt,$t){try{if(rt.isString($t)&&$t.charAt(0)==="{"&&($t=JSON.parse($t)),!rt.isString($t))yt.setOptions($t.options).addJSON($t.nested);else{it.filename=Rt;var Nt=it($t,yt,mt),Mt,Bt=0;if(Nt.imports)for(;Bt-1)){if(yt.files.push(Rt),Rt in st){gt?bt(Rt,st[Rt]):(++wt,setTimeout(function(){--wt,bt(Rt,st[Rt])}));return}if(gt){var Nt;try{Nt=rt.fs.readFileSync(Rt).toString("utf8")}catch(Mt){$t||xt(Mt);return}bt(Rt,Nt)}else++wt,yt.fetch(Rt,function(Mt,Bt){if(--wt,!!pt){if(Mt){$t?wt||xt(null,yt):xt(Mt);return}bt(Rt,Bt)}})}}var wt=0;rt.isString(ft)&&(ft=[ft]);for(var kt=0,It;kt-1&&this.deferred.splice(mt,1)}}else if(ft instanceof tt)lt.test(ft.name)&&delete ft.parent[ft.name];else if(ft instanceof o){for(var pt=0;pt0)ft[yt]=ht(ft[yt]||{},mt,pt);else{var gt=ft[yt];gt&&(pt=[].concat(gt).concat(pt)),ft[yt]=pt}return ft}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(o,"decorateRoot",{get:function(){return et.decorated||(et.decorated=new(requireRoot()))}}),util$2.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=tt,tt.className="ReflectionObject";var o=requireUtil(),et;function tt(nt,rt){if(!o.isString(nt))throw TypeError("name must be a string");if(rt&&!o.isObject(rt))throw TypeError("options must be an object");this.options=rt,this.parsedOptions=null,this.name=nt,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(tt.prototype,{root:{get:function(){for(var nt=this;nt.parent!==null;)nt=nt.parent;return nt}},fullName:{get:function(){for(var nt=[this.name],rt=this.parent;rt;)nt.unshift(rt.name),rt=rt.parent;return nt.join(".")}}}),tt.prototype.toJSON=function(){throw Error()},tt.prototype.onAdd=function(rt){this.parent&&this.parent!==rt&&this.parent.remove(this),this.parent=rt,this.resolved=!1;var ot=rt.root;ot instanceof et&&ot._handleAdd(this)},tt.prototype.onRemove=function(rt){var ot=rt.root;ot instanceof et&&ot._handleRemove(this),this.parent=null,this.resolved=!1},tt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof et&&(this.resolved=!0),this)},tt.prototype.getOption=function(rt){if(this.options)return this.options[rt]},tt.prototype.setOption=function(rt,ot,it){return(!it||!this.options||this.options[rt]===void 0)&&((this.options||(this.options={}))[rt]=ot),this},tt.prototype.setParsedOption=function(rt,ot,it){this.parsedOptions||(this.parsedOptions=[]);var st=this.parsedOptions;if(it){var at=st.find(function(dt){return Object.prototype.hasOwnProperty.call(dt,rt)});if(at){var ct=at[rt];o.setProperty(ct,it,ot)}else at={},at[rt]=o.setProperty({},it,ot),st.push(at)}else{var lt={};lt[rt]=ot,st.push(lt)}return this},tt.prototype.setOptions=function(rt,ot){if(rt)for(var it=Object.keys(rt),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 rt(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|et.mapKey[lt.keyType],lt.keyType),ft===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|ft,ht,at),it("}")("}")):lt.repeated?(it("if(%s!=null&&%s.length){",at,at),lt.packed&&et.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),ft===void 0?nt(it,lt,dt,at+"[i]"):it("w.uint32(%i).%s(%s[i])",(lt.id<<3|ft)>>>0,ht,at)),it("}")):(lt.optional&&it("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",at,lt.name),ft===void 0?nt(it,lt,dt,at):it("w.uint32(%i).%s(%s)",(lt.id<<3|ft)>>>0,ht,at))}return it("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(o,et,tt){return typeof et=="function"?(tt=et,et=new protobuf$2.Root):et||(et=new protobuf$2.Root),et.load(o,tt)}protobuf$2.load=load;function loadSync(o,et){return et||(et=new protobuf$2.Root),et.loadSync(o)}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:` +`,t:" "};function unescape$1(o){return o.replace(unescapeRe,function(et,tt){switch(tt){case"\\":case"":return tt;default:return unescapeMap[tt]||""}})}tokenize$1.unescape=unescape$1;function tokenize$1(o,et){o=o.toString();var tt=0,nt=o.length,rt=1,ot=0,it={},st=[],at=null;function ct(bt){return Error("illegal "+bt+" (line "+rt+")")}function lt(){var bt=at==="'"?stringSingleRe:stringDoubleRe;bt.lastIndex=tt-1;var Et=bt.exec(o);if(!Et)throw ct("string");return tt=bt.lastIndex,yt(at),at=null,unescape$1(Et[1])}function dt(bt){return o.charAt(bt)}function ht(bt,Et,wt){var kt={type:o.charAt(bt++),lineEmpty:!1,leading:wt},It;et?It=2:It=3;var Rt=bt-It,$t;do if(--Rt<0||($t=o.charAt(Rt))===` +`){kt.lineEmpty=!0;break}while($t===" "||$t===" ");for(var Nt=o.substring(bt,Et).split(setCommentSplitRe),Mt=0;Mt0)return st.shift();if(at)return lt();var bt,Et,wt,kt,It,Rt=tt===0;do{if(tt===nt)return null;for(bt=!1;whitespaceRe.test(wt=dt(tt));)if(wt===` +`&&(Rt=!0,++rt),++tt===nt)return null;if(dt(tt)==="/"){if(++tt===nt)throw ct("comment");if(dt(tt)==="/")if(et){if(kt=tt,It=!1,ft(tt-1)){It=!0;do if(tt=mt(tt),tt===nt||(tt++,!Rt))break;while(ft(tt))}else tt=Math.min(nt,mt(tt)+1);It&&(ht(kt,tt,Rt),Rt=!0),rt++,bt=!0}else{for(It=dt(kt=tt+1)==="/";dt(++tt)!==` `;)if(tt===nt)return null;++tt,It&&(ht(kt,tt-1,Rt),Rt=!0),++rt,bt=!0}else if((wt=dt(tt))==="*"){kt=tt+1,It=et||dt(kt)==="*";do{if(wt===` -`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,It&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var Pt=tt;delimRe.lastIndex=0;var jt=delimRe.test(dt(Pt++));if(!jt)for(;Pt");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,_t);Ot(Vt,function(an){if(an==="option")Lt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new OneOf(gt(tn));Ot(_t,function(Vt){Vt==="option"?(Lt(_t,Vt),at(";")):(it(Vt),zt(_t,"optional"))}),Jt.add(_t)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new Enum(tn);Ot(_t,function(Vt){switch(Vt){case"option":Lt(_t,Vt),at(";");break;case"reserved":Et(_t.reserved||(_t.reserved=[]),!0);break;default:qt(_t,Vt)}}),Jt.add(_t)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var _t=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Ot(Dt,function(en){if(en==="option")Lt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,_t,Dt.comment,Dt.options)}function Lt(Jt,tn){var _t=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;_t&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Nt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var _t={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=_t[Vt];an&&(Dt=[].concat(an).concat(Dt)),_t[Vt]=Dt,at(",",!0),at(";",!0)}return _t}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,_t){Jt.setOption&&Jt.setOption(tn,_t)}function Nt(Jt,tn,_t,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,_t,Dt)}function Gt(Jt){if(at("[",!0)){do Lt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var _t=new Service(tn);Ot(_t,function(Vt){if(!jt(_t,Vt))if(Vt==="rpc")Wt(_t,Vt);else throw xt(Vt)}),Jt.add(_t)}function Wt(Jt,tn){var _t=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var pn=new Method(Vt,Dt,en,dn,an,ln);pn.comment=_t,Ot(pn,function(mn){if(mn==="option")Lt(pn,mn),at(";");else throw xt(mn)}),Jt.add(pn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var _t=tn;Ot(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,_t);break;case"optional":ft?zt(Jt,"proto3_optional",_t):zt(Jt,"optional",_t);break;default:if(!ft||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",_t);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);It();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);Pt();break;case"option":Lt(yt,Xt),at(";");break;default:if(jt(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:pt,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}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 o(et){return common[et]||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),WAKU_NODE_OPTIONS={defaultBootstrap:!0,nodeToUse:{store:"/dns4/boot-01.do-ams3.status.staging.status.im/tcp/443/wss/p2p/16Uiu2HAmEqqio4UR1SWqAc7KY19t6qyDvtmyjreZpzUBJvb4u65R"}},contentTopic="/buddybook-devcon/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:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){console.time("getMessagesFromStore");try{for await(const et of o.store.queryGenerator([decoder])){const tt=await Promise.all(et);for(const nt of tt){if(!(nt!=null&&nt.payload))continue;const rt=block.decode(nt.payload);rt.signatures=rt.signatures.map(ot=>JSON.parse(ot)),yield rt}}}finally{console.timeEnd("getMessagesFromStore")}}async function subscribeToFilter(o,et){const{error:tt,subscription:nt,results:rt}=await o.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)),et(it)}});if(console.log("results",rt),tt&&console.log("Error subscribing to filter",tt),!nt||tt||rt.successes.length===0||rt.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];if(rt)return/iPad|iPhone|iPod/.test(navigator.userAgent)&&(window.location.href="metamask:///",await new Promise(it=>setTimeout(it,1e3))),await et({connector:rt}),await new Promise(it=>setTimeout(it,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),typeof window.ethereum>"u"&&window.open("https://metamask.io/download/","_blank"),!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[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,pt]=reactExports.useState(null),[mt,ft]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;pt(Rt);const Pt=v4();ft(Pt);const jt=createMessage({chainUUID:o.uuid,blockUUID:Pt,title:o.title,description:o.description,signedMessage:Rt,timestamp:Date.now(),signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});await(yt==null?void 0:yt.lightPush.send(encoder,jt)),ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:Pt,value:jt}=Rt.target;et(Ot=>({...Ot,[Pt]:jt})),tt[Pt]&&nt(Ot=>({...Ot,[Pt]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Chain: - Chain UUID: ${o.uuid} +`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,It&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var $t=tt;delimRe.lastIndex=0;var Nt=delimRe.test(dt($t++));if(!Nt)for(;$t");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,Tt);Mt(Vt,function(an){if(an==="option")Pt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new OneOf(gt(tn));Mt(Tt,function(Vt){Vt==="option"?(Pt(Tt,Vt),at(";")):(it(Vt),zt(Tt,"optional"))}),Jt.add(Tt)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new Enum(tn);Mt(Tt,function(Vt){switch(Vt){case"option":Pt(Tt,Vt),at(";");break;case"reserved":Et(Tt.reserved||(Tt.reserved=[]),!0);break;default:qt(Tt,Vt)}}),Jt.add(Tt)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var Tt=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Mt(Dt,function(en){if(en==="option")Pt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,Tt,Dt.comment,Dt.options)}function Pt(Jt,tn){var Tt=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;Tt&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Lt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var Tt={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=Tt[Vt];an&&(Dt=[].concat(an).concat(Dt)),Tt[Vt]=Dt,at(",",!0),at(";",!0)}return Tt}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,Tt){Jt.setOption&&Jt.setOption(tn,Tt)}function Lt(Jt,tn,Tt,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,Tt,Dt)}function Gt(Jt){if(at("[",!0)){do Pt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var Tt=new Service(tn);Mt(Tt,function(Vt){if(!Nt(Tt,Vt))if(Vt==="rpc")Wt(Tt,Vt);else throw xt(Vt)}),Jt.add(Tt)}function Wt(Jt,tn){var Tt=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var fn=new Method(Vt,Dt,en,dn,an,ln);fn.comment=Tt,Mt(fn,function(mn){if(mn==="option")Pt(fn,mn),at(";");else throw xt(mn)}),Jt.add(fn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var Tt=tn;Mt(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,Tt);break;case"optional":pt?zt(Jt,"proto3_optional",Tt):zt(Jt,"optional",Tt);break;default:if(!pt||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",Tt);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);It();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);$t();break;case"option":Pt(yt,Xt),at(";");break;default:if(Nt(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:ft,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}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 o(et){return common[et]||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);var TelemetryType=(o=>(o.LIGHT_PUSH_FILTER="LightPushFilter",o))(TelemetryType||{});class TelemetryClient{constructor(et,tt=5e3){Ct(this,"queue",[]);Ct(this,"intervalId",null);Ct(this,"requestId",0);this.url=et,this.intervalPeriod=tt,this.start()}push(et){this.queue.push(...et)}async start(){this.intervalId||(this.intervalId=setInterval(async()=>{this.queue.length>0&&await this.send(this.queue)&&(console.log("Sent ",this.queue.length," telemetry logs"),this.queue=[])},this.intervalPeriod))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}async send(et){const tt=localStorage.getItem("telemetryOptIn");if(!tt||tt==="false"||tt!=="true"||!window.location.hostname.includes("buddybook.fun"))return;const nt=et.map(rt=>({id:++this.requestId,telemetryType:rt.type.toString(),telemetryData:rt}));try{const rt=await fetch(this.url,{method:"POST",body:JSON.stringify(nt)});return rt.status!==201?(console.log("DEBUG: Error sending messages to telemetry service: ",rt.status,rt.statusText,rt.json),!1):!0}catch(rt){return console.log("DEBUG: Error sending messages to telemetry service",rt),!1}}}const Telemetry=new TelemetryClient("https://telemetry.status.im/waku-metrics",5e3),buildExtraData=({wallet:o,bookId:et,timeTaken:tt})=>JSON.stringify({sdk:"@waku/react:0.0.7-9a7287d",wallet:o,bookId:et,timeTaken:tt}),fromLightPush=o=>{var tt,nt,rt,ot;const et=[];return(nt=(tt=o.result)==null?void 0:tt.successes)==null||nt.forEach(it=>{et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:it.toString(),contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({bookId:o.bookId,wallet:o.wallet})})}),(ot=(rt=o.result)==null?void 0:rt.failures)==null||ot.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"missing",contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:o.encoder.ephemeral,messageHash:v4(),errorMessage:it.error.toString(),extraData:buildExtraData({wallet:o.wallet,bookId:o.bookId})})}),et},fromFilter=o=>{var rt,ot;const et=[],{error:tt,results:nt}=o.result;return tt&&et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:tt,extraData:buildExtraData({})}),(rt=nt==null?void 0:nt.failures)==null||rt.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"",contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:(it==null?void 0:it.error)||"Unknown error",extraData:buildExtraData({})})}),(ot=nt==null?void 0:nt.successes)==null||ot.forEach(it=>{et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:it.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({})})}),et},fromStore=o=>[{type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({timeTaken:o.timeTaken})}];function toInt$1(o){return parseInt(o)}const WAKU_NODE_OPTIONS={defaultBootstrap:!0,nodeToUse:{store:"/dns4/node-01.ac-cn-hongkong-c.waku.test.status.im/tcp/8000/wss/p2p/16Uiu2HAkzHaTP5JsUwfR9NR8Rj9HC24puS6ocaU8wze4QrXr9iXp"}},contentTopic="/buddybook-devcon/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:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){const et=performance.now();try{for await(const rt of o.store.queryGenerator([decoder])){const ot=await Promise.all(rt);for(const it of ot){if(console.log(it),!(it!=null&&it.payload))continue;const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),yield st}}const nt=performance.now()-et;console.log("getMessagesFromStore",nt),Telemetry.push(fromStore({node:o,decoder,timestamp:et,timeTaken:nt}))}catch(tt){const rt=performance.now()-et;throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:toInt$1(et),createdAt:toInt$1(et),seenTimestamp:toInt$1(et),peerId:o.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(tt==null?void 0:tt.message)??"Error during Store",extraData:buildExtraData({timeTaken:rt})}]),tt}}async function subscribeToFilter(o,et){const tt=await o.filter.subscribe([decoder],it=>{if(console.log("message received from filter",it),it.payload){const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),et(st)}},{forceUseAllPeers:!1});Telemetry.push(fromFilter({result:tt,node:o,decoder,timestamp:Date.now()}));const{error:nt,subscription:rt,results:ot}=tt;if(console.log("results",ot),nt&&console.log("Error subscribing to filter",nt),!rt||nt||ot.successes.length===0||ot.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];if(rt)return/iPad|iPhone|iPod/.test(navigator.userAgent)&&(window.location.href="metamask:///",await new Promise(it=>setTimeout(it,1e3))),await et({connector:rt}),await new Promise(it=>setTimeout(it,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),typeof window.ethereum>"u"&&window.open("https://metamask.io/download/","_blank"),!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[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,ft]=reactExports.useState(null),[mt,pt]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;ft(Rt);const $t=v4();pt($t);const Nt=Date.now(),Mt=createMessage({chainUUID:o.uuid,blockUUID:$t,title:o.title,description:o.description,signedMessage:Rt,timestamp:Nt,signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});try{const Bt=await(yt==null?void 0:yt.lightPush.send(encoder,Mt));Telemetry.push(fromLightPush({result:Bt,wallet:gt,bookId:o.uuid,node:yt,encoder,timestamp:Nt}))}catch(Bt){throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:toInt$1(Nt),createdAt:toInt$1(Nt),seenTimestamp:toInt$1(Nt),peerId:yt.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(Bt==null?void 0:Bt.message)??"Error during LightPush",extraData:buildExtraData({wallet:gt,bookId:o.uuid})}]),Bt}ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:$t,value:Nt}=Rt.target;et(Mt=>({...Mt,[$t]:Nt})),tt[$t]&&nt(Mt=>({...Mt,[$t]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Book: + Book UUID: ${o.uuid} Title: ${o.title} Description: ${o.description} Timestamp: ${new Date().getTime()} - Signed by: ${gt}`;xt({message:Rt})},It=()=>{ot(!1),ct(!1),st(!1),dt(null),ft(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:wt,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:o.title,onChange:bt,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:o.description,onChange:bt,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:rt,onOpenChange:It,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Chain Created":"Chain Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&mt&&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/${o.uuid}/${mt}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/sign/${o.uuid}/${mt}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/sign/${o.uuid}/${mt}`),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:o.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:o.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:It,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:kt,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:o,chainsData:et,onSuccess:tt})=>{const[nt,rt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),{address:pt}=useAccount(),{data:mt}=useEnsName({address:pt}),{node:ft}=useWaku(),{ensureWalletConnected:yt}=useWalletPrompt(),gt=(wt,kt)=>{var Rt;if(kt.has(wt.blockUUID))return!1;if(kt.add(wt.blockUUID),(Rt=wt.signatures)!=null&&Rt.some(Pt=>{var jt;return((jt=Pt==null?void 0:Pt.address)==null?void 0:jt.toLowerCase())===(pt==null?void 0:pt.toLowerCase())}))return!0;const It=et.find(Pt=>Pt.blockUUID===wt.parentBlockUUID);return It&>(It,kt)?!0:et.filter(Pt=>Pt.parentBlockUUID===wt.blockUUID).some(Pt=>gt(Pt,kt))};reactExports.useEffect(()=>{if(pt)try{lt(gt(o,new Set))}catch(wt){console.error("Error in signature check:",wt),lt(!1)}},[pt,o,et]);const{signMessage:xt}=useSignMessage({mutation:{onMutate(){at(null),it(!0)},async onSuccess(wt){if(!(!pt||!ft))try{if(o.signatures.some(jt=>jt.address.toLowerCase()===pt.toLowerCase())){at("You have already signed this chain.");return}const kt={chainUUID:o.chainUUID,blockUUID:v4(),title:o.title,description:o.description,signedMessage:wt,timestamp:Date.now(),signatures:[{address:pt,signature:wt}],parentBlockUUID:o.blockUUID},It=createMessage(kt),{failures:Rt,successes:Pt}=await ft.lightPush.send(encoder,It);if(Rt.length>0||Pt.length===0)throw new Error("Failed to send message to Waku network");tt(kt),rt(!1)}catch(kt){console.error("Error creating new block:",kt),at("Failed to create new block. Please try again.")}},onError(wt){console.error("Error signing message:",wt),at("Error signing message. Please try again. If using a mobile wallet, please ensure your wallet app is open.")},onSettled(){it(!1)}}}),vt=async()=>{try{if(!pt&&(ht(!0),!await yt())){at("Please ensure your wallet is connected and the app is open.");return}if(ct){at("You have already signed this chain.");return}if(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)&&typeof window.ethereum>"u"){at("Please ensure your wallet app is installed and open before signing."),window.location.href="metamask:///";return}const kt=["Sign Block:",`Chain UUID: ${o.chainUUID}`,`Block UUID: ${o.blockUUID}`,`Title: ${o.title}`,`Description: ${o.description}`,`Timestamp: ${new Date().getTime()}`,`Parent Block UUID: ${o.parentBlockUUID}`,`Signed by: ${mt||pt}`].join(` -`);xt({message:kt})}catch(wt){console.error("Error in sign flow:",wt),at("Failed to initiate signing. Please ensure your wallet app is open and try again."),it(!1)}finally{ht(!1)}},bt=()=>ot?"Signing...":dt?"Connecting...":ct?"Already Signed":pt?"Sign":"Connect Wallet",Et=ot||dt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>rt(!0),disabled:ct,children:ct?"Already Signed":pt?"Sign Chain":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:rt,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:o.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.chainUUID}/${o.blockUUID}`})]}),(st||dt)&&jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),dt&&jsxRuntimeExports.jsxs("div",{className:"rounded-md bg-blue-50 p-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-blue-700",children:"Attempting to connect to your wallet..."}),jsxRuntimeExports.jsx("p",{className:"text-xs text-blue-600 mt-1",children:"If your wallet doesn't open automatically, please open it manually to approve the connection."})]})]}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>rt(!1),children:"Cancel"}),jsxRuntimeExports.jsxs(Button,{onClick:vt,disabled:ot||ct||dt,children:[Et&&jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),bt()]})]})]})})]})},ChainList=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const nt=it=>{et(it)},rt=(it,st=0)=>{const at=o.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("div",{className:"flex flex-col space-y-2 mt-2",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Created by"})}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:o,onSuccess:nt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"flex flex-col gap-4",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this chain with others to collect their signatures."})]}),jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center gap-4",children:jsxRuntimeExports.jsx(QRCode,{text:lt,width:180,height:180,showCopyButton:"text",title:it.title,description:`Sign this chain: ${it.title}`})})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx("p",{className:"text-sm",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Signed by"})})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>rt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=o.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=>rt(it,0))})})]})},SignerName=({address:o,prefix:et})=>{const{data:tt}=useEnsName({address:o});return jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[et&&`${et}: `,tt||`${o.slice(0,6)}...${o.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(o){const et=reactExports.useContext(DirectionContext);return o||et||"ltr"}function clamp(o,[et,tt]){return Math.min(tt,Math.max(et,o))}function useStateMachine(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,type:nt="hover",dir:rt,scrollHideDelay:ot=600,...it}=o,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[pt,mt]=reactExports.useState(null),[ft,yt]=reactExports.useState(null),[gt,xt]=reactExports.useState(0),[vt,bt]=reactExports.useState(0),[Et,wt]=reactExports.useState(!1),[kt,It]=reactExports.useState(!1),Rt=useComposedRefs(et,jt=>at(jt)),Pt=useDirection(rt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:nt,dir:Pt,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:pt,onScrollbarXChange:mt,scrollbarXEnabled:Et,onScrollbarXEnabledChange:wt,scrollbarY:ft,onScrollbarYChange:yt,scrollbarYEnabled:kt,onScrollbarYEnabledChange:It,onCornerWidthChange:xt,onCornerHeightChange:bt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:Pt,...it,ref:Rt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":vt+"px",...o.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,children:nt,asChild:rt,nonce:ot,...it}=o,st=useScrollAreaContext(VIEWPORT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,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; - -webkit-overflow-scrolling: touch; -} -[data-radix-scroll-area-viewport]::-webkit-scrollbar { - display: none; -} -:where([data-radix-scroll-area-viewport]) { - display: flex; - flex-direction: column; - align-items: stretch; -} -:where([data-radix-scroll-area-content]) { - flex-grow: 1; -} -`},nonce:ot}),jsxRuntimeExports.jsx(Primitive.div,{"data-radix-scroll-area-viewport":"",...it,asChild:rt,ref:ct,style:{overflowX:st.scrollbarXEnabled?"scroll":"hidden",overflowY:st.scrollbarYEnabled?"scroll":"hidden",...o.style},children:getSubtree({asChild:rt,children:nt},lt=>jsxRuntimeExports.jsx("div",{"data-radix-scroll-area-content":"",ref:st.onContentChange,style:{minWidth:st.scrollbarXEnabled?"fit-content":void 0},children:lt}))})]})});ScrollAreaViewport.displayName=VIEWPORT_NAME;var SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{onScrollbarXEnabledChange:ot,onScrollbarYEnabledChange:it}=rt,st=o.orientation==="horizontal";return reactExports.useEffect(()=>(st?ot(!0):it(!0),()=>{st?ot(!1):it(!1)}),[st,ot,it]),rt.type==="hover"?jsxRuntimeExports.jsx(ScrollAreaScrollbarHover,{...nt,ref:et,forceMount:tt}):rt.type==="scroll"?jsxRuntimeExports.jsx(ScrollAreaScrollbarScroll,{...nt,ref:et,forceMount:tt}):rt.type==="auto"?jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{...nt,ref:et,forceMount:tt}):rt.type==="always"?jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{...nt,ref:et}):null});ScrollAreaScrollbar.displayName=SCROLLBAR_NAME;var ScrollAreaScrollbarHover=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[ot,it]=reactExports.useState(!1);return reactExports.useEffect(()=>{const st=rt.scrollArea;let at=0;if(st){const ct=()=>{window.clearTimeout(at),it(!0)},lt=()=>{at=window.setTimeout(()=>it(!1),rt.scrollHideDelay)};return st.addEventListener("pointerenter",ct),st.addEventListener("pointerleave",lt),()=>{window.clearTimeout(at),st.removeEventListener("pointerenter",ct),st.removeEventListener("pointerleave",lt)}}},[rt.scrollArea,rt.scrollHideDelay]),jsxRuntimeExports.jsx(Presence,{present:tt||ot,children:jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{"data-state":ot?"visible":"hidden",...nt,ref:et})})}),ScrollAreaScrollbarScroll=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=o.orientation==="horizontal",it=useDebounceCallback(()=>at("SCROLL_END"),100),[st,at]=useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return reactExports.useEffect(()=>{if(st==="idle"){const ct=window.setTimeout(()=>at("HIDE"),rt.scrollHideDelay);return()=>window.clearTimeout(ct)}},[st,rt.scrollHideDelay,at]),reactExports.useEffect(()=>{const ct=rt.viewport,lt=ot?"scrollLeft":"scrollTop";if(ct){let dt=ct[lt];const ht=()=>{const pt=ct[lt];dt!==pt&&(at("SCROLL"),it()),dt=pt};return ct.addEventListener("scroll",ht),()=>ct.removeEventListener("scroll",ht)}},[rt.viewport,ot,at,it]),jsxRuntimeExports.jsx(Presence,{present:tt||st!=="hidden",children:jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{"data-state":st==="hidden"?"hidden":"visible",...nt,ref:et,onPointerEnter:composeEventHandlers(o.onPointerEnter,()=>at("POINTER_ENTER")),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>at("POINTER_LEAVE"))})})}),ScrollAreaScrollbarAuto=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{forceMount:nt,...rt}=o,[ot,it]=reactExports.useState(!1),st=o.orientation==="horizontal",at=useDebounceCallback(()=>{if(tt.viewport){const ct=tt.viewport.offsetWidth{const{orientation:tt="vertical",...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=reactExports.useRef(null),it=reactExports.useRef(0),[st,at]=reactExports.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),ct=getThumbRatio(st.viewport,st.content),lt={...nt,sizes:st,onSizesChange:at,hasThumb:ct>0&&ct<1,onThumbChange:ht=>ot.current=ht,onThumbPointerUp:()=>it.current=0,onThumbPointerDown:ht=>it.current=ht};function dt(ht,pt){return getScrollPositionFromPointer(ht,it.current,st,pt)}return tt==="horizontal"?jsxRuntimeExports.jsx(ScrollAreaScrollbarX,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollLeft,pt=getThumbOffsetFromScroll(ht,st,rt.dir);ot.current.style.transform=`translate3d(${pt}px, 0, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=dt(ht,rt.dir))}}):tt==="vertical"?jsxRuntimeExports.jsx(ScrollAreaScrollbarY,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollTop,pt=getThumbOffsetFromScroll(ht,st);ot.current.style.transform=`translate3d(0, ${pt}px, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=dt(ht))}}):null}),ScrollAreaScrollbarX=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarXChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...rt,ref:ct,sizes:tt,style:{bottom:0,left:ot.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:ot.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.x),onDragScroll:lt=>o.onDragScroll(lt.x),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollLeft+lt.deltaX;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollWidth,viewport:ot.viewport.offsetWidth,scrollbar:{size:at.current.clientWidth,paddingStart:toInt(it.paddingLeft),paddingEnd:toInt(it.paddingRight)}})}})}),ScrollAreaScrollbarY=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarYChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...rt,ref:ct,sizes:tt,style:{top:0,right:ot.dir==="ltr"?0:void 0,left:ot.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.y),onDragScroll:lt=>o.onDragScroll(lt.y),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollTop+lt.deltaY;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollHeight,viewport:ot.viewport.offsetHeight,scrollbar:{size:at.current.clientHeight,paddingStart:toInt(it.paddingTop),paddingEnd:toInt(it.paddingBottom)}})}})}),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,sizes:nt,hasThumb:rt,onThumbChange:ot,onThumbPointerUp:it,onThumbPointerDown:st,onThumbPositionChange:at,onDragScroll:ct,onWheelScroll:lt,onResize:dt,...ht}=o,pt=useScrollAreaContext(SCROLLBAR_NAME,tt),[mt,ft]=reactExports.useState(null),yt=useComposedRefs(et,Rt=>ft(Rt)),gt=reactExports.useRef(null),xt=reactExports.useRef(""),vt=pt.viewport,bt=nt.content-nt.viewport,Et=useCallbackRef$1(lt),wt=useCallbackRef$1(at),kt=useDebounceCallback(dt,10);function It(Rt){if(gt.current){const Pt=Rt.clientX-gt.current.left,jt=Rt.clientY-gt.current.top;ct({x:Pt,y:jt})}}return reactExports.useEffect(()=>{const Rt=Pt=>{const jt=Pt.target;(mt==null?void 0:mt.contains(jt))&&Et(Pt,bt)};return document.addEventListener("wheel",Rt,{passive:!1}),()=>document.removeEventListener("wheel",Rt,{passive:!1})},[vt,mt,bt,Et]),reactExports.useEffect(wt,[nt,wt]),useResizeObserver(mt,kt),useResizeObserver(pt.content,kt),jsxRuntimeExports.jsx(ScrollbarProvider,{scope:tt,scrollbar:mt,hasThumb:rt,onThumbChange:useCallbackRef$1(ot),onThumbPointerUp:useCallbackRef$1(it),onThumbPositionChange:wt,onThumbPointerDown:useCallbackRef$1(st),children:jsxRuntimeExports.jsx(Primitive.div,{...ht,ref:yt,style:{position:"absolute",...ht.style},onPointerDown:composeEventHandlers(o.onPointerDown,Rt=>{Rt.button===0&&(Rt.target.setPointerCapture(Rt.pointerId),gt.current=mt.getBoundingClientRect(),xt.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",pt.viewport&&(pt.viewport.style.scrollBehavior="auto"),It(Rt))}),onPointerMove:composeEventHandlers(o.onPointerMove,It),onPointerUp:composeEventHandlers(o.onPointerUp,Rt=>{const Pt=Rt.target;Pt.hasPointerCapture(Rt.pointerId)&&Pt.releasePointerCapture(Rt.pointerId),document.body.style.webkitUserSelect=xt.current,pt.viewport&&(pt.viewport.style.scrollBehavior=""),gt.current=null})})})}),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollbarContext(THUMB_NAME,o.__scopeScrollArea);return jsxRuntimeExports.jsx(Presence,{present:tt||rt.hasThumb,children:jsxRuntimeExports.jsx(ScrollAreaThumbImpl,{ref:et,...nt})})}),ScrollAreaThumbImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,style:nt,...rt}=o,ot=useScrollAreaContext(THUMB_NAME,tt),it=useScrollbarContext(THUMB_NAME,tt),{onThumbPositionChange:st}=it,at=useComposedRefs(et,dt=>it.onThumbChange(dt)),ct=reactExports.useRef(),lt=useDebounceCallback(()=>{ct.current&&(ct.current(),ct.current=void 0)},100);return reactExports.useEffect(()=>{const dt=ot.viewport;if(dt){const ht=()=>{if(lt(),!ct.current){const pt=addUnlinkedScrollListener(dt,st);ct.current=pt,st()}};return st(),dt.addEventListener("scroll",ht),()=>dt.removeEventListener("scroll",ht)}},[ot.viewport,lt,st]),jsxRuntimeExports.jsx(Primitive.div,{"data-state":it.hasThumb?"visible":"hidden",...rt,ref:at,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...nt},onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,dt=>{const pt=dt.target.getBoundingClientRect(),mt=dt.clientX-pt.left,ft=dt.clientY-pt.top;it.onThumbPointerDown({x:mt,y:ft})}),onPointerUp:composeEventHandlers(o.onPointerUp,it.onThumbPointerUp)})});ScrollAreaThumb.displayName=THUMB_NAME;var CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(CORNER_NAME,o.__scopeScrollArea),nt=!!(tt.scrollbarX&&tt.scrollbarY);return tt.type!=="scroll"&&nt?jsxRuntimeExports.jsx(ScrollAreaCornerImpl,{...o,ref:et}):null});ScrollAreaCorner.displayName=CORNER_NAME;var ScrollAreaCornerImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,...nt}=o,rt=useScrollAreaContext(CORNER_NAME,tt),[ot,it]=reactExports.useState(0),[st,at]=reactExports.useState(0),ct=!!(ot&&st);return useResizeObserver(rt.scrollbarX,()=>{var dt;const lt=((dt=rt.scrollbarX)==null?void 0:dt.offsetHeight)||0;rt.onCornerHeightChange(lt),at(lt)}),useResizeObserver(rt.scrollbarY,()=>{var dt;const lt=((dt=rt.scrollbarY)==null?void 0:dt.offsetWidth)||0;rt.onCornerWidthChange(lt),it(lt)}),ct?jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et,style:{width:ot,height:st,position:"absolute",right:rt.dir==="ltr"?0:void 0,left:rt.dir==="rtl"?0:void 0,bottom:0,...o.style}}):null});function toInt(o){return o?parseInt(o,10):0}function getThumbRatio(o,et){const tt=o/et;return isNaN(tt)?0:tt}function getThumbSize(o){const et=getThumbRatio(o.viewport,o.content),tt=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,nt=(o.scrollbar.size-tt)*et;return Math.max(nt,18)}function getScrollPositionFromPointer(o,et,tt,nt="ltr"){const rt=getThumbSize(tt),ot=rt/2,it=et||ot,st=rt-it,at=tt.scrollbar.paddingStart+it,ct=tt.scrollbar.size-tt.scrollbar.paddingEnd-st,lt=tt.content-tt.viewport,dt=nt==="ltr"?[0,lt]:[lt*-1,0];return linearScale([at,ct],dt)(o)}function getThumbOffsetFromScroll(o,et,tt="ltr"){const nt=getThumbSize(et),rt=et.scrollbar.paddingStart+et.scrollbar.paddingEnd,ot=et.scrollbar.size-rt,it=et.content-et.viewport,st=ot-nt,at=tt==="ltr"?[0,it]:[it*-1,0],ct=clamp(o,at);return linearScale([0,it],[0,st])(ct)}function linearScale(o,et){return tt=>{if(o[0]===o[1]||et[0]===et[1])return et[0];const nt=(et[1]-et[0])/(o[1]-o[0]);return et[0]+nt*(tt-o[0])}}function isScrollingWithinScrollbarBounds(o,et){return o>0&&o{})=>{let tt={left:o.scrollLeft,top:o.scrollTop},nt=0;return function rt(){const ot={left:o.scrollLeft,top:o.scrollTop},it=tt.left!==ot.left,st=tt.top!==ot.top;(it||st)&&et(),tt=ot,nt=window.requestAnimationFrame(rt)}(),()=>window.cancelAnimationFrame(nt)};function useDebounceCallback(o,et){const tt=useCallbackRef$1(o),nt=reactExports.useRef(0);return reactExports.useEffect(()=>()=>window.clearTimeout(nt.current),[]),reactExports.useCallback(()=>{window.clearTimeout(nt.current),nt.current=window.setTimeout(tt,et)},[tt,et])}function useResizeObserver(o,et){const tt=useCallbackRef$1(et);useLayoutEffect2(()=>{let nt=0;if(o){const rt=new ResizeObserver(()=>{cancelAnimationFrame(nt),nt=window.requestAnimationFrame(tt)});return rt.observe(o),()=>{window.cancelAnimationFrame(nt),rt.unobserve(o)}}},[o,tt])}function getSubtree(o,et){const{asChild:tt,children:nt}=o;if(!tt)return typeof et=="function"?et(nt):et;const rt=reactExports.Children.only(nt);return reactExports.cloneElement(rt,{children:typeof et=="function"?et(rt.props.children):et})}var Root=ScrollArea$1,Viewport=ScrollAreaViewport,Corner=ScrollAreaCorner;const ScrollArea=reactExports.forwardRef(({className:o,children:et,...tt},nt)=>jsxRuntimeExports.jsxs(Root,{ref:nt,className:cn("relative overflow-hidden",o),...tt,children:[jsxRuntimeExports.jsx(Viewport,{className:"h-full w-full rounded-[inherit]",children:et}),jsxRuntimeExports.jsx(ScrollBar,{}),jsxRuntimeExports.jsx(Corner,{})]}));ScrollArea.displayName=Root.displayName;const ScrollBar=reactExports.forwardRef(({className:o,orientation:et="vertical",...tt},nt)=>jsxRuntimeExports.jsx(ScrollAreaScrollbar,{ref:nt,orientation:et,className:cn("flex touch-none select-none transition-colors",et==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",et==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",o),...tt,children:jsxRuntimeExports.jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;const privacyPolicy=` + Signed by: ${gt}`;xt({message:Rt})},It=()=>{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 Book"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:wt,className:"space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"title",children:"Book Title"}),jsxRuntimeExports.jsx(Input,{type:"text",id:"title",name:"title",value:o.title,onChange:bt,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:"Book Description"}),jsxRuntimeExports.jsx(Textarea,{id:"description",name:"description",value:o.description,onChange:bt,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 Book"})]})}),jsxRuntimeExports.jsx(Dialog,{open:rt,onOpenChange:It,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Book Created":"Book Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&mt&&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/${o.uuid}/${mt}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/sign/${o.uuid}/${mt}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/sign/${o.uuid}/${mt}`),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:o.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:o.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:It,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:kt,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:o,chainsData:et,onSuccess:tt})=>{const[nt,rt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),{address:ft}=useAccount(),{data:mt}=useEnsName({address:ft}),{node:pt}=useWaku(),{ensureWalletConnected:yt}=useWalletPrompt(),gt=(wt,kt)=>{var Rt;if(kt.has(wt.blockUUID))return!1;if(kt.add(wt.blockUUID),(Rt=wt.signatures)!=null&&Rt.some($t=>{var Nt;return((Nt=$t==null?void 0:$t.address)==null?void 0:Nt.toLowerCase())===(ft==null?void 0:ft.toLowerCase())}))return!0;const It=et.find($t=>$t.blockUUID===wt.parentBlockUUID);return It&>(It,kt)?!0:et.filter($t=>$t.parentBlockUUID===wt.blockUUID).some($t=>gt($t,kt))};reactExports.useEffect(()=>{if(ft)try{lt(gt(o,new Set))}catch(wt){console.error("Error in signature check:",wt),lt(!1)}},[ft,o,et]);const{signMessage:xt}=useSignMessage({mutation:{onMutate(){at(null),it(!0)},async onSuccess(wt){if(!(!ft||!pt))try{if(o.signatures.some(Bt=>Bt.address.toLowerCase()===ft.toLowerCase())){at("You have already signed this chain.");return}const kt=Date.now(),It={chainUUID:o.chainUUID,blockUUID:v4(),title:o.title,description:o.description,signedMessage:wt,timestamp:kt,signatures:[{address:ft,signature:wt}],parentBlockUUID:o.blockUUID},Rt=createMessage(It),$t=await pt.lightPush.send(encoder,Rt);Telemetry.push(fromLightPush({result:$t,node:pt,encoder,timestamp:kt,bookId:o.chainUUID,wallet:ft}));const{failures:Nt,successes:Mt}=$t;if(Nt.length>0||Mt.length===0)throw new Error("Failed to send message to Waku network");tt(It),rt(!1)}catch(kt){console.error("Error creating new block:",kt),at("Failed to create new block. Please try again.")}},onError(wt){console.error("Error signing message:",wt),at("Error signing message. Please try again. If using a mobile wallet, please ensure your wallet app is open.")},onSettled(){it(!1)}}}),vt=async()=>{try{if(!ft&&(ht(!0),!await yt())){at("Please ensure your wallet is connected and the app is open.");return}if(ct){at("You have already signed this chain.");return}if(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)&&typeof window.ethereum>"u"){at("Please ensure your wallet app is installed and open before signing."),window.location.href="metamask:///";return}const kt=["Sign Block:",`Chain UUID: ${o.chainUUID}`,`Block UUID: ${o.blockUUID}`,`Title: ${o.title}`,`Description: ${o.description}`,`Timestamp: ${new Date().getTime()}`,`Parent Block UUID: ${o.parentBlockUUID}`,`Signed by: ${mt||ft}`].join(` +`);xt({message:kt})}catch(wt){console.error("Error in sign flow:",wt),at("Failed to initiate signing. Please ensure your wallet app is open and try again."),it(!1)}finally{ht(!1)}},bt=()=>ot?"Signing...":dt?"Connecting...":ct?"Already Signed":ft?"Sign":"Connect Wallet",Et=ot||dt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>rt(!0),disabled:ct,children:ct?"Already Signed":ft?"Sign Book":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:rt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Sign Book"}),jsxRuntimeExports.jsx(DialogDescription,{children:ct?"You have already signed this book.":"Review the block details and sign to add your signature to the book."})]}),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:o.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.chainUUID}/${o.blockUUID}`})]}),(st||dt)&&jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),dt&&jsxRuntimeExports.jsxs("div",{className:"rounded-md bg-blue-50 p-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-blue-700",children:"Attempting to connect to your wallet..."}),jsxRuntimeExports.jsx("p",{className:"text-xs text-blue-600 mt-1",children:"If your wallet doesn't open automatically, please open it manually to approve the connection."})]})]}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>rt(!1),children:"Cancel"}),jsxRuntimeExports.jsxs(Button,{onClick:vt,disabled:ot||ct||dt,children:[Et&&jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),bt()]})]})]})})]})},ChainList=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const nt=it=>{et(it)},rt=(it,st=0)=>{const at=o.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("div",{className:"flex flex-col space-y-2 mt-2",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Created by"})}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:o,onSuccess:nt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"flex flex-col gap-4",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share this Book"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this book with others to collect their signatures."})]}),jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center gap-4",children:jsxRuntimeExports.jsx(QRCode,{text:lt,width:180,height:180,showCopyButton:"text",title:it.title,description:`Sign this chain: ${it.title}`})})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx("p",{className:"text-sm",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Signed by"})})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>rt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=o.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 Books",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 books..."]})]})}),jsxRuntimeExports.jsx(CardContent,{children:ot.length===0&&!tt?jsxRuntimeExports.jsx("p",{children:"No books found."}):jsxRuntimeExports.jsx("ul",{className:"space-y-4",children:ot.map(it=>rt(it,0))})})]})},SignerName=({address:o,prefix:et})=>{const{data:tt}=useEnsName({address:o});return jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[et&&`${et}: `,tt||`${o.slice(0,6)}...${o.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(o){const et=reactExports.useContext(DirectionContext);return o||et||"ltr"}function clamp(o,[et,tt]){return Math.min(tt,Math.max(et,o))}function useStateMachine(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,type:nt="hover",dir:rt,scrollHideDelay:ot=600,...it}=o,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[ft,mt]=reactExports.useState(null),[pt,yt]=reactExports.useState(null),[gt,xt]=reactExports.useState(0),[vt,bt]=reactExports.useState(0),[Et,wt]=reactExports.useState(!1),[kt,It]=reactExports.useState(!1),Rt=useComposedRefs(et,Nt=>at(Nt)),$t=useDirection(rt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:nt,dir:$t,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:ft,onScrollbarXChange:mt,scrollbarXEnabled:Et,onScrollbarXEnabledChange:wt,scrollbarY:pt,onScrollbarYChange:yt,scrollbarYEnabled:kt,onScrollbarYEnabledChange:It,onCornerWidthChange:xt,onCornerHeightChange:bt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:$t,...it,ref:Rt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":vt+"px",...o.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,children:nt,nonce:rt,...ot}=o,it=useScrollAreaContext(VIEWPORT_NAME,tt),st=reactExports.useRef(null),at=useComposedRefs(et,st,it.onViewportChange);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:rt}),jsxRuntimeExports.jsx(Primitive.div,{"data-radix-scroll-area-viewport":"",...ot,ref:at,style:{overflowX:it.scrollbarXEnabled?"scroll":"hidden",overflowY:it.scrollbarYEnabled?"scroll":"hidden",...o.style},children:jsxRuntimeExports.jsx("div",{ref:it.onContentChange,style:{minWidth:"100%",display:"table"},children:nt})})]})});ScrollAreaViewport.displayName=VIEWPORT_NAME;var SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{onScrollbarXEnabledChange:ot,onScrollbarYEnabledChange:it}=rt,st=o.orientation==="horizontal";return reactExports.useEffect(()=>(st?ot(!0):it(!0),()=>{st?ot(!1):it(!1)}),[st,ot,it]),rt.type==="hover"?jsxRuntimeExports.jsx(ScrollAreaScrollbarHover,{...nt,ref:et,forceMount:tt}):rt.type==="scroll"?jsxRuntimeExports.jsx(ScrollAreaScrollbarScroll,{...nt,ref:et,forceMount:tt}):rt.type==="auto"?jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{...nt,ref:et,forceMount:tt}):rt.type==="always"?jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{...nt,ref:et}):null});ScrollAreaScrollbar.displayName=SCROLLBAR_NAME;var ScrollAreaScrollbarHover=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[ot,it]=reactExports.useState(!1);return reactExports.useEffect(()=>{const st=rt.scrollArea;let at=0;if(st){const ct=()=>{window.clearTimeout(at),it(!0)},lt=()=>{at=window.setTimeout(()=>it(!1),rt.scrollHideDelay)};return st.addEventListener("pointerenter",ct),st.addEventListener("pointerleave",lt),()=>{window.clearTimeout(at),st.removeEventListener("pointerenter",ct),st.removeEventListener("pointerleave",lt)}}},[rt.scrollArea,rt.scrollHideDelay]),jsxRuntimeExports.jsx(Presence,{present:tt||ot,children:jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{"data-state":ot?"visible":"hidden",...nt,ref:et})})}),ScrollAreaScrollbarScroll=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=o.orientation==="horizontal",it=useDebounceCallback(()=>at("SCROLL_END"),100),[st,at]=useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return reactExports.useEffect(()=>{if(st==="idle"){const ct=window.setTimeout(()=>at("HIDE"),rt.scrollHideDelay);return()=>window.clearTimeout(ct)}},[st,rt.scrollHideDelay,at]),reactExports.useEffect(()=>{const ct=rt.viewport,lt=ot?"scrollLeft":"scrollTop";if(ct){let dt=ct[lt];const ht=()=>{const ft=ct[lt];dt!==ft&&(at("SCROLL"),it()),dt=ft};return ct.addEventListener("scroll",ht),()=>ct.removeEventListener("scroll",ht)}},[rt.viewport,ot,at,it]),jsxRuntimeExports.jsx(Presence,{present:tt||st!=="hidden",children:jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{"data-state":st==="hidden"?"hidden":"visible",...nt,ref:et,onPointerEnter:composeEventHandlers(o.onPointerEnter,()=>at("POINTER_ENTER")),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>at("POINTER_LEAVE"))})})}),ScrollAreaScrollbarAuto=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{forceMount:nt,...rt}=o,[ot,it]=reactExports.useState(!1),st=o.orientation==="horizontal",at=useDebounceCallback(()=>{if(tt.viewport){const ct=tt.viewport.offsetWidth{const{orientation:tt="vertical",...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=reactExports.useRef(null),it=reactExports.useRef(0),[st,at]=reactExports.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),ct=getThumbRatio(st.viewport,st.content),lt={...nt,sizes:st,onSizesChange:at,hasThumb:ct>0&&ct<1,onThumbChange:ht=>ot.current=ht,onThumbPointerUp:()=>it.current=0,onThumbPointerDown:ht=>it.current=ht};function dt(ht,ft){return getScrollPositionFromPointer(ht,it.current,st,ft)}return tt==="horizontal"?jsxRuntimeExports.jsx(ScrollAreaScrollbarX,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollLeft,ft=getThumbOffsetFromScroll(ht,st,rt.dir);ot.current.style.transform=`translate3d(${ft}px, 0, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=dt(ht,rt.dir))}}):tt==="vertical"?jsxRuntimeExports.jsx(ScrollAreaScrollbarY,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollTop,ft=getThumbOffsetFromScroll(ht,st);ot.current.style.transform=`translate3d(0, ${ft}px, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=dt(ht))}}):null}),ScrollAreaScrollbarX=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarXChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...rt,ref:ct,sizes:tt,style:{bottom:0,left:ot.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:ot.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.x),onDragScroll:lt=>o.onDragScroll(lt.x),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollLeft+lt.deltaX;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollWidth,viewport:ot.viewport.offsetWidth,scrollbar:{size:at.current.clientWidth,paddingStart:toInt(it.paddingLeft),paddingEnd:toInt(it.paddingRight)}})}})}),ScrollAreaScrollbarY=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarYChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...rt,ref:ct,sizes:tt,style:{top:0,right:ot.dir==="ltr"?0:void 0,left:ot.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.y),onDragScroll:lt=>o.onDragScroll(lt.y),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollTop+lt.deltaY;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollHeight,viewport:ot.viewport.offsetHeight,scrollbar:{size:at.current.clientHeight,paddingStart:toInt(it.paddingTop),paddingEnd:toInt(it.paddingBottom)}})}})}),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,sizes:nt,hasThumb:rt,onThumbChange:ot,onThumbPointerUp:it,onThumbPointerDown:st,onThumbPositionChange:at,onDragScroll:ct,onWheelScroll:lt,onResize:dt,...ht}=o,ft=useScrollAreaContext(SCROLLBAR_NAME,tt),[mt,pt]=reactExports.useState(null),yt=useComposedRefs(et,Rt=>pt(Rt)),gt=reactExports.useRef(null),xt=reactExports.useRef(""),vt=ft.viewport,bt=nt.content-nt.viewport,Et=useCallbackRef$1(lt),wt=useCallbackRef$1(at),kt=useDebounceCallback(dt,10);function It(Rt){if(gt.current){const $t=Rt.clientX-gt.current.left,Nt=Rt.clientY-gt.current.top;ct({x:$t,y:Nt})}}return reactExports.useEffect(()=>{const Rt=$t=>{const Nt=$t.target;(mt==null?void 0:mt.contains(Nt))&&Et($t,bt)};return document.addEventListener("wheel",Rt,{passive:!1}),()=>document.removeEventListener("wheel",Rt,{passive:!1})},[vt,mt,bt,Et]),reactExports.useEffect(wt,[nt,wt]),useResizeObserver(mt,kt),useResizeObserver(ft.content,kt),jsxRuntimeExports.jsx(ScrollbarProvider,{scope:tt,scrollbar:mt,hasThumb:rt,onThumbChange:useCallbackRef$1(ot),onThumbPointerUp:useCallbackRef$1(it),onThumbPositionChange:wt,onThumbPointerDown:useCallbackRef$1(st),children:jsxRuntimeExports.jsx(Primitive.div,{...ht,ref:yt,style:{position:"absolute",...ht.style},onPointerDown:composeEventHandlers(o.onPointerDown,Rt=>{Rt.button===0&&(Rt.target.setPointerCapture(Rt.pointerId),gt.current=mt.getBoundingClientRect(),xt.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",ft.viewport&&(ft.viewport.style.scrollBehavior="auto"),It(Rt))}),onPointerMove:composeEventHandlers(o.onPointerMove,It),onPointerUp:composeEventHandlers(o.onPointerUp,Rt=>{const $t=Rt.target;$t.hasPointerCapture(Rt.pointerId)&&$t.releasePointerCapture(Rt.pointerId),document.body.style.webkitUserSelect=xt.current,ft.viewport&&(ft.viewport.style.scrollBehavior=""),gt.current=null})})})}),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollbarContext(THUMB_NAME,o.__scopeScrollArea);return jsxRuntimeExports.jsx(Presence,{present:tt||rt.hasThumb,children:jsxRuntimeExports.jsx(ScrollAreaThumbImpl,{ref:et,...nt})})}),ScrollAreaThumbImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,style:nt,...rt}=o,ot=useScrollAreaContext(THUMB_NAME,tt),it=useScrollbarContext(THUMB_NAME,tt),{onThumbPositionChange:st}=it,at=useComposedRefs(et,dt=>it.onThumbChange(dt)),ct=reactExports.useRef(),lt=useDebounceCallback(()=>{ct.current&&(ct.current(),ct.current=void 0)},100);return reactExports.useEffect(()=>{const dt=ot.viewport;if(dt){const ht=()=>{if(lt(),!ct.current){const ft=addUnlinkedScrollListener(dt,st);ct.current=ft,st()}};return st(),dt.addEventListener("scroll",ht),()=>dt.removeEventListener("scroll",ht)}},[ot.viewport,lt,st]),jsxRuntimeExports.jsx(Primitive.div,{"data-state":it.hasThumb?"visible":"hidden",...rt,ref:at,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...nt},onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,dt=>{const ft=dt.target.getBoundingClientRect(),mt=dt.clientX-ft.left,pt=dt.clientY-ft.top;it.onThumbPointerDown({x:mt,y:pt})}),onPointerUp:composeEventHandlers(o.onPointerUp,it.onThumbPointerUp)})});ScrollAreaThumb.displayName=THUMB_NAME;var CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(CORNER_NAME,o.__scopeScrollArea),nt=!!(tt.scrollbarX&&tt.scrollbarY);return tt.type!=="scroll"&&nt?jsxRuntimeExports.jsx(ScrollAreaCornerImpl,{...o,ref:et}):null});ScrollAreaCorner.displayName=CORNER_NAME;var ScrollAreaCornerImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,...nt}=o,rt=useScrollAreaContext(CORNER_NAME,tt),[ot,it]=reactExports.useState(0),[st,at]=reactExports.useState(0),ct=!!(ot&&st);return useResizeObserver(rt.scrollbarX,()=>{var dt;const lt=((dt=rt.scrollbarX)==null?void 0:dt.offsetHeight)||0;rt.onCornerHeightChange(lt),at(lt)}),useResizeObserver(rt.scrollbarY,()=>{var dt;const lt=((dt=rt.scrollbarY)==null?void 0:dt.offsetWidth)||0;rt.onCornerWidthChange(lt),it(lt)}),ct?jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et,style:{width:ot,height:st,position:"absolute",right:rt.dir==="ltr"?0:void 0,left:rt.dir==="rtl"?0:void 0,bottom:0,...o.style}}):null});function toInt(o){return o?parseInt(o,10):0}function getThumbRatio(o,et){const tt=o/et;return isNaN(tt)?0:tt}function getThumbSize(o){const et=getThumbRatio(o.viewport,o.content),tt=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,nt=(o.scrollbar.size-tt)*et;return Math.max(nt,18)}function getScrollPositionFromPointer(o,et,tt,nt="ltr"){const rt=getThumbSize(tt),ot=rt/2,it=et||ot,st=rt-it,at=tt.scrollbar.paddingStart+it,ct=tt.scrollbar.size-tt.scrollbar.paddingEnd-st,lt=tt.content-tt.viewport,dt=nt==="ltr"?[0,lt]:[lt*-1,0];return linearScale([at,ct],dt)(o)}function getThumbOffsetFromScroll(o,et,tt="ltr"){const nt=getThumbSize(et),rt=et.scrollbar.paddingStart+et.scrollbar.paddingEnd,ot=et.scrollbar.size-rt,it=et.content-et.viewport,st=ot-nt,at=tt==="ltr"?[0,it]:[it*-1,0],ct=clamp(o,at);return linearScale([0,it],[0,st])(ct)}function linearScale(o,et){return tt=>{if(o[0]===o[1]||et[0]===et[1])return et[0];const nt=(et[1]-et[0])/(o[1]-o[0]);return et[0]+nt*(tt-o[0])}}function isScrollingWithinScrollbarBounds(o,et){return o>0&&o{})=>{let tt={left:o.scrollLeft,top:o.scrollTop},nt=0;return function rt(){const ot={left:o.scrollLeft,top:o.scrollTop},it=tt.left!==ot.left,st=tt.top!==ot.top;(it||st)&&et(),tt=ot,nt=window.requestAnimationFrame(rt)}(),()=>window.cancelAnimationFrame(nt)};function useDebounceCallback(o,et){const tt=useCallbackRef$1(o),nt=reactExports.useRef(0);return reactExports.useEffect(()=>()=>window.clearTimeout(nt.current),[]),reactExports.useCallback(()=>{window.clearTimeout(nt.current),nt.current=window.setTimeout(tt,et)},[tt,et])}function useResizeObserver(o,et){const tt=useCallbackRef$1(et);useLayoutEffect2(()=>{let nt=0;if(o){const rt=new ResizeObserver(()=>{cancelAnimationFrame(nt),nt=window.requestAnimationFrame(tt)});return rt.observe(o),()=>{window.cancelAnimationFrame(nt),rt.unobserve(o)}}},[o,tt])}var Root=ScrollArea$1,Viewport=ScrollAreaViewport,Corner=ScrollAreaCorner;const ScrollArea=reactExports.forwardRef(({className:o,children:et,...tt},nt)=>jsxRuntimeExports.jsxs(Root,{ref:nt,className:cn("relative overflow-hidden",o),...tt,children:[jsxRuntimeExports.jsx(Viewport,{className:"h-full w-full rounded-[inherit]",children:et}),jsxRuntimeExports.jsx(ScrollBar,{}),jsxRuntimeExports.jsx(Corner,{})]}));ScrollArea.displayName=Root.displayName;const ScrollBar=reactExports.forwardRef(({className:o,orientation:et="vertical",...tt},nt)=>jsxRuntimeExports.jsx(ScrollAreaScrollbar,{ref:nt,orientation:et,className:cn("flex touch-none select-none transition-colors",et==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",et==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",o),...tt,children:jsxRuntimeExports.jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;const privacyPolicy=` # Waku - Dogfooding Website *Last updated: 22 August 2024* @@ -4261,16 +4244,16 @@ To the extent that you have any questions about the Privacy Policy, please conta This document is licensed under CC-BY-SA. `;function ok$1(){}function unreachable(){}function stringify$1(o,et){const tt={};return(o[o.length-1]===""?[...o,""]:o).join((tt.padRight?" ":"")+","+(tt.padLeft===!1?"":" ")).trim()}const nameRe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nameReJsx=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,emptyOptions$2={};function name(o,et){return(emptyOptions$2.jsx?nameReJsx:nameRe).test(o)}const re=/[ \t\n\f\r]/g;function whitespace(o){return typeof o=="object"?o.type==="text"?empty$1(o.value):!1:empty$1(o)}function empty$1(o){return o.replace(re,"")===""}class Schema{constructor(et,tt,nt){this.property=et,this.normal=tt,nt&&(this.space=nt)}}Schema.prototype.property={};Schema.prototype.normal={};Schema.prototype.space=null;function merge(o,et){const tt={},nt={};let rt=-1;for(;++rt4&&tt.slice(0,4)==="data"&&valid.test(et)){if(et.charAt(4)==="-"){const ot=et.slice(5).replace(dash,camelcase);nt="data"+ot.charAt(0).toUpperCase()+ot.slice(1)}else{const ot=et.slice(4);if(!dash.test(ot)){let it=ot.replace(cap$1,kebab);it.charAt(0)!=="-"&&(it="-"+it),et="data"+it}}rt=DefinedInfo}return new rt(nt,et)}function kebab(o){return"-"+o.toLowerCase()}function camelcase(o){return o.charAt(1).toUpperCase()}const hastToReact={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},html$1=merge([xml,xlink,xmlns,aria,html$2],"html"),svg=merge([xml,xlink,xmlns,aria,svg$1],"svg");function stringify(o){return o.join(" ").trim()}var cjs={},COMMENT_REGEX=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,NEWLINE_REGEX=/\n/g,WHITESPACE_REGEX=/^\s*/,PROPERTY_REGEX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,COLON_REGEX=/^:\s*/,VALUE_REGEX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,SEMICOLON_REGEX=/^[;\s]*/,TRIM_REGEX=/^\s+|\s+$/g,NEWLINE=` -`,FORWARD_SLASH="/",ASTERISK="*",EMPTY_STRING="",TYPE_COMMENT="comment",TYPE_DECLARATION="declaration",inlineStyleParser=function(o,et){if(typeof o!="string")throw new TypeError("First argument must be a string");if(!o)return[];et=et||{};var tt=1,nt=1;function rt(mt){var ft=mt.match(NEWLINE_REGEX);ft&&(tt+=ft.length);var yt=mt.lastIndexOf(NEWLINE);nt=~yt?mt.length-yt:nt+mt.length}function ot(){var mt={line:tt,column:nt};return function(ft){return ft.position=new it(mt),ct(),ft}}function it(mt){this.start=mt,this.end={line:tt,column:nt},this.source=et.source}it.prototype.content=o;function st(mt){var ft=new Error(et.source+":"+tt+":"+nt+": "+mt);if(ft.reason=mt,ft.filename=et.source,ft.line=tt,ft.column=nt,ft.source=o,!et.silent)throw ft}function at(mt){var ft=mt.exec(o);if(ft){var yt=ft[0];return rt(yt),o=o.slice(yt.length),ft}}function ct(){at(WHITESPACE_REGEX)}function lt(mt){var ft;for(mt=mt||[];ft=dt();)ft!==!1&&mt.push(ft);return mt}function dt(){var mt=ot();if(!(FORWARD_SLASH!=o.charAt(0)||ASTERISK!=o.charAt(1))){for(var ft=2;EMPTY_STRING!=o.charAt(ft)&&(ASTERISK!=o.charAt(ft)||FORWARD_SLASH!=o.charAt(ft+1));)++ft;if(ft+=2,EMPTY_STRING===o.charAt(ft-1))return st("End of comment missing");var yt=o.slice(2,ft-2);return nt+=2,rt(yt),o=o.slice(ft),nt+=2,mt({type:TYPE_COMMENT,comment:yt})}}function ht(){var mt=ot(),ft=at(PROPERTY_REGEX);if(ft){if(dt(),!at(COLON_REGEX))return st("property missing ':'");var yt=at(VALUE_REGEX),gt=mt({type:TYPE_DECLARATION,property:trim(ft[0].replace(COMMENT_REGEX,EMPTY_STRING)),value:yt?trim(yt[0].replace(COMMENT_REGEX,EMPTY_STRING)):EMPTY_STRING});return at(SEMICOLON_REGEX),gt}}function pt(){var mt=[];lt(mt);for(var ft;ft=ht();)ft!==!1&&(mt.push(ft),lt(mt));return mt}return ct(),pt()};function trim(o){return o?o.replace(TRIM_REGEX,EMPTY_STRING):EMPTY_STRING}var __importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs,"__esModule",{value:!0});var _default=cjs.default=StyleToObject,inline_style_parser_1=__importDefault(inlineStyleParser);function StyleToObject(o,et){var tt=null;if(!o||typeof o!="string")return tt;var nt=(0,inline_style_parser_1.default)(o),rt=typeof et=="function";return nt.forEach(function(ot){if(ot.type==="declaration"){var it=ot.property,st=ot.value;rt?et(it,st,ot):st&&(tt=tt||{},tt[it]=st)}}),tt}const styleToObject=_default.default||_default,pointEnd=point$2("end"),pointStart=point$2("start");function point$2(o){return et;function et(tt){const nt=tt&&tt.position&&tt.position[o]||{};if(typeof nt.line=="number"&&nt.line>0&&typeof nt.column=="number"&&nt.column>0)return{line:nt.line,column:nt.column,offset:typeof nt.offset=="number"&&nt.offset>-1?nt.offset:void 0}}}function position$1(o){const et=pointStart(o),tt=pointEnd(o);if(et&&tt)return{start:et,end:tt}}function stringifyPosition(o){return!o||typeof o!="object"?"":"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point$1(o):""}function point$1(o){return index(o&&o.line)+":"+index(o&&o.column)}function position(o){return point$1(o&&o.start)+"-"+point$1(o&&o.end)}function index(o){return o&&typeof o=="number"?o:1}class VFileMessage extends Error{constructor(et,tt,nt){super(),typeof tt=="string"&&(nt=tt,tt=void 0);let rt="",ot={},it=!1;if(tt&&("line"in tt&&"column"in tt?ot={place:tt}:"start"in tt&&"end"in tt?ot={place:tt}:"type"in tt?ot={ancestors:[tt],place:tt.position}:ot={...tt}),typeof et=="string"?rt=et:!ot.cause&&et&&(it=!0,rt=et.message,ot.cause=et),!ot.ruleId&&!ot.source&&typeof nt=="string"){const at=nt.indexOf(":");at===-1?ot.ruleId=nt:(ot.source=nt.slice(0,at),ot.ruleId=nt.slice(at+1))}if(!ot.place&&ot.ancestors&&ot.ancestors){const at=ot.ancestors[ot.ancestors.length-1];at&&(ot.place=at.position)}const st=ot.place&&"start"in ot.place?ot.place.start:ot.place;this.ancestors=ot.ancestors||void 0,this.cause=ot.cause||void 0,this.column=st?st.column:void 0,this.fatal=void 0,this.file,this.message=rt,this.line=st?st.line:void 0,this.name=stringifyPosition(ot.place)||"1:1",this.place=ot.place||void 0,this.reason=this.message,this.ruleId=ot.ruleId||void 0,this.source=ot.source||void 0,this.stack=it&&ot.cause&&typeof ot.cause.stack=="string"?ot.cause.stack:"",this.actual,this.expected,this.note,this.url}}VFileMessage.prototype.file="";VFileMessage.prototype.name="";VFileMessage.prototype.reason="";VFileMessage.prototype.message="";VFileMessage.prototype.stack="";VFileMessage.prototype.column=void 0;VFileMessage.prototype.line=void 0;VFileMessage.prototype.ancestors=void 0;VFileMessage.prototype.cause=void 0;VFileMessage.prototype.fatal=void 0;VFileMessage.prototype.place=void 0;VFileMessage.prototype.ruleId=void 0;VFileMessage.prototype.source=void 0;const own$3={}.hasOwnProperty,emptyMap=new Map,cap=/[A-Z]/g,dashSomething=/-([a-z])/g,tableElements=new Set(["table","tbody","thead","tfoot","tr"]),tableCellElement=new Set(["td","th"]),docs="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function toJsxRuntime(o,et){if(!et||et.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const tt=et.filePath||void 0;let nt;if(et.development){if(typeof et.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");nt=developmentCreate(tt,et.jsxDEV)}else{if(typeof et.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof et.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");nt=productionCreate(tt,et.jsx,et.jsxs)}const rt={Fragment:et.Fragment,ancestors:[],components:et.components||{},create:nt,elementAttributeNameCase:et.elementAttributeNameCase||"react",evaluater:et.createEvaluater?et.createEvaluater():void 0,filePath:tt,ignoreInvalidStyle:et.ignoreInvalidStyle||!1,passKeys:et.passKeys!==!1,passNode:et.passNode||!1,schema:et.space==="svg"?svg:html$1,stylePropertyNameCase:et.stylePropertyNameCase||"dom",tableCellAlignToStyle:et.tableCellAlignToStyle!==!1},ot=one$1(rt,o,void 0);return ot&&typeof ot!="string"?ot:rt.create(o,rt.Fragment,{children:ot||void 0},void 0)}function one$1(o,et,tt){if(et.type==="element")return element$1(o,et,tt);if(et.type==="mdxFlowExpression"||et.type==="mdxTextExpression")return mdxExpression(o,et);if(et.type==="mdxJsxFlowElement"||et.type==="mdxJsxTextElement")return mdxJsxElement(o,et,tt);if(et.type==="mdxjsEsm")return mdxEsm(o,et);if(et.type==="root")return root$1(o,et,tt);if(et.type==="text")return text$3(o,et)}function element$1(o,et,tt){const nt=o.schema;let rt=nt;et.tagName.toLowerCase()==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=findComponentFromName(o,et.tagName,!1),it=createElementProps(o,et);let st=createChildren(o,et);return tableElements.has(et.tagName)&&(st=st.filter(function(at){return typeof at=="string"?!whitespace(at):!0})),addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function mdxExpression(o,et){if(et.data&&et.data.estree&&o.evaluater){const nt=et.data.estree.body[0];return nt.type,o.evaluater.evaluateExpression(nt.expression)}crashEstree(o,et.position)}function mdxEsm(o,et){if(et.data&&et.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(et.data.estree);crashEstree(o,et.position)}function mdxJsxElement(o,et,tt){const nt=o.schema;let rt=nt;et.name==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=et.name===null?o.Fragment:findComponentFromName(o,et.name,!0),it=createJsxElementProps(o,et),st=createChildren(o,et);return addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function root$1(o,et,tt){const nt={};return addChildren(nt,createChildren(o,et)),o.create(et,o.Fragment,nt,tt)}function text$3(o,et){return et.value}function addNode(o,et,tt,nt){typeof tt!="string"&&tt!==o.Fragment&&o.passNode&&(et.node=nt)}function addChildren(o,et){if(et.length>0){const tt=et.length>1?et:et[0];tt&&(o.children=tt)}}function productionCreate(o,et,tt){return nt;function nt(rt,ot,it,st){const ct=Array.isArray(it.children)?tt:et;return st?ct(ot,it,st):ct(ot,it)}}function developmentCreate(o,et){return tt;function tt(nt,rt,ot,it){const st=Array.isArray(ot.children),at=pointStart(nt);return et(rt,ot,it,st,{columnNumber:at?at.column-1:void 0,fileName:o,lineNumber:at?at.line:void 0},void 0)}}function createElementProps(o,et){const tt={};let nt,rt;for(rt in et.properties)if(rt!=="children"&&own$3.call(et.properties,rt)){const ot=createProperty(o,rt,et.properties[rt]);if(ot){const[it,st]=ot;o.tableCellAlignToStyle&&it==="align"&&typeof st=="string"&&tableCellElement.has(et.tagName)?nt=st:tt[it]=st}}if(nt){const ot=tt.style||(tt.style={});ot[o.stylePropertyNameCase==="css"?"text-align":"textAlign"]=nt}return tt}function createJsxElementProps(o,et){const tt={};for(const nt of et.attributes)if(nt.type==="mdxJsxExpressionAttribute")if(nt.data&&nt.data.estree&&o.evaluater){const ot=nt.data.estree.body[0];ot.type;const it=ot.expression;it.type;const st=it.properties[0];st.type,Object.assign(tt,o.evaluater.evaluateExpression(st.argument))}else crashEstree(o,et.position);else{const rt=nt.name;let ot;if(nt.value&&typeof nt.value=="object")if(nt.value.data&&nt.value.data.estree&&o.evaluater){const st=nt.value.data.estree.body[0];st.type,ot=o.evaluater.evaluateExpression(st.expression)}else crashEstree(o,et.position);else ot=nt.value===null?!0:nt.value;tt[rt]=ot}return tt}function createChildren(o,et){const tt=[];let nt=-1;const rt=o.passKeys?new Map:emptyMap;for(;++ntrt?0:rt+et:et=et>rt?rt:et,tt=tt>0?tt:0,nt.length<1e4)it=Array.from(nt),it.unshift(et,tt),o.splice(...it);else for(tt&&o.splice(et,tt);ot0?(splice(o,o.length,0,et),o):et}const hasOwnProperty={}.hasOwnProperty;function combineExtensions(o){const et={};let tt=-1;for(;++tt13&&tt<32||tt>126&&tt<160||tt>55295&&tt<57344||tt>64975&&tt<65008||(tt&65535)===65535||(tt&65535)===65534||tt>1114111?"�":String.fromCodePoint(tt)}function normalizeIdentifier(o){return o.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(o){return o!==null&&(o<32||o===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(o){return o!==null&&o<-2}function markdownLineEndingOrSpace(o){return o!==null&&(o<0||o===32)}function markdownSpace(o){return o===-2||o===-1||o===32}const unicodePunctuation=regexCheck(new RegExp("\\p{P}|\\p{S}","u")),unicodeWhitespace=regexCheck(/\s/);function regexCheck(o){return et;function et(tt){return tt!==null&&tt>-1&&o.test(String.fromCharCode(tt))}}function normalizeUri(o){const et=[];let tt=-1,nt=0,rt=0;for(;++tt55295&&ot<57344){const st=o.charCodeAt(tt+1);ot<56320&&st>56319&&st<57344?(it=String.fromCharCode(ot,st),rt=1):it="�"}else it=String.fromCharCode(ot);it&&(et.push(o.slice(nt,tt),encodeURIComponent(it)),nt=tt+rt+1,it=""),rt&&(tt+=rt,rt=0)}return et.join("")+o.slice(nt)}function factorySpace(o,et,tt,nt){const rt=nt?nt-1:Number.POSITIVE_INFINITY;let ot=0;return it;function it(at){return markdownSpace(at)?(o.enter(tt),st(at)):et(at)}function st(at){return markdownSpace(at)&&ot++it))return;const kt=et.events.length;let It=kt,Rt,Pt;for(;It--;)if(et.events[It][0]==="exit"&&et.events[It][1].type==="chunkFlow"){if(Rt){Pt=et.events[It][1].end;break}Rt=!0}for(gt(nt),wt=kt;wtvt;){const Et=tt[bt];et.containerState=Et[1],Et[0].exit.call(et,o)}tt.length=vt}function xt(){rt.write([null]),ot=void 0,rt=void 0,et.containerState._closeFlow=void 0}}function tokenizeContainer(o,et,tt){return factorySpace(o,o.attempt(this.parser.constructs.document,et,tt),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(o){if(o===null||markdownLineEndingOrSpace(o)||unicodeWhitespace(o))return 1;if(unicodePunctuation(o))return 2}function resolveAll(o,et,tt){const nt=[];let rt=-1;for(;++rt1&&o[tt][1].end.offset-o[tt][1].start.offset>1?2:1;const dt=Object.assign({},o[nt][1].end),ht=Object.assign({},o[tt][1].start);movePoint(dt,-at),movePoint(ht,at),it={type:at>1?"strongSequence":"emphasisSequence",start:dt,end:Object.assign({},o[nt][1].end)},st={type:at>1?"strongSequence":"emphasisSequence",start:Object.assign({},o[tt][1].start),end:ht},ot={type:at>1?"strongText":"emphasisText",start:Object.assign({},o[nt][1].end),end:Object.assign({},o[tt][1].start)},rt={type:at>1?"strong":"emphasis",start:Object.assign({},it.start),end:Object.assign({},st.end)},o[nt][1].end=Object.assign({},it.start),o[tt][1].start=Object.assign({},st.end),ct=[],o[nt][1].end.offset-o[nt][1].start.offset&&(ct=push(ct,[["enter",o[nt][1],et],["exit",o[nt][1],et]])),ct=push(ct,[["enter",rt,et],["enter",it,et],["exit",it,et],["enter",ot,et]]),ct=push(ct,resolveAll(et.parser.constructs.insideSpan.null,o.slice(nt+1,tt),et)),ct=push(ct,[["exit",ot,et],["enter",st,et],["exit",st,et],["exit",rt,et]]),o[tt][1].end.offset-o[tt][1].start.offset?(lt=2,ct=push(ct,[["enter",o[tt][1],et],["exit",o[tt][1],et]])):lt=0,splice(o,nt-1,tt-nt+3,ct),tt=nt+ct.length-lt-2;break}}for(tt=-1;++tt0&&markdownSpace(wt)?factorySpace(o,xt,"linePrefix",ot+1)(wt):xt(wt)}function xt(wt){return wt===null||markdownLineEnding(wt)?o.check(nonLazyContinuation,ft,bt)(wt):(o.enter("codeFlowValue"),vt(wt))}function vt(wt){return wt===null||markdownLineEnding(wt)?(o.exit("codeFlowValue"),xt(wt)):(o.consume(wt),vt)}function bt(wt){return o.exit("codeFenced"),et(wt)}function Et(wt,kt,It){let Rt=0;return Pt;function Pt(Ft){return wt.enter("lineEnding"),wt.consume(Ft),wt.exit("lineEnding"),jt}function jt(Ft){return wt.enter("codeFencedFence"),markdownSpace(Ft)?factorySpace(wt,Ot,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Ft):Ot(Ft)}function Ot(Ft){return Ft===st?(wt.enter("codeFencedFenceSequence"),Bt(Ft)):It(Ft)}function Bt(Ft){return Ft===st?(Rt++,wt.consume(Ft),Bt):Rt>=it?(wt.exit("codeFencedFenceSequence"),markdownSpace(Ft)?factorySpace(wt,zt,"whitespace")(Ft):zt(Ft)):It(Ft)}function zt(Ft){return Ft===null||markdownLineEnding(Ft)?(wt.exit("codeFencedFence"),kt(Ft)):It(Ft)}}}function tokenizeNonLazyContinuation(o,et,tt){const nt=this;return rt;function rt(it){return it===null?tt(it):(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}const codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented},furtherStart={tokenize:tokenizeFurtherStart,partial:!0};function tokenizeCodeIndented(o,et,tt){const nt=this;return rt;function rt(ct){return o.enter("codeIndented"),factorySpace(o,ot,"linePrefix",5)(ct)}function ot(ct){const lt=nt.events[nt.events.length-1];return lt&<[1].type==="linePrefix"&<[2].sliceSerialize(lt[1],!0).length>=4?it(ct):tt(ct)}function it(ct){return ct===null?at(ct):markdownLineEnding(ct)?o.attempt(furtherStart,it,at)(ct):(o.enter("codeFlowValue"),st(ct))}function st(ct){return ct===null||markdownLineEnding(ct)?(o.exit("codeFlowValue"),it(ct)):(o.consume(ct),st)}function at(ct){return o.exit("codeIndented"),et(ct)}}function tokenizeFurtherStart(o,et,tt){const nt=this;return rt;function rt(it){return nt.parser.lazy[nt.now().line]?tt(it):markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),rt):factorySpace(o,ot,"linePrefix",5)(it)}function ot(it){const st=nt.events[nt.events.length-1];return st&&st[1].type==="linePrefix"&&st[2].sliceSerialize(st[1],!0).length>=4?et(it):markdownLineEnding(it)?rt(it):tt(it)}}const codeText={name:"codeText",tokenize:tokenizeCodeText,resolve:resolveCodeText,previous};function resolveCodeText(o){let et=o.length-4,tt=3,nt,rt;if((o[tt][1].type==="lineEnding"||o[tt][1].type==="space")&&(o[et][1].type==="lineEnding"||o[et][1].type==="space")){for(nt=tt;++nt=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+et+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return etthis.left.length?this.right.slice(this.right.length-nt+this.left.length,this.right.length-et+this.left.length).reverse():this.left.slice(et).concat(this.right.slice(this.right.length-nt+this.left.length).reverse())}splice(et,tt,nt){const rt=tt||0;this.setCursor(Math.trunc(et));const ot=this.right.splice(this.right.length-rt,Number.POSITIVE_INFINITY);return nt&&chunkedPush(this.left,nt),ot.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(et){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(et)}pushMany(et){this.setCursor(Number.POSITIVE_INFINITY),chunkedPush(this.left,et)}unshift(et){this.setCursor(0),this.right.push(et)}unshiftMany(et){this.setCursor(0),chunkedPush(this.right,et.reverse())}setCursor(et){if(!(et===this.left.length||et>this.left.length&&this.right.length===0||et<0&&this.left.length===0))if(et=4?et(it):o.interrupt(nt.parser.constructs.flow,tt,et)(it)}}function factoryDestination(o,et,tt,nt,rt,ot,it,st,at){const ct=at||Number.POSITIVE_INFINITY;let lt=0;return dt;function dt(gt){return gt===60?(o.enter(nt),o.enter(rt),o.enter(ot),o.consume(gt),o.exit(ot),ht):gt===null||gt===32||gt===41||asciiControl(gt)?tt(gt):(o.enter(nt),o.enter(it),o.enter(st),o.enter("chunkString",{contentType:"string"}),ft(gt))}function ht(gt){return gt===62?(o.enter(ot),o.consume(gt),o.exit(ot),o.exit(rt),o.exit(nt),et):(o.enter(st),o.enter("chunkString",{contentType:"string"}),pt(gt))}function pt(gt){return gt===62?(o.exit("chunkString"),o.exit(st),ht(gt)):gt===null||gt===60||markdownLineEnding(gt)?tt(gt):(o.consume(gt),gt===92?mt:pt)}function mt(gt){return gt===60||gt===62||gt===92?(o.consume(gt),pt):pt(gt)}function ft(gt){return!lt&&(gt===null||gt===41||markdownLineEndingOrSpace(gt))?(o.exit("chunkString"),o.exit(st),o.exit(it),o.exit(nt),et(gt)):lt999||pt===null||pt===91||pt===93&&!at||pt===94&&!st&&"_hiddenFootnoteSupport"in it.parser.constructs?tt(pt):pt===93?(o.exit(ot),o.enter(rt),o.consume(pt),o.exit(rt),o.exit(nt),et):markdownLineEnding(pt)?(o.enter("lineEnding"),o.consume(pt),o.exit("lineEnding"),lt):(o.enter("chunkString",{contentType:"string"}),dt(pt))}function dt(pt){return pt===null||pt===91||pt===93||markdownLineEnding(pt)||st++>999?(o.exit("chunkString"),lt(pt)):(o.consume(pt),at||(at=!markdownSpace(pt)),pt===92?ht:dt)}function ht(pt){return pt===91||pt===92||pt===93?(o.consume(pt),st++,dt):dt(pt)}}function factoryTitle(o,et,tt,nt,rt,ot){let it;return st;function st(ht){return ht===34||ht===39||ht===40?(o.enter(nt),o.enter(rt),o.consume(ht),o.exit(rt),it=ht===40?41:ht,at):tt(ht)}function at(ht){return ht===it?(o.enter(rt),o.consume(ht),o.exit(rt),o.exit(nt),et):(o.enter(ot),ct(ht))}function ct(ht){return ht===it?(o.exit(ot),at(it)):ht===null?tt(ht):markdownLineEnding(ht)?(o.enter("lineEnding"),o.consume(ht),o.exit("lineEnding"),factorySpace(o,ct,"linePrefix")):(o.enter("chunkString",{contentType:"string"}),lt(ht))}function lt(ht){return ht===it||ht===null||markdownLineEnding(ht)?(o.exit("chunkString"),ct(ht)):(o.consume(ht),ht===92?dt:lt)}function dt(ht){return ht===it||ht===92?(o.consume(ht),lt):lt(ht)}}function factoryWhitespace(o,et){let tt;return nt;function nt(rt){return markdownLineEnding(rt)?(o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),tt=!0,nt):markdownSpace(rt)?factorySpace(o,nt,tt?"linePrefix":"lineSuffix")(rt):et(rt)}}const definition={name:"definition",tokenize:tokenizeDefinition},titleBefore={tokenize:tokenizeTitleBefore,partial:!0};function tokenizeDefinition(o,et,tt){const nt=this;let rt;return ot;function ot(pt){return o.enter("definition"),it(pt)}function it(pt){return factoryLabel.call(nt,o,st,tt,"definitionLabel","definitionLabelMarker","definitionLabelString")(pt)}function st(pt){return rt=normalizeIdentifier(nt.sliceSerialize(nt.events[nt.events.length-1][1]).slice(1,-1)),pt===58?(o.enter("definitionMarker"),o.consume(pt),o.exit("definitionMarker"),at):tt(pt)}function at(pt){return markdownLineEndingOrSpace(pt)?factoryWhitespace(o,ct)(pt):ct(pt)}function ct(pt){return factoryDestination(o,lt,tt,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(pt)}function lt(pt){return o.attempt(titleBefore,dt,dt)(pt)}function dt(pt){return markdownSpace(pt)?factorySpace(o,ht,"whitespace")(pt):ht(pt)}function ht(pt){return pt===null||markdownLineEnding(pt)?(o.exit("definition"),nt.parser.defined.push(rt),et(pt)):tt(pt)}}function tokenizeTitleBefore(o,et,tt){return nt;function nt(st){return markdownLineEndingOrSpace(st)?factoryWhitespace(o,rt)(st):tt(st)}function rt(st){return factoryTitle(o,ot,tt,"definitionTitle","definitionTitleMarker","definitionTitleString")(st)}function ot(st){return markdownSpace(st)?factorySpace(o,it,"whitespace")(st):it(st)}function it(st){return st===null||markdownLineEnding(st)?et(st):tt(st)}}const hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(o,et,tt){return nt;function nt(ot){return o.enter("hardBreakEscape"),o.consume(ot),rt}function rt(ot){return markdownLineEnding(ot)?(o.exit("hardBreakEscape"),et(ot)):tt(ot)}}const headingAtx={name:"headingAtx",tokenize:tokenizeHeadingAtx,resolve:resolveHeadingAtx};function resolveHeadingAtx(o,et){let tt=o.length-2,nt=3,rt,ot;return o[nt][1].type==="whitespace"&&(nt+=2),tt-2>nt&&o[tt][1].type==="whitespace"&&(tt-=2),o[tt][1].type==="atxHeadingSequence"&&(nt===tt-1||tt-4>nt&&o[tt-2][1].type==="whitespace")&&(tt-=nt+1===tt?2:4),tt>nt&&(rt={type:"atxHeadingText",start:o[nt][1].start,end:o[tt][1].end},ot={type:"chunkText",start:o[nt][1].start,end:o[tt][1].end,contentType:"text"},splice(o,nt,tt-nt+1,[["enter",rt,et],["enter",ot,et],["exit",ot,et],["exit",rt,et]])),o}function tokenizeHeadingAtx(o,et,tt){let nt=0;return rt;function rt(lt){return o.enter("atxHeading"),ot(lt)}function ot(lt){return o.enter("atxHeadingSequence"),it(lt)}function it(lt){return lt===35&&nt++<6?(o.consume(lt),it):lt===null||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingSequence"),st(lt)):tt(lt)}function st(lt){return lt===35?(o.enter("atxHeadingSequence"),at(lt)):lt===null||markdownLineEnding(lt)?(o.exit("atxHeading"),et(lt)):markdownSpace(lt)?factorySpace(o,st,"whitespace")(lt):(o.enter("atxHeadingText"),ct(lt))}function at(lt){return lt===35?(o.consume(lt),at):(o.exit("atxHeadingSequence"),st(lt))}function ct(lt){return lt===null||lt===35||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingText"),st(lt)):(o.consume(lt),ct)}}const htmlBlockNames=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],htmlRawNames=["pre","script","style","textarea"],htmlFlow={name:"htmlFlow",tokenize:tokenizeHtmlFlow,resolveTo:resolveToHtmlFlow,concrete:!0},blankLineBefore={tokenize:tokenizeBlankLineBefore,partial:!0},nonLazyContinuationStart={tokenize:tokenizeNonLazyContinuationStart,partial:!0};function resolveToHtmlFlow(o){let et=o.length;for(;et--&&!(o[et][0]==="enter"&&o[et][1].type==="htmlFlow"););return et>1&&o[et-2][1].type==="linePrefix"&&(o[et][1].start=o[et-2][1].start,o[et+1][1].start=o[et-2][1].start,o.splice(et-2,2)),o}function tokenizeHtmlFlow(o,et,tt){const nt=this;let rt,ot,it,st,at;return ct;function ct(Nt){return lt(Nt)}function lt(Nt){return o.enter("htmlFlow"),o.enter("htmlFlowData"),o.consume(Nt),dt}function dt(Nt){return Nt===33?(o.consume(Nt),ht):Nt===47?(o.consume(Nt),ot=!0,ft):Nt===63?(o.consume(Nt),rt=3,nt.interrupt?et:Lt):asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function ht(Nt){return Nt===45?(o.consume(Nt),rt=2,pt):Nt===91?(o.consume(Nt),rt=5,st=0,mt):asciiAlpha(Nt)?(o.consume(Nt),rt=4,nt.interrupt?et:Lt):tt(Nt)}function pt(Nt){return Nt===45?(o.consume(Nt),nt.interrupt?et:Lt):tt(Nt)}function mt(Nt){const Gt="CDATA[";return Nt===Gt.charCodeAt(st++)?(o.consume(Nt),st===Gt.length?nt.interrupt?et:Ot:mt):tt(Nt)}function ft(Nt){return asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function yt(Nt){if(Nt===null||Nt===47||Nt===62||markdownLineEndingOrSpace(Nt)){const Gt=Nt===47,nn=it.toLowerCase();return!Gt&&!ot&&htmlRawNames.includes(nn)?(rt=1,nt.interrupt?et(Nt):Ot(Nt)):htmlBlockNames.includes(it.toLowerCase())?(rt=6,Gt?(o.consume(Nt),gt):nt.interrupt?et(Nt):Ot(Nt)):(rt=7,nt.interrupt&&!nt.parser.lazy[nt.now().line]?tt(Nt):ot?xt(Nt):vt(Nt))}return Nt===45||asciiAlphanumeric(Nt)?(o.consume(Nt),it+=String.fromCharCode(Nt),yt):tt(Nt)}function gt(Nt){return Nt===62?(o.consume(Nt),nt.interrupt?et:Ot):tt(Nt)}function xt(Nt){return markdownSpace(Nt)?(o.consume(Nt),xt):Pt(Nt)}function vt(Nt){return Nt===47?(o.consume(Nt),Pt):Nt===58||Nt===95||asciiAlpha(Nt)?(o.consume(Nt),bt):markdownSpace(Nt)?(o.consume(Nt),vt):Pt(Nt)}function bt(Nt){return Nt===45||Nt===46||Nt===58||Nt===95||asciiAlphanumeric(Nt)?(o.consume(Nt),bt):Et(Nt)}function Et(Nt){return Nt===61?(o.consume(Nt),wt):markdownSpace(Nt)?(o.consume(Nt),Et):vt(Nt)}function wt(Nt){return Nt===null||Nt===60||Nt===61||Nt===62||Nt===96?tt(Nt):Nt===34||Nt===39?(o.consume(Nt),at=Nt,kt):markdownSpace(Nt)?(o.consume(Nt),wt):It(Nt)}function kt(Nt){return Nt===at?(o.consume(Nt),at=null,Rt):Nt===null||markdownLineEnding(Nt)?tt(Nt):(o.consume(Nt),kt)}function It(Nt){return Nt===null||Nt===34||Nt===39||Nt===47||Nt===60||Nt===61||Nt===62||Nt===96||markdownLineEndingOrSpace(Nt)?Et(Nt):(o.consume(Nt),It)}function Rt(Nt){return Nt===47||Nt===62||markdownSpace(Nt)?vt(Nt):tt(Nt)}function Pt(Nt){return Nt===62?(o.consume(Nt),jt):tt(Nt)}function jt(Nt){return Nt===null||markdownLineEnding(Nt)?Ot(Nt):markdownSpace(Nt)?(o.consume(Nt),jt):tt(Nt)}function Ot(Nt){return Nt===45&&rt===2?(o.consume(Nt),Yt):Nt===60&&rt===1?(o.consume(Nt),Ht):Nt===62&&rt===4?(o.consume(Nt),Zt):Nt===63&&rt===3?(o.consume(Nt),Lt):Nt===93&&rt===5?(o.consume(Nt),qt):markdownLineEnding(Nt)&&(rt===6||rt===7)?(o.exit("htmlFlowData"),o.check(blankLineBefore,Qt,Bt)(Nt)):Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Bt(Nt)):(o.consume(Nt),Ot)}function Bt(Nt){return o.check(nonLazyContinuationStart,zt,Qt)(Nt)}function zt(Nt){return o.enter("lineEnding"),o.consume(Nt),o.exit("lineEnding"),Ft}function Ft(Nt){return Nt===null||markdownLineEnding(Nt)?Bt(Nt):(o.enter("htmlFlowData"),Ot(Nt))}function Yt(Nt){return Nt===45?(o.consume(Nt),Lt):Ot(Nt)}function Ht(Nt){return Nt===47?(o.consume(Nt),it="",Ut):Ot(Nt)}function Ut(Nt){if(Nt===62){const Gt=it.toLowerCase();return htmlRawNames.includes(Gt)?(o.consume(Nt),Zt):Ot(Nt)}return asciiAlpha(Nt)&&it.length<8?(o.consume(Nt),it+=String.fromCharCode(Nt),Ut):Ot(Nt)}function qt(Nt){return Nt===93?(o.consume(Nt),Lt):Ot(Nt)}function Lt(Nt){return Nt===62?(o.consume(Nt),Zt):Nt===45&&rt===2?(o.consume(Nt),Lt):Ot(Nt)}function Zt(Nt){return Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Qt(Nt)):(o.consume(Nt),Zt)}function Qt(Nt){return o.exit("htmlFlow"),et(Nt)}}function tokenizeNonLazyContinuationStart(o,et,tt){const nt=this;return rt;function rt(it){return markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot):tt(it)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}function tokenizeBlankLineBefore(o,et,tt){return nt;function nt(rt){return o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),o.attempt(blankLine,et,tt)}}const htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(o,et,tt){const nt=this;let rt,ot,it;return st;function st(Lt){return o.enter("htmlText"),o.enter("htmlTextData"),o.consume(Lt),at}function at(Lt){return Lt===33?(o.consume(Lt),ct):Lt===47?(o.consume(Lt),Et):Lt===63?(o.consume(Lt),vt):asciiAlpha(Lt)?(o.consume(Lt),It):tt(Lt)}function ct(Lt){return Lt===45?(o.consume(Lt),lt):Lt===91?(o.consume(Lt),ot=0,mt):asciiAlpha(Lt)?(o.consume(Lt),xt):tt(Lt)}function lt(Lt){return Lt===45?(o.consume(Lt),pt):tt(Lt)}function dt(Lt){return Lt===null?tt(Lt):Lt===45?(o.consume(Lt),ht):markdownLineEnding(Lt)?(it=dt,Ht(Lt)):(o.consume(Lt),dt)}function ht(Lt){return Lt===45?(o.consume(Lt),pt):dt(Lt)}function pt(Lt){return Lt===62?Yt(Lt):Lt===45?ht(Lt):dt(Lt)}function mt(Lt){const Zt="CDATA[";return Lt===Zt.charCodeAt(ot++)?(o.consume(Lt),ot===Zt.length?ft:mt):tt(Lt)}function ft(Lt){return Lt===null?tt(Lt):Lt===93?(o.consume(Lt),yt):markdownLineEnding(Lt)?(it=ft,Ht(Lt)):(o.consume(Lt),ft)}function yt(Lt){return Lt===93?(o.consume(Lt),gt):ft(Lt)}function gt(Lt){return Lt===62?Yt(Lt):Lt===93?(o.consume(Lt),gt):ft(Lt)}function xt(Lt){return Lt===null||Lt===62?Yt(Lt):markdownLineEnding(Lt)?(it=xt,Ht(Lt)):(o.consume(Lt),xt)}function vt(Lt){return Lt===null?tt(Lt):Lt===63?(o.consume(Lt),bt):markdownLineEnding(Lt)?(it=vt,Ht(Lt)):(o.consume(Lt),vt)}function bt(Lt){return Lt===62?Yt(Lt):vt(Lt)}function Et(Lt){return asciiAlpha(Lt)?(o.consume(Lt),wt):tt(Lt)}function wt(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),wt):kt(Lt)}function kt(Lt){return markdownLineEnding(Lt)?(it=kt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),kt):Yt(Lt)}function It(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),It):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Rt(Lt){return Lt===47?(o.consume(Lt),Yt):Lt===58||Lt===95||asciiAlpha(Lt)?(o.consume(Lt),Pt):markdownLineEnding(Lt)?(it=Rt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Rt):Yt(Lt)}function Pt(Lt){return Lt===45||Lt===46||Lt===58||Lt===95||asciiAlphanumeric(Lt)?(o.consume(Lt),Pt):jt(Lt)}function jt(Lt){return Lt===61?(o.consume(Lt),Ot):markdownLineEnding(Lt)?(it=jt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),jt):Rt(Lt)}function Ot(Lt){return Lt===null||Lt===60||Lt===61||Lt===62||Lt===96?tt(Lt):Lt===34||Lt===39?(o.consume(Lt),rt=Lt,Bt):markdownLineEnding(Lt)?(it=Ot,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Ot):(o.consume(Lt),zt)}function Bt(Lt){return Lt===rt?(o.consume(Lt),rt=void 0,Ft):Lt===null?tt(Lt):markdownLineEnding(Lt)?(it=Bt,Ht(Lt)):(o.consume(Lt),Bt)}function zt(Lt){return Lt===null||Lt===34||Lt===39||Lt===60||Lt===61||Lt===96?tt(Lt):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):(o.consume(Lt),zt)}function Ft(Lt){return Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Yt(Lt){return Lt===62?(o.consume(Lt),o.exit("htmlTextData"),o.exit("htmlText"),et):tt(Lt)}function Ht(Lt){return o.exit("htmlTextData"),o.enter("lineEnding"),o.consume(Lt),o.exit("lineEnding"),Ut}function Ut(Lt){return markdownSpace(Lt)?factorySpace(o,qt,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Lt):qt(Lt)}function qt(Lt){return o.enter("htmlTextData"),it(Lt)}}const labelEnd={name:"labelEnd",tokenize:tokenizeLabelEnd,resolveTo:resolveToLabelEnd,resolveAll:resolveAllLabelEnd},resourceConstruct={tokenize:tokenizeResource},referenceFullConstruct={tokenize:tokenizeReferenceFull},referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(o){let et=-1;for(;++et=3&&(ct===null||markdownLineEnding(ct))?(o.exit("thematicBreak"),et(ct)):tt(ct)}function at(ct){return ct===rt?(o.consume(ct),nt++,at):(o.exit("thematicBreakSequence"),markdownSpace(ct)?factorySpace(o,st,"whitespace")(ct):st(ct))}}const list$1={name:"list",tokenize:tokenizeListStart,continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd},listItemPrefixWhitespaceConstruct={tokenize:tokenizeListItemPrefixWhitespace,partial:!0},indentConstruct={tokenize:tokenizeIndent,partial:!0};function tokenizeListStart(o,et,tt){const nt=this,rt=nt.events[nt.events.length-1];let ot=rt&&rt[1].type==="linePrefix"?rt[2].sliceSerialize(rt[1],!0).length:0,it=0;return st;function st(pt){const mt=nt.containerState.type||(pt===42||pt===43||pt===45?"listUnordered":"listOrdered");if(mt==="listUnordered"?!nt.containerState.marker||pt===nt.containerState.marker:asciiDigit(pt)){if(nt.containerState.type||(nt.containerState.type=mt,o.enter(mt,{_container:!0})),mt==="listUnordered")return o.enter("listItemPrefix"),pt===42||pt===45?o.check(thematicBreak$1,tt,ct)(pt):ct(pt);if(!nt.interrupt||pt===49)return o.enter("listItemPrefix"),o.enter("listItemValue"),at(pt)}return tt(pt)}function at(pt){return asciiDigit(pt)&&++it<10?(o.consume(pt),at):(!nt.interrupt||it<2)&&(nt.containerState.marker?pt===nt.containerState.marker:pt===41||pt===46)?(o.exit("listItemValue"),ct(pt)):tt(pt)}function ct(pt){return o.enter("listItemMarker"),o.consume(pt),o.exit("listItemMarker"),nt.containerState.marker=nt.containerState.marker||pt,o.check(blankLine,nt.interrupt?tt:lt,o.attempt(listItemPrefixWhitespaceConstruct,ht,dt))}function lt(pt){return nt.containerState.initialBlankLine=!0,ot++,ht(pt)}function dt(pt){return markdownSpace(pt)?(o.enter("listItemPrefixWhitespace"),o.consume(pt),o.exit("listItemPrefixWhitespace"),ht):tt(pt)}function ht(pt){return nt.containerState.size=ot+nt.sliceSerialize(o.exit("listItemPrefix"),!0).length,et(pt)}}function tokenizeListContinuation(o,et,tt){const nt=this;return nt.containerState._closeFlow=void 0,o.check(blankLine,rt,ot);function rt(st){return nt.containerState.furtherBlankLines=nt.containerState.furtherBlankLines||nt.containerState.initialBlankLine,factorySpace(o,et,"listItemIndent",nt.containerState.size+1)(st)}function ot(st){return nt.containerState.furtherBlankLines||!markdownSpace(st)?(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,it(st)):(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,o.attempt(indentConstruct,et,it)(st))}function it(st){return nt.containerState._closeFlow=!0,nt.interrupt=void 0,factorySpace(o,o.attempt(list$1,et,tt),"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(st)}}function tokenizeIndent(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemIndent",nt.containerState.size+1);function rt(ot){const it=nt.events[nt.events.length-1];return it&&it[1].type==="listItemIndent"&&it[2].sliceSerialize(it[1],!0).length===nt.containerState.size?et(ot):tt(ot)}}function tokenizeListEnd(o){o.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemPrefixWhitespace",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function rt(ot){const it=nt.events[nt.events.length-1];return!markdownSpace(ot)&&it&&it[1].type==="listItemPrefixWhitespace"?et(ot):tt(ot)}}const setextUnderline={name:"setextUnderline",tokenize:tokenizeSetextUnderline,resolveTo:resolveToSetextUnderline};function resolveToSetextUnderline(o,et){let tt=o.length,nt,rt,ot;for(;tt--;)if(o[tt][0]==="enter"){if(o[tt][1].type==="content"){nt=tt;break}o[tt][1].type==="paragraph"&&(rt=tt)}else o[tt][1].type==="content"&&o.splice(tt,1),!ot&&o[tt][1].type==="definition"&&(ot=tt);const it={type:"setextHeading",start:Object.assign({},o[rt][1].start),end:Object.assign({},o[o.length-1][1].end)};return o[rt][1].type="setextHeadingText",ot?(o.splice(rt,0,["enter",it,et]),o.splice(ot+1,0,["exit",o[nt][1],et]),o[nt][1].end=Object.assign({},o[ot][1].end)):o[nt][1]=it,o.push(["exit",it,et]),o}function tokenizeSetextUnderline(o,et,tt){const nt=this;let rt;return ot;function ot(ct){let lt=nt.events.length,dt;for(;lt--;)if(nt.events[lt][1].type!=="lineEnding"&&nt.events[lt][1].type!=="linePrefix"&&nt.events[lt][1].type!=="content"){dt=nt.events[lt][1].type==="paragraph";break}return!nt.parser.lazy[nt.now().line]&&(nt.interrupt||dt)?(o.enter("setextHeadingLine"),rt=ct,it(ct)):tt(ct)}function it(ct){return o.enter("setextHeadingLineSequence"),st(ct)}function st(ct){return ct===rt?(o.consume(ct),st):(o.exit("setextHeadingLineSequence"),markdownSpace(ct)?factorySpace(o,at,"lineSuffix")(ct):at(ct))}function at(ct){return ct===null||markdownLineEnding(ct)?(o.exit("setextHeadingLine"),et(ct)):tt(ct)}}const flow$1={tokenize:initializeFlow};function initializeFlow(o){const et=this,tt=o.attempt(blankLine,nt,o.attempt(this.parser.constructs.flowInitial,rt,factorySpace(o,o.attempt(this.parser.constructs.flow,rt,o.attempt(content,rt)),"linePrefix")));return tt;function nt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEndingBlank"),o.consume(ot),o.exit("lineEndingBlank"),et.currentConstruct=void 0,tt}function rt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEnding"),o.consume(ot),o.exit("lineEnding"),et.currentConstruct=void 0,tt}}const resolver={resolveAll:createResolver()},string$1=initializeFactory("string"),text$2=initializeFactory("text");function initializeFactory(o){return{tokenize:et,resolveAll:createResolver(o==="text"?resolveAllLineSuffixes:void 0)};function et(tt){const nt=this,rt=this.parser.constructs[o],ot=tt.attempt(rt,it,st);return it;function it(lt){return ct(lt)?ot(lt):st(lt)}function st(lt){if(lt===null){tt.consume(lt);return}return tt.enter("data"),tt.consume(lt),at}function at(lt){return ct(lt)?(tt.exit("data"),ot(lt)):(tt.consume(lt),at)}function ct(lt){if(lt===null)return!0;const dt=rt[lt];let ht=-1;if(dt)for(;++ht-1){const st=it[0];typeof st=="string"?it[0]=st.slice(nt):it.shift()}ot>0&&it.push(o[rt].slice(0,ot))}return it}function serializeChunks(o,et){let tt=-1;const nt=[];let rt;for(;++tt0&&typeof nt.column=="number"&&nt.column>0)return{line:nt.line,column:nt.column,offset:typeof nt.offset=="number"&&nt.offset>-1?nt.offset:void 0}}}function position$1(o){const et=pointStart(o),tt=pointEnd(o);if(et&&tt)return{start:et,end:tt}}function stringifyPosition(o){return!o||typeof o!="object"?"":"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point$1(o):""}function point$1(o){return index(o&&o.line)+":"+index(o&&o.column)}function position(o){return point$1(o&&o.start)+"-"+point$1(o&&o.end)}function index(o){return o&&typeof o=="number"?o:1}class VFileMessage extends Error{constructor(et,tt,nt){super(),typeof tt=="string"&&(nt=tt,tt=void 0);let rt="",ot={},it=!1;if(tt&&("line"in tt&&"column"in tt?ot={place:tt}:"start"in tt&&"end"in tt?ot={place:tt}:"type"in tt?ot={ancestors:[tt],place:tt.position}:ot={...tt}),typeof et=="string"?rt=et:!ot.cause&&et&&(it=!0,rt=et.message,ot.cause=et),!ot.ruleId&&!ot.source&&typeof nt=="string"){const at=nt.indexOf(":");at===-1?ot.ruleId=nt:(ot.source=nt.slice(0,at),ot.ruleId=nt.slice(at+1))}if(!ot.place&&ot.ancestors&&ot.ancestors){const at=ot.ancestors[ot.ancestors.length-1];at&&(ot.place=at.position)}const st=ot.place&&"start"in ot.place?ot.place.start:ot.place;this.ancestors=ot.ancestors||void 0,this.cause=ot.cause||void 0,this.column=st?st.column:void 0,this.fatal=void 0,this.file,this.message=rt,this.line=st?st.line:void 0,this.name=stringifyPosition(ot.place)||"1:1",this.place=ot.place||void 0,this.reason=this.message,this.ruleId=ot.ruleId||void 0,this.source=ot.source||void 0,this.stack=it&&ot.cause&&typeof ot.cause.stack=="string"?ot.cause.stack:"",this.actual,this.expected,this.note,this.url}}VFileMessage.prototype.file="";VFileMessage.prototype.name="";VFileMessage.prototype.reason="";VFileMessage.prototype.message="";VFileMessage.prototype.stack="";VFileMessage.prototype.column=void 0;VFileMessage.prototype.line=void 0;VFileMessage.prototype.ancestors=void 0;VFileMessage.prototype.cause=void 0;VFileMessage.prototype.fatal=void 0;VFileMessage.prototype.place=void 0;VFileMessage.prototype.ruleId=void 0;VFileMessage.prototype.source=void 0;const own$3={}.hasOwnProperty,emptyMap=new Map,cap=/[A-Z]/g,dashSomething=/-([a-z])/g,tableElements=new Set(["table","tbody","thead","tfoot","tr"]),tableCellElement=new Set(["td","th"]),docs="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function toJsxRuntime(o,et){if(!et||et.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const tt=et.filePath||void 0;let nt;if(et.development){if(typeof et.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");nt=developmentCreate(tt,et.jsxDEV)}else{if(typeof et.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof et.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");nt=productionCreate(tt,et.jsx,et.jsxs)}const rt={Fragment:et.Fragment,ancestors:[],components:et.components||{},create:nt,elementAttributeNameCase:et.elementAttributeNameCase||"react",evaluater:et.createEvaluater?et.createEvaluater():void 0,filePath:tt,ignoreInvalidStyle:et.ignoreInvalidStyle||!1,passKeys:et.passKeys!==!1,passNode:et.passNode||!1,schema:et.space==="svg"?svg:html$1,stylePropertyNameCase:et.stylePropertyNameCase||"dom",tableCellAlignToStyle:et.tableCellAlignToStyle!==!1},ot=one$1(rt,o,void 0);return ot&&typeof ot!="string"?ot:rt.create(o,rt.Fragment,{children:ot||void 0},void 0)}function one$1(o,et,tt){if(et.type==="element")return element$1(o,et,tt);if(et.type==="mdxFlowExpression"||et.type==="mdxTextExpression")return mdxExpression(o,et);if(et.type==="mdxJsxFlowElement"||et.type==="mdxJsxTextElement")return mdxJsxElement(o,et,tt);if(et.type==="mdxjsEsm")return mdxEsm(o,et);if(et.type==="root")return root$1(o,et,tt);if(et.type==="text")return text$3(o,et)}function element$1(o,et,tt){const nt=o.schema;let rt=nt;et.tagName.toLowerCase()==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=findComponentFromName(o,et.tagName,!1),it=createElementProps(o,et);let st=createChildren(o,et);return tableElements.has(et.tagName)&&(st=st.filter(function(at){return typeof at=="string"?!whitespace(at):!0})),addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function mdxExpression(o,et){if(et.data&&et.data.estree&&o.evaluater){const nt=et.data.estree.body[0];return nt.type,o.evaluater.evaluateExpression(nt.expression)}crashEstree(o,et.position)}function mdxEsm(o,et){if(et.data&&et.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(et.data.estree);crashEstree(o,et.position)}function mdxJsxElement(o,et,tt){const nt=o.schema;let rt=nt;et.name==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=et.name===null?o.Fragment:findComponentFromName(o,et.name,!0),it=createJsxElementProps(o,et),st=createChildren(o,et);return addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function root$1(o,et,tt){const nt={};return addChildren(nt,createChildren(o,et)),o.create(et,o.Fragment,nt,tt)}function text$3(o,et){return et.value}function addNode(o,et,tt,nt){typeof tt!="string"&&tt!==o.Fragment&&o.passNode&&(et.node=nt)}function addChildren(o,et){if(et.length>0){const tt=et.length>1?et:et[0];tt&&(o.children=tt)}}function productionCreate(o,et,tt){return nt;function nt(rt,ot,it,st){const ct=Array.isArray(it.children)?tt:et;return st?ct(ot,it,st):ct(ot,it)}}function developmentCreate(o,et){return tt;function tt(nt,rt,ot,it){const st=Array.isArray(ot.children),at=pointStart(nt);return et(rt,ot,it,st,{columnNumber:at?at.column-1:void 0,fileName:o,lineNumber:at?at.line:void 0},void 0)}}function createElementProps(o,et){const tt={};let nt,rt;for(rt in et.properties)if(rt!=="children"&&own$3.call(et.properties,rt)){const ot=createProperty(o,rt,et.properties[rt]);if(ot){const[it,st]=ot;o.tableCellAlignToStyle&&it==="align"&&typeof st=="string"&&tableCellElement.has(et.tagName)?nt=st:tt[it]=st}}if(nt){const ot=tt.style||(tt.style={});ot[o.stylePropertyNameCase==="css"?"text-align":"textAlign"]=nt}return tt}function createJsxElementProps(o,et){const tt={};for(const nt of et.attributes)if(nt.type==="mdxJsxExpressionAttribute")if(nt.data&&nt.data.estree&&o.evaluater){const ot=nt.data.estree.body[0];ot.type;const it=ot.expression;it.type;const st=it.properties[0];st.type,Object.assign(tt,o.evaluater.evaluateExpression(st.argument))}else crashEstree(o,et.position);else{const rt=nt.name;let ot;if(nt.value&&typeof nt.value=="object")if(nt.value.data&&nt.value.data.estree&&o.evaluater){const st=nt.value.data.estree.body[0];st.type,ot=o.evaluater.evaluateExpression(st.expression)}else crashEstree(o,et.position);else ot=nt.value===null?!0:nt.value;tt[rt]=ot}return tt}function createChildren(o,et){const tt=[];let nt=-1;const rt=o.passKeys?new Map:emptyMap;for(;++ntrt?0:rt+et:et=et>rt?rt:et,tt=tt>0?tt:0,nt.length<1e4)it=Array.from(nt),it.unshift(et,tt),o.splice(...it);else for(tt&&o.splice(et,tt);ot0?(splice(o,o.length,0,et),o):et}const hasOwnProperty={}.hasOwnProperty;function combineExtensions(o){const et={};let tt=-1;for(;++tt13&&tt<32||tt>126&&tt<160||tt>55295&&tt<57344||tt>64975&&tt<65008||(tt&65535)===65535||(tt&65535)===65534||tt>1114111?"�":String.fromCodePoint(tt)}function normalizeIdentifier(o){return o.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(o){return o!==null&&(o<32||o===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(o){return o!==null&&o<-2}function markdownLineEndingOrSpace(o){return o!==null&&(o<0||o===32)}function markdownSpace(o){return o===-2||o===-1||o===32}const unicodePunctuation=regexCheck(new RegExp("\\p{P}|\\p{S}","u")),unicodeWhitespace=regexCheck(/\s/);function regexCheck(o){return et;function et(tt){return tt!==null&&tt>-1&&o.test(String.fromCharCode(tt))}}function normalizeUri(o){const et=[];let tt=-1,nt=0,rt=0;for(;++tt55295&&ot<57344){const st=o.charCodeAt(tt+1);ot<56320&&st>56319&&st<57344?(it=String.fromCharCode(ot,st),rt=1):it="�"}else it=String.fromCharCode(ot);it&&(et.push(o.slice(nt,tt),encodeURIComponent(it)),nt=tt+rt+1,it=""),rt&&(tt+=rt,rt=0)}return et.join("")+o.slice(nt)}function factorySpace(o,et,tt,nt){const rt=nt?nt-1:Number.POSITIVE_INFINITY;let ot=0;return it;function it(at){return markdownSpace(at)?(o.enter(tt),st(at)):et(at)}function st(at){return markdownSpace(at)&&ot++it))return;const kt=et.events.length;let It=kt,Rt,$t;for(;It--;)if(et.events[It][0]==="exit"&&et.events[It][1].type==="chunkFlow"){if(Rt){$t=et.events[It][1].end;break}Rt=!0}for(gt(nt),wt=kt;wtvt;){const Et=tt[bt];et.containerState=Et[1],Et[0].exit.call(et,o)}tt.length=vt}function xt(){rt.write([null]),ot=void 0,rt=void 0,et.containerState._closeFlow=void 0}}function tokenizeContainer(o,et,tt){return factorySpace(o,o.attempt(this.parser.constructs.document,et,tt),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(o){if(o===null||markdownLineEndingOrSpace(o)||unicodeWhitespace(o))return 1;if(unicodePunctuation(o))return 2}function resolveAll(o,et,tt){const nt=[];let rt=-1;for(;++rt1&&o[tt][1].end.offset-o[tt][1].start.offset>1?2:1;const dt={...o[nt][1].end},ht={...o[tt][1].start};movePoint(dt,-at),movePoint(ht,at),it={type:at>1?"strongSequence":"emphasisSequence",start:dt,end:{...o[nt][1].end}},st={type:at>1?"strongSequence":"emphasisSequence",start:{...o[tt][1].start},end:ht},ot={type:at>1?"strongText":"emphasisText",start:{...o[nt][1].end},end:{...o[tt][1].start}},rt={type:at>1?"strong":"emphasis",start:{...it.start},end:{...st.end}},o[nt][1].end={...it.start},o[tt][1].start={...st.end},ct=[],o[nt][1].end.offset-o[nt][1].start.offset&&(ct=push(ct,[["enter",o[nt][1],et],["exit",o[nt][1],et]])),ct=push(ct,[["enter",rt,et],["enter",it,et],["exit",it,et],["enter",ot,et]]),ct=push(ct,resolveAll(et.parser.constructs.insideSpan.null,o.slice(nt+1,tt),et)),ct=push(ct,[["exit",ot,et],["enter",st,et],["exit",st,et],["exit",rt,et]]),o[tt][1].end.offset-o[tt][1].start.offset?(lt=2,ct=push(ct,[["enter",o[tt][1],et],["exit",o[tt][1],et]])):lt=0,splice(o,nt-1,tt-nt+3,ct),tt=nt+ct.length-lt-2;break}}for(tt=-1;++tt0&&markdownSpace(wt)?factorySpace(o,xt,"linePrefix",ot+1)(wt):xt(wt)}function xt(wt){return wt===null||markdownLineEnding(wt)?o.check(nonLazyContinuation,pt,bt)(wt):(o.enter("codeFlowValue"),vt(wt))}function vt(wt){return wt===null||markdownLineEnding(wt)?(o.exit("codeFlowValue"),xt(wt)):(o.consume(wt),vt)}function bt(wt){return o.exit("codeFenced"),et(wt)}function Et(wt,kt,It){let Rt=0;return $t;function $t(Ft){return wt.enter("lineEnding"),wt.consume(Ft),wt.exit("lineEnding"),Nt}function Nt(Ft){return wt.enter("codeFencedFence"),markdownSpace(Ft)?factorySpace(wt,Mt,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Ft):Mt(Ft)}function Mt(Ft){return Ft===st?(wt.enter("codeFencedFenceSequence"),Bt(Ft)):It(Ft)}function Bt(Ft){return Ft===st?(Rt++,wt.consume(Ft),Bt):Rt>=it?(wt.exit("codeFencedFenceSequence"),markdownSpace(Ft)?factorySpace(wt,zt,"whitespace")(Ft):zt(Ft)):It(Ft)}function zt(Ft){return Ft===null||markdownLineEnding(Ft)?(wt.exit("codeFencedFence"),kt(Ft)):It(Ft)}}}function tokenizeNonLazyContinuation(o,et,tt){const nt=this;return rt;function rt(it){return it===null?tt(it):(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}const codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented},furtherStart={partial:!0,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(o,et,tt){const nt=this;return rt;function rt(ct){return o.enter("codeIndented"),factorySpace(o,ot,"linePrefix",5)(ct)}function ot(ct){const lt=nt.events[nt.events.length-1];return lt&<[1].type==="linePrefix"&<[2].sliceSerialize(lt[1],!0).length>=4?it(ct):tt(ct)}function it(ct){return ct===null?at(ct):markdownLineEnding(ct)?o.attempt(furtherStart,it,at)(ct):(o.enter("codeFlowValue"),st(ct))}function st(ct){return ct===null||markdownLineEnding(ct)?(o.exit("codeFlowValue"),it(ct)):(o.consume(ct),st)}function at(ct){return o.exit("codeIndented"),et(ct)}}function tokenizeFurtherStart(o,et,tt){const nt=this;return rt;function rt(it){return nt.parser.lazy[nt.now().line]?tt(it):markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),rt):factorySpace(o,ot,"linePrefix",5)(it)}function ot(it){const st=nt.events[nt.events.length-1];return st&&st[1].type==="linePrefix"&&st[2].sliceSerialize(st[1],!0).length>=4?et(it):markdownLineEnding(it)?rt(it):tt(it)}}const codeText={name:"codeText",previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(o){let et=o.length-4,tt=3,nt,rt;if((o[tt][1].type==="lineEnding"||o[tt][1].type==="space")&&(o[et][1].type==="lineEnding"||o[et][1].type==="space")){for(nt=tt;++nt=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+et+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return etthis.left.length)return this.right.slice(this.right.length-nt+this.left.length,this.right.length-et+this.left.length).reverse();const rt=this.left.slice(et);return rt.push(...this.right.slice(this.right.length-nt+this.left.length).reverse()),rt}splice(et,tt,nt){const rt=tt||0;this.setCursor(Math.trunc(et));const ot=this.right.splice(this.right.length-rt,Number.POSITIVE_INFINITY);return nt&&chunkedPush(this.left,nt),ot.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(et){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(et)}pushMany(et){this.setCursor(Number.POSITIVE_INFINITY),chunkedPush(this.left,et)}unshift(et){this.setCursor(0),this.right.push(et)}unshiftMany(et){this.setCursor(0),chunkedPush(this.right,et.reverse())}setCursor(et){if(!(et===this.left.length||et>this.left.length&&this.right.length===0||et<0&&this.left.length===0))if(et=4?et(it):o.interrupt(nt.parser.constructs.flow,tt,et)(it)}}function factoryDestination(o,et,tt,nt,rt,ot,it,st,at){const ct=at||Number.POSITIVE_INFINITY;let lt=0;return dt;function dt(gt){return gt===60?(o.enter(nt),o.enter(rt),o.enter(ot),o.consume(gt),o.exit(ot),ht):gt===null||gt===32||gt===41||asciiControl(gt)?tt(gt):(o.enter(nt),o.enter(it),o.enter(st),o.enter("chunkString",{contentType:"string"}),pt(gt))}function ht(gt){return gt===62?(o.enter(ot),o.consume(gt),o.exit(ot),o.exit(rt),o.exit(nt),et):(o.enter(st),o.enter("chunkString",{contentType:"string"}),ft(gt))}function ft(gt){return gt===62?(o.exit("chunkString"),o.exit(st),ht(gt)):gt===null||gt===60||markdownLineEnding(gt)?tt(gt):(o.consume(gt),gt===92?mt:ft)}function mt(gt){return gt===60||gt===62||gt===92?(o.consume(gt),ft):ft(gt)}function pt(gt){return!lt&&(gt===null||gt===41||markdownLineEndingOrSpace(gt))?(o.exit("chunkString"),o.exit(st),o.exit(it),o.exit(nt),et(gt)):lt999||ft===null||ft===91||ft===93&&!at||ft===94&&!st&&"_hiddenFootnoteSupport"in it.parser.constructs?tt(ft):ft===93?(o.exit(ot),o.enter(rt),o.consume(ft),o.exit(rt),o.exit(nt),et):markdownLineEnding(ft)?(o.enter("lineEnding"),o.consume(ft),o.exit("lineEnding"),lt):(o.enter("chunkString",{contentType:"string"}),dt(ft))}function dt(ft){return ft===null||ft===91||ft===93||markdownLineEnding(ft)||st++>999?(o.exit("chunkString"),lt(ft)):(o.consume(ft),at||(at=!markdownSpace(ft)),ft===92?ht:dt)}function ht(ft){return ft===91||ft===92||ft===93?(o.consume(ft),st++,dt):dt(ft)}}function factoryTitle(o,et,tt,nt,rt,ot){let it;return st;function st(ht){return ht===34||ht===39||ht===40?(o.enter(nt),o.enter(rt),o.consume(ht),o.exit(rt),it=ht===40?41:ht,at):tt(ht)}function at(ht){return ht===it?(o.enter(rt),o.consume(ht),o.exit(rt),o.exit(nt),et):(o.enter(ot),ct(ht))}function ct(ht){return ht===it?(o.exit(ot),at(it)):ht===null?tt(ht):markdownLineEnding(ht)?(o.enter("lineEnding"),o.consume(ht),o.exit("lineEnding"),factorySpace(o,ct,"linePrefix")):(o.enter("chunkString",{contentType:"string"}),lt(ht))}function lt(ht){return ht===it||ht===null||markdownLineEnding(ht)?(o.exit("chunkString"),ct(ht)):(o.consume(ht),ht===92?dt:lt)}function dt(ht){return ht===it||ht===92?(o.consume(ht),lt):lt(ht)}}function factoryWhitespace(o,et){let tt;return nt;function nt(rt){return markdownLineEnding(rt)?(o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),tt=!0,nt):markdownSpace(rt)?factorySpace(o,nt,tt?"linePrefix":"lineSuffix")(rt):et(rt)}}const definition={name:"definition",tokenize:tokenizeDefinition},titleBefore={partial:!0,tokenize:tokenizeTitleBefore};function tokenizeDefinition(o,et,tt){const nt=this;let rt;return ot;function ot(ft){return o.enter("definition"),it(ft)}function it(ft){return factoryLabel.call(nt,o,st,tt,"definitionLabel","definitionLabelMarker","definitionLabelString")(ft)}function st(ft){return rt=normalizeIdentifier(nt.sliceSerialize(nt.events[nt.events.length-1][1]).slice(1,-1)),ft===58?(o.enter("definitionMarker"),o.consume(ft),o.exit("definitionMarker"),at):tt(ft)}function at(ft){return markdownLineEndingOrSpace(ft)?factoryWhitespace(o,ct)(ft):ct(ft)}function ct(ft){return factoryDestination(o,lt,tt,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(ft)}function lt(ft){return o.attempt(titleBefore,dt,dt)(ft)}function dt(ft){return markdownSpace(ft)?factorySpace(o,ht,"whitespace")(ft):ht(ft)}function ht(ft){return ft===null||markdownLineEnding(ft)?(o.exit("definition"),nt.parser.defined.push(rt),et(ft)):tt(ft)}}function tokenizeTitleBefore(o,et,tt){return nt;function nt(st){return markdownLineEndingOrSpace(st)?factoryWhitespace(o,rt)(st):tt(st)}function rt(st){return factoryTitle(o,ot,tt,"definitionTitle","definitionTitleMarker","definitionTitleString")(st)}function ot(st){return markdownSpace(st)?factorySpace(o,it,"whitespace")(st):it(st)}function it(st){return st===null||markdownLineEnding(st)?et(st):tt(st)}}const hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(o,et,tt){return nt;function nt(ot){return o.enter("hardBreakEscape"),o.consume(ot),rt}function rt(ot){return markdownLineEnding(ot)?(o.exit("hardBreakEscape"),et(ot)):tt(ot)}}const headingAtx={name:"headingAtx",resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(o,et){let tt=o.length-2,nt=3,rt,ot;return o[nt][1].type==="whitespace"&&(nt+=2),tt-2>nt&&o[tt][1].type==="whitespace"&&(tt-=2),o[tt][1].type==="atxHeadingSequence"&&(nt===tt-1||tt-4>nt&&o[tt-2][1].type==="whitespace")&&(tt-=nt+1===tt?2:4),tt>nt&&(rt={type:"atxHeadingText",start:o[nt][1].start,end:o[tt][1].end},ot={type:"chunkText",start:o[nt][1].start,end:o[tt][1].end,contentType:"text"},splice(o,nt,tt-nt+1,[["enter",rt,et],["enter",ot,et],["exit",ot,et],["exit",rt,et]])),o}function tokenizeHeadingAtx(o,et,tt){let nt=0;return rt;function rt(lt){return o.enter("atxHeading"),ot(lt)}function ot(lt){return o.enter("atxHeadingSequence"),it(lt)}function it(lt){return lt===35&&nt++<6?(o.consume(lt),it):lt===null||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingSequence"),st(lt)):tt(lt)}function st(lt){return lt===35?(o.enter("atxHeadingSequence"),at(lt)):lt===null||markdownLineEnding(lt)?(o.exit("atxHeading"),et(lt)):markdownSpace(lt)?factorySpace(o,st,"whitespace")(lt):(o.enter("atxHeadingText"),ct(lt))}function at(lt){return lt===35?(o.consume(lt),at):(o.exit("atxHeadingSequence"),st(lt))}function ct(lt){return lt===null||lt===35||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingText"),st(lt)):(o.consume(lt),ct)}}const htmlBlockNames=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],htmlRawNames=["pre","script","style","textarea"],htmlFlow={concrete:!0,name:"htmlFlow",resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow},blankLineBefore={partial:!0,tokenize:tokenizeBlankLineBefore},nonLazyContinuationStart={partial:!0,tokenize:tokenizeNonLazyContinuationStart};function resolveToHtmlFlow(o){let et=o.length;for(;et--&&!(o[et][0]==="enter"&&o[et][1].type==="htmlFlow"););return et>1&&o[et-2][1].type==="linePrefix"&&(o[et][1].start=o[et-2][1].start,o[et+1][1].start=o[et-2][1].start,o.splice(et-2,2)),o}function tokenizeHtmlFlow(o,et,tt){const nt=this;let rt,ot,it,st,at;return ct;function ct(Lt){return lt(Lt)}function lt(Lt){return o.enter("htmlFlow"),o.enter("htmlFlowData"),o.consume(Lt),dt}function dt(Lt){return Lt===33?(o.consume(Lt),ht):Lt===47?(o.consume(Lt),ot=!0,pt):Lt===63?(o.consume(Lt),rt=3,nt.interrupt?et:Pt):asciiAlpha(Lt)?(o.consume(Lt),it=String.fromCharCode(Lt),yt):tt(Lt)}function ht(Lt){return Lt===45?(o.consume(Lt),rt=2,ft):Lt===91?(o.consume(Lt),rt=5,st=0,mt):asciiAlpha(Lt)?(o.consume(Lt),rt=4,nt.interrupt?et:Pt):tt(Lt)}function ft(Lt){return Lt===45?(o.consume(Lt),nt.interrupt?et:Pt):tt(Lt)}function mt(Lt){const Gt="CDATA[";return Lt===Gt.charCodeAt(st++)?(o.consume(Lt),st===Gt.length?nt.interrupt?et:Mt:mt):tt(Lt)}function pt(Lt){return asciiAlpha(Lt)?(o.consume(Lt),it=String.fromCharCode(Lt),yt):tt(Lt)}function yt(Lt){if(Lt===null||Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)){const Gt=Lt===47,nn=it.toLowerCase();return!Gt&&!ot&&htmlRawNames.includes(nn)?(rt=1,nt.interrupt?et(Lt):Mt(Lt)):htmlBlockNames.includes(it.toLowerCase())?(rt=6,Gt?(o.consume(Lt),gt):nt.interrupt?et(Lt):Mt(Lt)):(rt=7,nt.interrupt&&!nt.parser.lazy[nt.now().line]?tt(Lt):ot?xt(Lt):vt(Lt))}return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),it+=String.fromCharCode(Lt),yt):tt(Lt)}function gt(Lt){return Lt===62?(o.consume(Lt),nt.interrupt?et:Mt):tt(Lt)}function xt(Lt){return markdownSpace(Lt)?(o.consume(Lt),xt):$t(Lt)}function vt(Lt){return Lt===47?(o.consume(Lt),$t):Lt===58||Lt===95||asciiAlpha(Lt)?(o.consume(Lt),bt):markdownSpace(Lt)?(o.consume(Lt),vt):$t(Lt)}function bt(Lt){return Lt===45||Lt===46||Lt===58||Lt===95||asciiAlphanumeric(Lt)?(o.consume(Lt),bt):Et(Lt)}function Et(Lt){return Lt===61?(o.consume(Lt),wt):markdownSpace(Lt)?(o.consume(Lt),Et):vt(Lt)}function wt(Lt){return Lt===null||Lt===60||Lt===61||Lt===62||Lt===96?tt(Lt):Lt===34||Lt===39?(o.consume(Lt),at=Lt,kt):markdownSpace(Lt)?(o.consume(Lt),wt):It(Lt)}function kt(Lt){return Lt===at?(o.consume(Lt),at=null,Rt):Lt===null||markdownLineEnding(Lt)?tt(Lt):(o.consume(Lt),kt)}function It(Lt){return Lt===null||Lt===34||Lt===39||Lt===47||Lt===60||Lt===61||Lt===62||Lt===96||markdownLineEndingOrSpace(Lt)?Et(Lt):(o.consume(Lt),It)}function Rt(Lt){return Lt===47||Lt===62||markdownSpace(Lt)?vt(Lt):tt(Lt)}function $t(Lt){return Lt===62?(o.consume(Lt),Nt):tt(Lt)}function Nt(Lt){return Lt===null||markdownLineEnding(Lt)?Mt(Lt):markdownSpace(Lt)?(o.consume(Lt),Nt):tt(Lt)}function Mt(Lt){return Lt===45&&rt===2?(o.consume(Lt),Yt):Lt===60&&rt===1?(o.consume(Lt),Ht):Lt===62&&rt===4?(o.consume(Lt),Zt):Lt===63&&rt===3?(o.consume(Lt),Pt):Lt===93&&rt===5?(o.consume(Lt),qt):markdownLineEnding(Lt)&&(rt===6||rt===7)?(o.exit("htmlFlowData"),o.check(blankLineBefore,Qt,Bt)(Lt)):Lt===null||markdownLineEnding(Lt)?(o.exit("htmlFlowData"),Bt(Lt)):(o.consume(Lt),Mt)}function Bt(Lt){return o.check(nonLazyContinuationStart,zt,Qt)(Lt)}function zt(Lt){return o.enter("lineEnding"),o.consume(Lt),o.exit("lineEnding"),Ft}function Ft(Lt){return Lt===null||markdownLineEnding(Lt)?Bt(Lt):(o.enter("htmlFlowData"),Mt(Lt))}function Yt(Lt){return Lt===45?(o.consume(Lt),Pt):Mt(Lt)}function Ht(Lt){return Lt===47?(o.consume(Lt),it="",Ut):Mt(Lt)}function Ut(Lt){if(Lt===62){const Gt=it.toLowerCase();return htmlRawNames.includes(Gt)?(o.consume(Lt),Zt):Mt(Lt)}return asciiAlpha(Lt)&&it.length<8?(o.consume(Lt),it+=String.fromCharCode(Lt),Ut):Mt(Lt)}function qt(Lt){return Lt===93?(o.consume(Lt),Pt):Mt(Lt)}function Pt(Lt){return Lt===62?(o.consume(Lt),Zt):Lt===45&&rt===2?(o.consume(Lt),Pt):Mt(Lt)}function Zt(Lt){return Lt===null||markdownLineEnding(Lt)?(o.exit("htmlFlowData"),Qt(Lt)):(o.consume(Lt),Zt)}function Qt(Lt){return o.exit("htmlFlow"),et(Lt)}}function tokenizeNonLazyContinuationStart(o,et,tt){const nt=this;return rt;function rt(it){return markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot):tt(it)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}function tokenizeBlankLineBefore(o,et,tt){return nt;function nt(rt){return o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),o.attempt(blankLine,et,tt)}}const htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(o,et,tt){const nt=this;let rt,ot,it;return st;function st(Pt){return o.enter("htmlText"),o.enter("htmlTextData"),o.consume(Pt),at}function at(Pt){return Pt===33?(o.consume(Pt),ct):Pt===47?(o.consume(Pt),Et):Pt===63?(o.consume(Pt),vt):asciiAlpha(Pt)?(o.consume(Pt),It):tt(Pt)}function ct(Pt){return Pt===45?(o.consume(Pt),lt):Pt===91?(o.consume(Pt),ot=0,mt):asciiAlpha(Pt)?(o.consume(Pt),xt):tt(Pt)}function lt(Pt){return Pt===45?(o.consume(Pt),ft):tt(Pt)}function dt(Pt){return Pt===null?tt(Pt):Pt===45?(o.consume(Pt),ht):markdownLineEnding(Pt)?(it=dt,Ht(Pt)):(o.consume(Pt),dt)}function ht(Pt){return Pt===45?(o.consume(Pt),ft):dt(Pt)}function ft(Pt){return Pt===62?Yt(Pt):Pt===45?ht(Pt):dt(Pt)}function mt(Pt){const Zt="CDATA[";return Pt===Zt.charCodeAt(ot++)?(o.consume(Pt),ot===Zt.length?pt:mt):tt(Pt)}function pt(Pt){return Pt===null?tt(Pt):Pt===93?(o.consume(Pt),yt):markdownLineEnding(Pt)?(it=pt,Ht(Pt)):(o.consume(Pt),pt)}function yt(Pt){return Pt===93?(o.consume(Pt),gt):pt(Pt)}function gt(Pt){return Pt===62?Yt(Pt):Pt===93?(o.consume(Pt),gt):pt(Pt)}function xt(Pt){return Pt===null||Pt===62?Yt(Pt):markdownLineEnding(Pt)?(it=xt,Ht(Pt)):(o.consume(Pt),xt)}function vt(Pt){return Pt===null?tt(Pt):Pt===63?(o.consume(Pt),bt):markdownLineEnding(Pt)?(it=vt,Ht(Pt)):(o.consume(Pt),vt)}function bt(Pt){return Pt===62?Yt(Pt):vt(Pt)}function Et(Pt){return asciiAlpha(Pt)?(o.consume(Pt),wt):tt(Pt)}function wt(Pt){return Pt===45||asciiAlphanumeric(Pt)?(o.consume(Pt),wt):kt(Pt)}function kt(Pt){return markdownLineEnding(Pt)?(it=kt,Ht(Pt)):markdownSpace(Pt)?(o.consume(Pt),kt):Yt(Pt)}function It(Pt){return Pt===45||asciiAlphanumeric(Pt)?(o.consume(Pt),It):Pt===47||Pt===62||markdownLineEndingOrSpace(Pt)?Rt(Pt):tt(Pt)}function Rt(Pt){return Pt===47?(o.consume(Pt),Yt):Pt===58||Pt===95||asciiAlpha(Pt)?(o.consume(Pt),$t):markdownLineEnding(Pt)?(it=Rt,Ht(Pt)):markdownSpace(Pt)?(o.consume(Pt),Rt):Yt(Pt)}function $t(Pt){return Pt===45||Pt===46||Pt===58||Pt===95||asciiAlphanumeric(Pt)?(o.consume(Pt),$t):Nt(Pt)}function Nt(Pt){return Pt===61?(o.consume(Pt),Mt):markdownLineEnding(Pt)?(it=Nt,Ht(Pt)):markdownSpace(Pt)?(o.consume(Pt),Nt):Rt(Pt)}function Mt(Pt){return Pt===null||Pt===60||Pt===61||Pt===62||Pt===96?tt(Pt):Pt===34||Pt===39?(o.consume(Pt),rt=Pt,Bt):markdownLineEnding(Pt)?(it=Mt,Ht(Pt)):markdownSpace(Pt)?(o.consume(Pt),Mt):(o.consume(Pt),zt)}function Bt(Pt){return Pt===rt?(o.consume(Pt),rt=void 0,Ft):Pt===null?tt(Pt):markdownLineEnding(Pt)?(it=Bt,Ht(Pt)):(o.consume(Pt),Bt)}function zt(Pt){return Pt===null||Pt===34||Pt===39||Pt===60||Pt===61||Pt===96?tt(Pt):Pt===47||Pt===62||markdownLineEndingOrSpace(Pt)?Rt(Pt):(o.consume(Pt),zt)}function Ft(Pt){return Pt===47||Pt===62||markdownLineEndingOrSpace(Pt)?Rt(Pt):tt(Pt)}function Yt(Pt){return Pt===62?(o.consume(Pt),o.exit("htmlTextData"),o.exit("htmlText"),et):tt(Pt)}function Ht(Pt){return o.exit("htmlTextData"),o.enter("lineEnding"),o.consume(Pt),o.exit("lineEnding"),Ut}function Ut(Pt){return markdownSpace(Pt)?factorySpace(o,qt,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Pt):qt(Pt)}function qt(Pt){return o.enter("htmlTextData"),it(Pt)}}const labelEnd={name:"labelEnd",resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd},resourceConstruct={tokenize:tokenizeResource},referenceFullConstruct={tokenize:tokenizeReferenceFull},referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(o){let et=-1;const tt=[];for(;++et=3&&(ct===null||markdownLineEnding(ct))?(o.exit("thematicBreak"),et(ct)):tt(ct)}function at(ct){return ct===rt?(o.consume(ct),nt++,at):(o.exit("thematicBreakSequence"),markdownSpace(ct)?factorySpace(o,st,"whitespace")(ct):st(ct))}}const list$1={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:"list",tokenize:tokenizeListStart},listItemPrefixWhitespaceConstruct={partial:!0,tokenize:tokenizeListItemPrefixWhitespace},indentConstruct={partial:!0,tokenize:tokenizeIndent};function tokenizeListStart(o,et,tt){const nt=this,rt=nt.events[nt.events.length-1];let ot=rt&&rt[1].type==="linePrefix"?rt[2].sliceSerialize(rt[1],!0).length:0,it=0;return st;function st(ft){const mt=nt.containerState.type||(ft===42||ft===43||ft===45?"listUnordered":"listOrdered");if(mt==="listUnordered"?!nt.containerState.marker||ft===nt.containerState.marker:asciiDigit(ft)){if(nt.containerState.type||(nt.containerState.type=mt,o.enter(mt,{_container:!0})),mt==="listUnordered")return o.enter("listItemPrefix"),ft===42||ft===45?o.check(thematicBreak$1,tt,ct)(ft):ct(ft);if(!nt.interrupt||ft===49)return o.enter("listItemPrefix"),o.enter("listItemValue"),at(ft)}return tt(ft)}function at(ft){return asciiDigit(ft)&&++it<10?(o.consume(ft),at):(!nt.interrupt||it<2)&&(nt.containerState.marker?ft===nt.containerState.marker:ft===41||ft===46)?(o.exit("listItemValue"),ct(ft)):tt(ft)}function ct(ft){return o.enter("listItemMarker"),o.consume(ft),o.exit("listItemMarker"),nt.containerState.marker=nt.containerState.marker||ft,o.check(blankLine,nt.interrupt?tt:lt,o.attempt(listItemPrefixWhitespaceConstruct,ht,dt))}function lt(ft){return nt.containerState.initialBlankLine=!0,ot++,ht(ft)}function dt(ft){return markdownSpace(ft)?(o.enter("listItemPrefixWhitespace"),o.consume(ft),o.exit("listItemPrefixWhitespace"),ht):tt(ft)}function ht(ft){return nt.containerState.size=ot+nt.sliceSerialize(o.exit("listItemPrefix"),!0).length,et(ft)}}function tokenizeListContinuation(o,et,tt){const nt=this;return nt.containerState._closeFlow=void 0,o.check(blankLine,rt,ot);function rt(st){return nt.containerState.furtherBlankLines=nt.containerState.furtherBlankLines||nt.containerState.initialBlankLine,factorySpace(o,et,"listItemIndent",nt.containerState.size+1)(st)}function ot(st){return nt.containerState.furtherBlankLines||!markdownSpace(st)?(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,it(st)):(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,o.attempt(indentConstruct,et,it)(st))}function it(st){return nt.containerState._closeFlow=!0,nt.interrupt=void 0,factorySpace(o,o.attempt(list$1,et,tt),"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(st)}}function tokenizeIndent(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemIndent",nt.containerState.size+1);function rt(ot){const it=nt.events[nt.events.length-1];return it&&it[1].type==="listItemIndent"&&it[2].sliceSerialize(it[1],!0).length===nt.containerState.size?et(ot):tt(ot)}}function tokenizeListEnd(o){o.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemPrefixWhitespace",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function rt(ot){const it=nt.events[nt.events.length-1];return!markdownSpace(ot)&&it&&it[1].type==="listItemPrefixWhitespace"?et(ot):tt(ot)}}const setextUnderline={name:"setextUnderline",resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(o,et){let tt=o.length,nt,rt,ot;for(;tt--;)if(o[tt][0]==="enter"){if(o[tt][1].type==="content"){nt=tt;break}o[tt][1].type==="paragraph"&&(rt=tt)}else o[tt][1].type==="content"&&o.splice(tt,1),!ot&&o[tt][1].type==="definition"&&(ot=tt);const it={type:"setextHeading",start:{...o[rt][1].start},end:{...o[o.length-1][1].end}};return o[rt][1].type="setextHeadingText",ot?(o.splice(rt,0,["enter",it,et]),o.splice(ot+1,0,["exit",o[nt][1],et]),o[nt][1].end={...o[ot][1].end}):o[nt][1]=it,o.push(["exit",it,et]),o}function tokenizeSetextUnderline(o,et,tt){const nt=this;let rt;return ot;function ot(ct){let lt=nt.events.length,dt;for(;lt--;)if(nt.events[lt][1].type!=="lineEnding"&&nt.events[lt][1].type!=="linePrefix"&&nt.events[lt][1].type!=="content"){dt=nt.events[lt][1].type==="paragraph";break}return!nt.parser.lazy[nt.now().line]&&(nt.interrupt||dt)?(o.enter("setextHeadingLine"),rt=ct,it(ct)):tt(ct)}function it(ct){return o.enter("setextHeadingLineSequence"),st(ct)}function st(ct){return ct===rt?(o.consume(ct),st):(o.exit("setextHeadingLineSequence"),markdownSpace(ct)?factorySpace(o,at,"lineSuffix")(ct):at(ct))}function at(ct){return ct===null||markdownLineEnding(ct)?(o.exit("setextHeadingLine"),et(ct)):tt(ct)}}const flow$1={tokenize:initializeFlow};function initializeFlow(o){const et=this,tt=o.attempt(blankLine,nt,o.attempt(this.parser.constructs.flowInitial,rt,factorySpace(o,o.attempt(this.parser.constructs.flow,rt,o.attempt(content,rt)),"linePrefix")));return tt;function nt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEndingBlank"),o.consume(ot),o.exit("lineEndingBlank"),et.currentConstruct=void 0,tt}function rt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEnding"),o.consume(ot),o.exit("lineEnding"),et.currentConstruct=void 0,tt}}const resolver={resolveAll:createResolver()},string$1=initializeFactory("string"),text$2=initializeFactory("text");function initializeFactory(o){return{resolveAll:createResolver(o==="text"?resolveAllLineSuffixes:void 0),tokenize:et};function et(tt){const nt=this,rt=this.parser.constructs[o],ot=tt.attempt(rt,it,st);return it;function it(lt){return ct(lt)?ot(lt):st(lt)}function st(lt){if(lt===null){tt.consume(lt);return}return tt.enter("data"),tt.consume(lt),at}function at(lt){return ct(lt)?(tt.exit("data"),ot(lt)):(tt.consume(lt),at)}function ct(lt){if(lt===null)return!0;const dt=rt[lt];let ht=-1;if(dt)for(;++ht-1){const st=it[0];typeof st=="string"?it[0]=st.slice(nt):it.shift()}ot>0&&it.push(o[rt].slice(0,ot))}return it}function serializeChunks(o,et){let tt=-1;const nt=[];let rt;for(;++tt0){const Kt=St.tokenStack[St.tokenStack.length-1];(Kt[1]||defaultOnError).call(St,void 0,Kt[0])}for(Tt.position={start:point(on.length>0?on[0][1].start:{line:1,column:1,offset:0}),end:point(on.length>0?on[on.length-2][1].end:{line:1,column:1,offset:0})},$t=-1;++$t0){const Kt=St.tokenStack[St.tokenStack.length-1];(Kt[1]||defaultOnError).call(St,void 0,Kt[0])}for(_t.position={start:point(on.length>0?on[0][1].start:{line:1,column:1,offset:0}),end:point(on.length>0?on[on.length-2][1].end:{line:1,column:1,offset:0})},Ot=-1;++Ot1?"-"+st:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(it)}]};o.patch(et,at);const ct={type:"element",tagName:"sup",properties:{},children:[at]};return o.patch(et,ct),o.applyData(et,ct)}function heading(o,et){const tt={type:"element",tagName:"h"+et.depth,properties:{},children:o.all(et)};return o.patch(et,tt),o.applyData(et,tt)}function html(o,et){if(o.options.allowDangerousHtml){const tt={type:"raw",value:et.value};return o.patch(et,tt),o.applyData(et,tt)}}function revert(o,et){const tt=et.referenceType;let nt="]";if(tt==="collapsed"?nt+="[]":tt==="full"&&(nt+="["+(et.label||et.identifier)+"]"),et.type==="imageReference")return[{type:"text",value:"!["+et.alt+nt}];const rt=o.all(et),ot=rt[0];ot&&ot.type==="text"?ot.value="["+ot.value:rt.unshift({type:"text",value:"["});const it=rt[rt.length-1];return it&&it.type==="text"?it.value+=nt:rt.push({type:"text",value:nt}),rt}function imageReference(o,et){const tt=String(et.identifier).toUpperCase(),nt=o.definitionById.get(tt);if(!nt)return revert(o,et);const rt={src:normalizeUri(nt.url||""),alt:et.alt};nt.title!==null&&nt.title!==void 0&&(rt.title=nt.title);const ot={type:"element",tagName:"img",properties:rt,children:[]};return o.patch(et,ot),o.applyData(et,ot)}function image(o,et){const tt={src:normalizeUri(et.url)};et.alt!==null&&et.alt!==void 0&&(tt.alt=et.alt),et.title!==null&&et.title!==void 0&&(tt.title=et.title);const nt={type:"element",tagName:"img",properties:tt,children:[]};return o.patch(et,nt),o.applyData(et,nt)}function inlineCode(o,et){const tt={type:"text",value:et.value.replace(/\r?\n|\r/g," ")};o.patch(et,tt);const nt={type:"element",tagName:"code",properties:{},children:[tt]};return o.patch(et,nt),o.applyData(et,nt)}function linkReference(o,et){const tt=String(et.identifier).toUpperCase(),nt=o.definitionById.get(tt);if(!nt)return revert(o,et);const rt={href:normalizeUri(nt.url||"")};nt.title!==null&&nt.title!==void 0&&(rt.title=nt.title);const ot={type:"element",tagName:"a",properties:rt,children:o.all(et)};return o.patch(et,ot),o.applyData(et,ot)}function link(o,et){const tt={href:normalizeUri(et.url)};et.title!==null&&et.title!==void 0&&(tt.title=et.title);const nt={type:"element",tagName:"a",properties:tt,children:o.all(et)};return o.patch(et,nt),o.applyData(et,nt)}function listItem(o,et,tt){const nt=o.all(et),rt=tt?listLoose(tt):listItemLoose(et),ot={},it=[];if(typeof et.checked=="boolean"){const lt=nt[0];let dt;lt&<.type==="element"&<.tagName==="p"?dt=lt:(dt={type:"element",tagName:"p",properties:{},children:[]},nt.unshift(dt)),dt.children.length>0&&dt.children.unshift({type:"text",value:" "}),dt.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:et.checked,disabled:!0},children:[]}),ot.className=["task-list-item"]}let st=-1;for(;++st1}function list(o,et){const tt={},nt=o.all(et);let rt=-1;for(typeof et.start=="number"&&et.start!==1&&(tt.start=et.start);++rt0){const it={type:"element",tagName:"tbody",properties:{},children:o.wrap(tt,!0)},st=pointStart(et.children[1]),at=pointEnd(et.children[et.children.length-1]);st&&at&&(it.position={start:st,end:at}),rt.push(it)}const ot={type:"element",tagName:"table",properties:{},children:o.wrap(rt,!0)};return o.patch(et,ot),o.applyData(et,ot)}function tableRow(o,et,tt){const nt=tt?tt.children:void 0,ot=(nt?nt.indexOf(et):1)===0?"th":"td",it=tt&&tt.type==="table"?tt.align:void 0,st=it?it.length:et.children.length;let at=-1;const ct=[];for(;++at0,!0),nt[0]),rt=nt.index+nt[0].length,nt=tt.exec(et);return ot.push(trimLine(et.slice(rt),rt>0,!1)),ot.join("")}function trimLine(o,et,tt){let nt=0,rt=o.length;if(et){let ot=o.codePointAt(nt);for(;ot===tab||ot===space;)nt++,ot=o.codePointAt(nt)}if(tt){let ot=o.codePointAt(rt-1);for(;ot===tab||ot===space;)rt--,ot=o.codePointAt(rt-1)}return rt>nt?o.slice(nt,rt):""}function text(o,et){const tt={type:"text",value:trimLines(String(et.value))};return o.patch(et,tt),o.applyData(et,tt)}function thematicBreak(o,et){const tt={type:"element",tagName:"hr",properties:{},children:[]};return o.patch(et,tt),o.applyData(et,tt)}const handlers={blockquote,break:hardBreak,code,delete:strikethrough,emphasis,footnoteReference,heading,html,imageReference,image,inlineCode,linkReference,link,listItem,list,paragraph,root,strong,table,tableCell,tableRow,text,thematicBreak,toml:ignore,yaml:ignore,definition:ignore,footnoteDefinition:ignore};function ignore(){}const VOID=-1,PRIMITIVE=0,ARRAY=1,OBJECT=2,DATE=3,REGEXP=4,MAP=5,SET=6,ERROR=7,BIGINT=8,env=typeof self=="object"?self:globalThis,deserializer=(o,et)=>{const tt=(rt,ot)=>(o.set(ot,rt),rt),nt=rt=>{if(o.has(rt))return o.get(rt);const[ot,it]=et[rt];switch(ot){case PRIMITIVE:case VOID:return tt(it,rt);case ARRAY:{const st=tt([],rt);for(const at of it)st.push(nt(at));return st}case OBJECT:{const st=tt({},rt);for(const[at,ct]of it)st[nt(at)]=nt(ct);return st}case DATE:return tt(new Date(it),rt);case REGEXP:{const{source:st,flags:at}=it;return tt(new RegExp(st,at),rt)}case MAP:{const st=tt(new Map,rt);for(const[at,ct]of it)st.set(nt(at),nt(ct));return st}case SET:{const st=tt(new Set,rt);for(const at of it)st.add(nt(at));return st}case ERROR:{const{name:st,message:at}=it;return tt(new env[st](at),rt)}case BIGINT:return tt(BigInt(it),rt);case"BigInt":return tt(Object(BigInt(it)),rt)}return tt(new env[ot](it),rt)};return nt},deserialize=o=>deserializer(new Map,o)(0),EMPTY="",{toString}={},{keys}=Object,typeOf=o=>{const et=typeof o;if(et!=="object"||!o)return[PRIMITIVE,et];const tt=toString.call(o).slice(8,-1);switch(tt){case"Array":return[ARRAY,EMPTY];case"Object":return[OBJECT,EMPTY];case"Date":return[DATE,EMPTY];case"RegExp":return[REGEXP,EMPTY];case"Map":return[MAP,EMPTY];case"Set":return[SET,EMPTY]}return tt.includes("Array")?[ARRAY,tt]:tt.includes("Error")?[ERROR,tt]:[OBJECT,tt]},shouldSkip=([o,et])=>o===PRIMITIVE&&(et==="function"||et==="symbol"),serializer=(o,et,tt,nt)=>{const rt=(it,st)=>{const at=nt.push(it)-1;return tt.set(st,at),at},ot=it=>{if(tt.has(it))return tt.get(it);let[st,at]=typeOf(it);switch(st){case PRIMITIVE:{let lt=it;switch(at){case"bigint":st=BIGINT,lt=it.toString();break;case"function":case"symbol":if(o)throw new TypeError("unable to serialize "+at);lt=null;break;case"undefined":return rt([VOID],it)}return rt([st,lt],it)}case ARRAY:{if(at)return rt([at,[...it]],it);const lt=[],dt=rt([st,lt],it);for(const ht of it)lt.push(ot(ht));return dt}case OBJECT:{if(at)switch(at){case"BigInt":return rt([at,it.toString()],it);case"Boolean":case"Number":case"String":return rt([at,it.valueOf()],it)}if(et&&"toJSON"in it)return ot(it.toJSON());const lt=[],dt=rt([st,lt],it);for(const ht of keys(it))(o||!shouldSkip(typeOf(it[ht])))&<.push([ot(ht),ot(it[ht])]);return dt}case DATE:return rt([st,it.toISOString()],it);case REGEXP:{const{source:lt,flags:dt}=it;return rt([st,{source:lt,flags:dt}],it)}case MAP:{const lt=[],dt=rt([st,lt],it);for(const[ht,pt]of it)(o||!(shouldSkip(typeOf(ht))||shouldSkip(typeOf(pt))))&<.push([ot(ht),ot(pt)]);return dt}case SET:{const lt=[],dt=rt([st,lt],it);for(const ht of it)(o||!shouldSkip(typeOf(ht)))&<.push(ot(ht));return dt}}const{message:ct}=it;return rt([st,{name:at,message:ct}],it)};return ot},serialize=(o,{json:et,lossy:tt}={})=>{const nt=[];return serializer(!(et||tt),!!et,new Map,nt)(o),nt},structuredClone$1=typeof structuredClone=="function"?(o,et)=>et&&("json"in et||"lossy"in et)?deserialize(serialize(o,et)):structuredClone(o):(o,et)=>deserialize(serialize(o,et));function defaultFootnoteBackContent(o,et){const tt=[{type:"text",value:"↩"}];return et>1&&tt.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(et)}]}),tt}function defaultFootnoteBackLabel(o,et){return"Back to reference "+(o+1)+(et>1?"-"+et:"")}function footer(o){const et=typeof o.options.clobberPrefix=="string"?o.options.clobberPrefix:"user-content-",tt=o.options.footnoteBackContent||defaultFootnoteBackContent,nt=o.options.footnoteBackLabel||defaultFootnoteBackLabel,rt=o.options.footnoteLabel||"Footnotes",ot=o.options.footnoteLabelTagName||"h2",it=o.options.footnoteLabelProperties||{className:["sr-only"]},st=[];let at=-1;for(;++at0&&mt.push({type:"text",value:" "});let xt=typeof tt=="string"?tt:tt(at,pt);typeof xt=="string"&&(xt={type:"text",value:xt}),mt.push({type:"element",tagName:"a",properties:{href:"#"+et+"fnref-"+ht+(pt>1?"-"+pt:""),dataFootnoteBackref:"",ariaLabel:typeof nt=="string"?nt:nt(at,pt),className:["data-footnote-backref"]},children:Array.isArray(xt)?xt:[xt]})}const yt=lt[lt.length-1];if(yt&&yt.type==="element"&&yt.tagName==="p"){const xt=yt.children[yt.children.length-1];xt&&xt.type==="text"?xt.value+=" ":yt.children.push({type:"text",value:" "}),yt.children.push(...mt)}else lt.push(...mt);const gt={type:"element",tagName:"li",properties:{id:et+"fn-"+ht},children:o.wrap(lt,!0)};o.patch(ct,gt),st.push(gt)}if(st.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:ot,properties:{...structuredClone$1(it),id:"footnote-label"},children:[{type:"text",value:rt}]},{type:"text",value:` +`});const ct={type:"element",tagName:"li",properties:ot,children:it};return o.patch(et,ct),o.applyData(et,ct)}function listLoose(o){let et=!1;if(o.type==="list"){et=o.spread||!1;const tt=o.children;let nt=-1;for(;!et&&++nt1}function list(o,et){const tt={},nt=o.all(et);let rt=-1;for(typeof et.start=="number"&&et.start!==1&&(tt.start=et.start);++rt0){const it={type:"element",tagName:"tbody",properties:{},children:o.wrap(tt,!0)},st=pointStart(et.children[1]),at=pointEnd(et.children[et.children.length-1]);st&&at&&(it.position={start:st,end:at}),rt.push(it)}const ot={type:"element",tagName:"table",properties:{},children:o.wrap(rt,!0)};return o.patch(et,ot),o.applyData(et,ot)}function tableRow(o,et,tt){const nt=tt?tt.children:void 0,ot=(nt?nt.indexOf(et):1)===0?"th":"td",it=tt&&tt.type==="table"?tt.align:void 0,st=it?it.length:et.children.length;let at=-1;const ct=[];for(;++at0,!0),nt[0]),rt=nt.index+nt[0].length,nt=tt.exec(et);return ot.push(trimLine(et.slice(rt),rt>0,!1)),ot.join("")}function trimLine(o,et,tt){let nt=0,rt=o.length;if(et){let ot=o.codePointAt(nt);for(;ot===tab||ot===space;)nt++,ot=o.codePointAt(nt)}if(tt){let ot=o.codePointAt(rt-1);for(;ot===tab||ot===space;)rt--,ot=o.codePointAt(rt-1)}return rt>nt?o.slice(nt,rt):""}function text(o,et){const tt={type:"text",value:trimLines(String(et.value))};return o.patch(et,tt),o.applyData(et,tt)}function thematicBreak(o,et){const tt={type:"element",tagName:"hr",properties:{},children:[]};return o.patch(et,tt),o.applyData(et,tt)}const handlers={blockquote,break:hardBreak,code,delete:strikethrough,emphasis,footnoteReference,heading,html,imageReference,image,inlineCode,linkReference,link,listItem,list,paragraph,root,strong,table,tableCell,tableRow,text,thematicBreak,toml:ignore,yaml:ignore,definition:ignore,footnoteDefinition:ignore};function ignore(){}const VOID=-1,PRIMITIVE=0,ARRAY=1,OBJECT=2,DATE=3,REGEXP=4,MAP=5,SET=6,ERROR=7,BIGINT=8,env=typeof self=="object"?self:globalThis,deserializer=(o,et)=>{const tt=(rt,ot)=>(o.set(ot,rt),rt),nt=rt=>{if(o.has(rt))return o.get(rt);const[ot,it]=et[rt];switch(ot){case PRIMITIVE:case VOID:return tt(it,rt);case ARRAY:{const st=tt([],rt);for(const at of it)st.push(nt(at));return st}case OBJECT:{const st=tt({},rt);for(const[at,ct]of it)st[nt(at)]=nt(ct);return st}case DATE:return tt(new Date(it),rt);case REGEXP:{const{source:st,flags:at}=it;return tt(new RegExp(st,at),rt)}case MAP:{const st=tt(new Map,rt);for(const[at,ct]of it)st.set(nt(at),nt(ct));return st}case SET:{const st=tt(new Set,rt);for(const at of it)st.add(nt(at));return st}case ERROR:{const{name:st,message:at}=it;return tt(new env[st](at),rt)}case BIGINT:return tt(BigInt(it),rt);case"BigInt":return tt(Object(BigInt(it)),rt)}return tt(new env[ot](it),rt)};return nt},deserialize=o=>deserializer(new Map,o)(0),EMPTY="",{toString}={},{keys}=Object,typeOf=o=>{const et=typeof o;if(et!=="object"||!o)return[PRIMITIVE,et];const tt=toString.call(o).slice(8,-1);switch(tt){case"Array":return[ARRAY,EMPTY];case"Object":return[OBJECT,EMPTY];case"Date":return[DATE,EMPTY];case"RegExp":return[REGEXP,EMPTY];case"Map":return[MAP,EMPTY];case"Set":return[SET,EMPTY]}return tt.includes("Array")?[ARRAY,tt]:tt.includes("Error")?[ERROR,tt]:[OBJECT,tt]},shouldSkip=([o,et])=>o===PRIMITIVE&&(et==="function"||et==="symbol"),serializer=(o,et,tt,nt)=>{const rt=(it,st)=>{const at=nt.push(it)-1;return tt.set(st,at),at},ot=it=>{if(tt.has(it))return tt.get(it);let[st,at]=typeOf(it);switch(st){case PRIMITIVE:{let lt=it;switch(at){case"bigint":st=BIGINT,lt=it.toString();break;case"function":case"symbol":if(o)throw new TypeError("unable to serialize "+at);lt=null;break;case"undefined":return rt([VOID],it)}return rt([st,lt],it)}case ARRAY:{if(at)return rt([at,[...it]],it);const lt=[],dt=rt([st,lt],it);for(const ht of it)lt.push(ot(ht));return dt}case OBJECT:{if(at)switch(at){case"BigInt":return rt([at,it.toString()],it);case"Boolean":case"Number":case"String":return rt([at,it.valueOf()],it)}if(et&&"toJSON"in it)return ot(it.toJSON());const lt=[],dt=rt([st,lt],it);for(const ht of keys(it))(o||!shouldSkip(typeOf(it[ht])))&<.push([ot(ht),ot(it[ht])]);return dt}case DATE:return rt([st,it.toISOString()],it);case REGEXP:{const{source:lt,flags:dt}=it;return rt([st,{source:lt,flags:dt}],it)}case MAP:{const lt=[],dt=rt([st,lt],it);for(const[ht,ft]of it)(o||!(shouldSkip(typeOf(ht))||shouldSkip(typeOf(ft))))&<.push([ot(ht),ot(ft)]);return dt}case SET:{const lt=[],dt=rt([st,lt],it);for(const ht of it)(o||!shouldSkip(typeOf(ht)))&<.push(ot(ht));return dt}}const{message:ct}=it;return rt([st,{name:at,message:ct}],it)};return ot},serialize=(o,{json:et,lossy:tt}={})=>{const nt=[];return serializer(!(et||tt),!!et,new Map,nt)(o),nt},structuredClone$1=typeof structuredClone=="function"?(o,et)=>et&&("json"in et||"lossy"in et)?deserialize(serialize(o,et)):structuredClone(o):(o,et)=>deserialize(serialize(o,et));function defaultFootnoteBackContent(o,et){const tt=[{type:"text",value:"↩"}];return et>1&&tt.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(et)}]}),tt}function defaultFootnoteBackLabel(o,et){return"Back to reference "+(o+1)+(et>1?"-"+et:"")}function footer(o){const et=typeof o.options.clobberPrefix=="string"?o.options.clobberPrefix:"user-content-",tt=o.options.footnoteBackContent||defaultFootnoteBackContent,nt=o.options.footnoteBackLabel||defaultFootnoteBackLabel,rt=o.options.footnoteLabel||"Footnotes",ot=o.options.footnoteLabelTagName||"h2",it=o.options.footnoteLabelProperties||{className:["sr-only"]},st=[];let at=-1;for(;++at0&&mt.push({type:"text",value:" "});let xt=typeof tt=="string"?tt:tt(at,ft);typeof xt=="string"&&(xt={type:"text",value:xt}),mt.push({type:"element",tagName:"a",properties:{href:"#"+et+"fnref-"+ht+(ft>1?"-"+ft:""),dataFootnoteBackref:"",ariaLabel:typeof nt=="string"?nt:nt(at,ft),className:["data-footnote-backref"]},children:Array.isArray(xt)?xt:[xt]})}const yt=lt[lt.length-1];if(yt&&yt.type==="element"&&yt.tagName==="p"){const xt=yt.children[yt.children.length-1];xt&&xt.type==="text"?xt.value+=" ":yt.children.push({type:"text",value:" "}),yt.children.push(...mt)}else lt.push(...mt);const gt={type:"element",tagName:"li",properties:{id:et+"fn-"+ht},children:o.wrap(lt,!0)};o.patch(ct,gt),st.push(gt)}if(st.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:ot,properties:{...structuredClone$1(it),id:"footnote-label"},children:[{type:"text",value:rt}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:o.wrap(st,!0)},{type:"text",value:` -`}]}}const convert=function(o){if(o==null)return ok;if(typeof o=="function")return castFactory(o);if(typeof o=="object")return Array.isArray(o)?anyFactory(o):propsFactory(o);if(typeof o=="string")return typeFactory(o);throw new Error("Expected function, string, or object as test")};function anyFactory(o){const et=[];let tt=-1;for(;++tt":""))+")"})}return ht;function ht(){let pt=empty,mt,ft,yt;if((!et||ot(at,ct,lt[lt.length-1]||void 0))&&(pt=toResult(tt(at,lt)),pt[0]===EXIT))return pt;if("children"in at&&at.children){const gt=at;if(gt.children&&pt[0]!==SKIP)for(ft=(nt?gt.children.length:-1)+it,yt=lt.concat(gt);ft>-1&&ft":""))+")"})}return ht;function ht(){let ft=empty,mt,pt,yt;if((!et||ot(at,ct,lt[lt.length-1]||void 0))&&(ft=toResult(tt(at,lt)),ft[0]===EXIT))return ft;if("children"in at&&at.children){const gt=at;if(gt.children&&ft[0]!==SKIP)for(pt=(nt?gt.children.length:-1)+it,yt=lt.concat(gt);pt>-1&&pt0&&tt.push({type:"text",value:` `}),tt}function trimMarkdownSpaceStart(o){let et=0,tt=o.charCodeAt(et);for(;tt===9||tt===32;)et++,tt=o.charCodeAt(et);return o.slice(et)}function toHast(o,et){const tt=createState(o,et),nt=tt.one(o,void 0),rt=footer(tt),ot=Array.isArray(nt)?{type:"root",children:nt}:nt||{type:"root",children:[]};return rt&&ot.children.push({type:"text",value:` -`},rt),ot}function remarkRehype(o,et){return o&&"run"in o?async function(tt,nt){const rt=toHast(tt,{file:nt,...et});await o.run(rt,nt)}:function(tt,nt){return toHast(tt,{file:nt,...o||et})}}function bail(o){if(o)throw o}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function o(et){return typeof Array.isArray=="function"?Array.isArray(et):toStr.call(et)==="[object Array]"},isPlainObject$1=function o(et){if(!et||toStr.call(et)!=="[object Object]")return!1;var tt=hasOwn.call(et,"constructor"),nt=et.constructor&&et.constructor.prototype&&hasOwn.call(et.constructor.prototype,"isPrototypeOf");if(et.constructor&&!tt&&!nt)return!1;var rt;for(rt in et);return typeof rt>"u"||hasOwn.call(et,rt)},setProperty=function o(et,tt){defineProperty&&tt.name==="__proto__"?defineProperty(et,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):et[tt.name]=tt.newValue},getProperty=function o(et,tt){if(tt==="__proto__")if(hasOwn.call(et,tt)){if(gOPD)return gOPD(et,tt).value}else return;return et[tt]},extend=function o(){var et,tt,nt,rt,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(rt);try{at=o.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return rt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,rt):at instanceof Error?rt(at):ot(at))}function rt(it,...st){tt||(tt=!0,et(it,...st))}function ot(it){rt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(o,et){if(et!==void 0&&typeof et!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(o);let tt=0,nt=-1,rt=o.length,ot;if(et===void 0||et.length===0||et.length>o.length){for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else nt<0&&(ot=!0,nt=rt+1);return nt<0?"":o.slice(tt,nt)}if(et===o)return"";let it=-1,st=et.length-1;for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else it<0&&(ot=!0,it=rt+1),st>-1&&(o.codePointAt(rt)===et.codePointAt(st--)?st<0&&(nt=rt):(st=-1,nt=it));return tt===nt?nt=it:nt<0&&(nt=o.length),o.slice(tt,nt)}function dirname(o){if(assertPath$1(o),o.length===0)return".";let et=-1,tt=o.length,nt;for(;--tt;)if(o.codePointAt(tt)===47){if(nt){et=tt;break}}else nt||(nt=!0);return et<0?o.codePointAt(0)===47?"/":".":et===1&&o.codePointAt(0)===47?"//":o.slice(0,et)}function extname(o){assertPath$1(o);let et=o.length,tt=-1,nt=0,rt=-1,ot=0,it;for(;et--;){const st=o.codePointAt(et);if(st===47){if(it){nt=et+1;break}continue}tt<0&&(it=!0,tt=et+1),st===46?rt<0?rt=et:ot!==1&&(ot=1):rt>-1&&(ot=-1)}return rt<0||tt<0||ot===0||ot===1&&rt===tt-1&&rt===nt+1?"":o.slice(rt,tt)}function join(...o){let et=-1,tt;for(;++et0&&o.codePointAt(o.length-1)===47&&(tt+="/"),et?"/"+tt:tt}function normalizeString(o,et){let tt="",nt=0,rt=-1,ot=0,it=-1,st,at;for(;++it<=o.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",nt=0):(tt=tt.slice(0,at),nt=tt.length-1-tt.lastIndexOf("/")),rt=it,ot=0;continue}}else if(tt.length>0){tt="",nt=0,rt=it,ot=0;continue}}et&&(tt=tt.length>0?tt+"/..":"..",nt=2)}else tt.length>0?tt+="/"+o.slice(rt+1,it):tt=o.slice(rt+1,it),nt=it-rt-1;rt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}const minproc={cwd};function cwd(){return"/"}function isUrl(o){return!!(o!==null&&typeof o=="object"&&"href"in o&&o.href&&"protocol"in o&&o.protocol&&o.auth===void 0)}function urlToPath(o){if(typeof o=="string")o=new URL(o);else if(!isUrl(o)){const et=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+o+"`");throw et.code="ERR_INVALID_ARG_TYPE",et}if(o.protocol!=="file:"){const et=new TypeError("The URL must be of scheme file");throw et.code="ERR_INVALID_URL_SCHEME",et}return getPathFromURLPosix(o)}function getPathFromURLPosix(o){if(o.hostname!==""){const nt=new TypeError('File URL host must be "localhost" or empty on darwin');throw nt.code="ERR_INVALID_FILE_URL_HOST",nt}const et=o.pathname;let tt=-1;for(;++tt0){let[pt,...mt]=lt;const ft=nt[ht][1];isPlainObject(ft)&&isPlainObject(pt)&&(pt=extend$1(!0,ft,pt)),nt[ht]=[ct,pt,...mt]}}}}const unified=new Processor().freeze();function assertParser(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `parser`")}function assertCompiler(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `compiler`")}function assertUnfrozen(o,et){if(et)throw new Error("Cannot call `"+o+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(o){if(!isPlainObject(o)||typeof o.type!="string")throw new TypeError("Expected node, got `"+o+"`")}function assertDone(o,et,tt){if(!tt)throw new Error("`"+o+"` finished async. Use `"+et+"` instead")}function vfile(o){return looksLikeAVFile(o)?o:new VFile(o)}function looksLikeAVFile(o){return!!(o&&typeof o=="object"&&"message"in o&&"messages"in o)}function looksLikeAValue(o){return typeof o=="string"||isUint8Array(o)}function isUint8Array(o){return!!(o&&typeof o=="object"&&"byteLength"in o&&"byteOffset"in o)}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(o){const et=o.allowedElements,tt=o.allowElement,nt=o.children||"",rt=o.className,ot=o.components,it=o.disallowedElements,st=o.rehypePlugins||emptyPlugins,at=o.remarkPlugins||emptyPlugins,ct=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=o.skipHtml,dt=o.unwrapDisallowed,ht=o.urlTransform||defaultUrlTransform,pt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),mt=new VFile;typeof nt=="string"&&(mt.value=nt);for(const xt of deprecations)Object.hasOwn(o,xt.from)&&(""+xt.from+(xt.to?"use `"+xt.to+"` instead":"remove it")+changelog+xt.id,void 0);const ft=pt.parse(mt);let yt=pt.runSync(ft,mt);return rt&&(yt={type:"element",tagName:"div",properties:{className:rt},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(xt,vt,bt){if(xt.type==="raw"&&bt&&typeof vt=="number")return lt?bt.children.splice(vt,1):bt.children[vt]={type:"text",value:xt.value},vt;if(xt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(xt.properties,Et)){const wt=xt.properties[Et],kt=urlAttributes[Et];(kt===null||kt.includes(xt.tagName))&&(xt.properties[Et]=ht(String(wt||""),Et,xt))}}if(xt.type==="element"){let Et=et?!et.includes(xt.tagName):it?it.includes(xt.tagName):!1;if(!Et&&tt&&typeof vt=="number"&&(Et=!tt(xt,vt,bt)),Et&&bt&&typeof vt=="number")return dt&&xt.children?bt.children.splice(vt,1,...xt.children):bt.children.splice(vt,1),vt}}}function defaultUrlTransform(o){const et=o.indexOf(":"),tt=o.indexOf("?"),nt=o.indexOf("#"),rt=o.indexOf("/");return et<0||rt>-1&&et>rt||tt>-1&&et>tt||nt>-1&&et>nt||safeProtocol.test(o.slice(0,et))?o:""}const PrivacyPolicyOptIn=({onOptIn:o})=>{const[et,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:()=>o(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:et,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[o,et]=reactExports.useState(!1);reactExports.useEffect(()=>{const nt=localStorage.getItem("privacyPolicyOptIn");nt!==null&&et(nt==="true")},[]);const tt=()=>{const nt=!o;et(nt),localStorage.setItem("privacyPolicyOptIn",nt.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: ",o?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:o?"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:o,onChainUpdate:et,isLoading:tt})=>{const{chainUUID:nt,blockUUID:rt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=o.find(ct=>ct.chainUUID===nt&&ct.blockUUID===rt);at&&it(at)},[o,nt,rt]),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:o,onSuccess:et})]})]}):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"})]})]})},StatusIndicator=({status:o,label:et})=>{const tt=()=>{switch(o){case"success":return jsxRuntimeExports.jsx(CircleCheck,{className:"h-4 w-4 text-green-500"});case"error":return jsxRuntimeExports.jsx(CircleX,{className:"h-4 w-4 text-red-500"});case"in-progress":return jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin text-yellow-500"})}},nt=()=>{switch(o){case"success":return"bg-green-500/10 text-green-500";case"error":return"bg-red-500/10 text-red-500";case"in-progress":return"bg-yellow-500/10 text-yellow-500"}};return jsxRuntimeExports.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded-full ${nt()}`,children:[tt(),jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:et})]})},ConnectionStatus=({filter:o,store:et})=>jsxRuntimeExports.jsx(Card,{className:"fixed bottom-4 left-4 right-4 md:static md:bottom-auto md:left-auto p-2 bg-background/80 backdrop-blur-sm border shadow-lg z-50 md:z-auto",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-row justify-around md:justify-start md:gap-4",children:[jsxRuntimeExports.jsx(StatusIndicator,{status:o,label:"Filter"}),jsxRuntimeExports.jsx(StatusIndicator,{status:et,label:"Store"})]})});function App(){const[o,et]=reactExports.useState(!1),[tt,nt]=reactExports.useState([]),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"});globalThis.window.waku=it;const[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{if(rt||!it||it.libp2p.getConnections().length===0||tt.length>0||o){console.log("not starting message listening"),console.log({isWakuLoading:rt,node:it,connections:it==null?void 0:it.libp2p.getConnections().length,chainsData:tt,isListening:o});return}et(!0),console.log("connections",it.libp2p.getConnections().length),setTimeout(()=>{mt()},2e3)},[it,rt,st]);const pt=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(rt)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 mt=async()=>{console.log("Starting message listening"),console.log("connections",it.libp2p.getConnections().length);const yt=3e4,gt=new Promise((vt,bt)=>{setTimeout(()=>bt(new Error("Store query timeout")),yt)});try{at(bt=>({...bt,store:"in-progress"})),ht(!0);const vt=getMessagesFromStore(it);try{await Promise.race([(async()=>{for await(const bt of vt)nt(Et=>Et.some(kt=>kt.blockUUID===bt.blockUUID)?Et:[...Et,bt])})(),gt]),at(bt=>({...bt,store:"success"}))}catch(bt){console.error("Error processing message:",bt),at(Et=>({...Et,store:"error"}))}}catch(vt){console.error("Error fetching messages from store:",vt),at(bt=>({...bt,store:"error"}))}finally{ht(!1)}const xt=15e3;try{at(bt=>({...bt,filter:"in-progress"}));const vt=subscribeToFilter(it,bt=>{ft(bt)});await Promise.race([vt,new Promise((bt,Et)=>setTimeout(()=>Et(new Error("Filter subscription timeout")),xt))]),at(bt=>({...bt,filter:"success"}))}catch(vt){console.error("Error subscribing to filter:",vt),at(bt=>({...bt,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 ft=yt=>{nt(gt=>gt.some(vt=>vt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:pt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("div",{className:"md:hidden",children:jsxRuntimeExports.jsx(ConnectionStatus,{filter:st.filter,store:st.store})}),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:ft,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:ft,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()}}));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:"/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BaseError$3 as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,BytesSizeMismatchError as a,stringToHex as b,concat$3 as c,bytesToHex$4 as d,encodeAbiParameters as e,commonjsGlobal as f,encodeFunctionData as g,getDefaultExportFromCjs as h,isAddress as i,getAugmentedNamespace as j,keccak256$1 as k,sha3$2 as l,bytesToHex$3 as m,numberToHex as n,sha256$2 as o,buffer$2 as p,browserExports as q,tslib_es6$1 as r,size$2 as s,toHex as t,detect as u,__viteBrowserExternal$1 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; +`},rt),ot}function remarkRehype(o,et){return o&&"run"in o?async function(tt,nt){const rt=toHast(tt,{file:nt,...et});await o.run(rt,nt)}:function(tt,nt){return toHast(tt,{file:nt,...o||et})}}function bail(o){if(o)throw o}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function o(et){return typeof Array.isArray=="function"?Array.isArray(et):toStr.call(et)==="[object Array]"},isPlainObject$1=function o(et){if(!et||toStr.call(et)!=="[object Object]")return!1;var tt=hasOwn.call(et,"constructor"),nt=et.constructor&&et.constructor.prototype&&hasOwn.call(et.constructor.prototype,"isPrototypeOf");if(et.constructor&&!tt&&!nt)return!1;var rt;for(rt in et);return typeof rt>"u"||hasOwn.call(et,rt)},setProperty=function o(et,tt){defineProperty&&tt.name==="__proto__"?defineProperty(et,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):et[tt.name]=tt.newValue},getProperty=function o(et,tt){if(tt==="__proto__")if(hasOwn.call(et,tt)){if(gOPD)return gOPD(et,tt).value}else return;return et[tt]},extend=function o(){var et,tt,nt,rt,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(rt);try{at=o.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return rt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,rt):at instanceof Error?rt(at):ot(at))}function rt(it,...st){tt||(tt=!0,et(it,...st))}function ot(it){rt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(o,et){if(et!==void 0&&typeof et!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(o);let tt=0,nt=-1,rt=o.length,ot;if(et===void 0||et.length===0||et.length>o.length){for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else nt<0&&(ot=!0,nt=rt+1);return nt<0?"":o.slice(tt,nt)}if(et===o)return"";let it=-1,st=et.length-1;for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else it<0&&(ot=!0,it=rt+1),st>-1&&(o.codePointAt(rt)===et.codePointAt(st--)?st<0&&(nt=rt):(st=-1,nt=it));return tt===nt?nt=it:nt<0&&(nt=o.length),o.slice(tt,nt)}function dirname(o){if(assertPath$1(o),o.length===0)return".";let et=-1,tt=o.length,nt;for(;--tt;)if(o.codePointAt(tt)===47){if(nt){et=tt;break}}else nt||(nt=!0);return et<0?o.codePointAt(0)===47?"/":".":et===1&&o.codePointAt(0)===47?"//":o.slice(0,et)}function extname(o){assertPath$1(o);let et=o.length,tt=-1,nt=0,rt=-1,ot=0,it;for(;et--;){const st=o.codePointAt(et);if(st===47){if(it){nt=et+1;break}continue}tt<0&&(it=!0,tt=et+1),st===46?rt<0?rt=et:ot!==1&&(ot=1):rt>-1&&(ot=-1)}return rt<0||tt<0||ot===0||ot===1&&rt===tt-1&&rt===nt+1?"":o.slice(rt,tt)}function join(...o){let et=-1,tt;for(;++et0&&o.codePointAt(o.length-1)===47&&(tt+="/"),et?"/"+tt:tt}function normalizeString(o,et){let tt="",nt=0,rt=-1,ot=0,it=-1,st,at;for(;++it<=o.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",nt=0):(tt=tt.slice(0,at),nt=tt.length-1-tt.lastIndexOf("/")),rt=it,ot=0;continue}}else if(tt.length>0){tt="",nt=0,rt=it,ot=0;continue}}et&&(tt=tt.length>0?tt+"/..":"..",nt=2)}else tt.length>0?tt+="/"+o.slice(rt+1,it):tt=o.slice(rt+1,it),nt=it-rt-1;rt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}const minproc={cwd};function cwd(){return"/"}function isUrl(o){return!!(o!==null&&typeof o=="object"&&"href"in o&&o.href&&"protocol"in o&&o.protocol&&o.auth===void 0)}function urlToPath(o){if(typeof o=="string")o=new URL(o);else if(!isUrl(o)){const et=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+o+"`");throw et.code="ERR_INVALID_ARG_TYPE",et}if(o.protocol!=="file:"){const et=new TypeError("The URL must be of scheme file");throw et.code="ERR_INVALID_URL_SCHEME",et}return getPathFromURLPosix(o)}function getPathFromURLPosix(o){if(o.hostname!==""){const nt=new TypeError('File URL host must be "localhost" or empty on darwin');throw nt.code="ERR_INVALID_FILE_URL_HOST",nt}const et=o.pathname;let tt=-1;for(;++tt0){let[ft,...mt]=lt;const pt=nt[ht][1];isPlainObject(pt)&&isPlainObject(ft)&&(ft=extend$1(!0,pt,ft)),nt[ht]=[ct,ft,...mt]}}}}const unified=new Processor().freeze();function assertParser(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `parser`")}function assertCompiler(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `compiler`")}function assertUnfrozen(o,et){if(et)throw new Error("Cannot call `"+o+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(o){if(!isPlainObject(o)||typeof o.type!="string")throw new TypeError("Expected node, got `"+o+"`")}function assertDone(o,et,tt){if(!tt)throw new Error("`"+o+"` finished async. Use `"+et+"` instead")}function vfile(o){return looksLikeAVFile(o)?o:new VFile(o)}function looksLikeAVFile(o){return!!(o&&typeof o=="object"&&"message"in o&&"messages"in o)}function looksLikeAValue(o){return typeof o=="string"||isUint8Array(o)}function isUint8Array(o){return!!(o&&typeof o=="object"&&"byteLength"in o&&"byteOffset"in o)}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(o){const et=o.allowedElements,tt=o.allowElement,nt=o.children||"",rt=o.className,ot=o.components,it=o.disallowedElements,st=o.rehypePlugins||emptyPlugins,at=o.remarkPlugins||emptyPlugins,ct=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=o.skipHtml,dt=o.unwrapDisallowed,ht=o.urlTransform||defaultUrlTransform,ft=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),mt=new VFile;typeof nt=="string"&&(mt.value=nt);for(const xt of deprecations)Object.hasOwn(o,xt.from)&&(""+xt.from+(xt.to?"use `"+xt.to+"` instead":"remove it")+changelog+xt.id,void 0);const pt=ft.parse(mt);let yt=ft.runSync(pt,mt);return rt&&(yt={type:"element",tagName:"div",properties:{className:rt},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(xt,vt,bt){if(xt.type==="raw"&&bt&&typeof vt=="number")return lt?bt.children.splice(vt,1):bt.children[vt]={type:"text",value:xt.value},vt;if(xt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(xt.properties,Et)){const wt=xt.properties[Et],kt=urlAttributes[Et];(kt===null||kt.includes(xt.tagName))&&(xt.properties[Et]=ht(String(wt||""),Et,xt))}}if(xt.type==="element"){let Et=et?!et.includes(xt.tagName):it?it.includes(xt.tagName):!1;if(!Et&&tt&&typeof vt=="number"&&(Et=!tt(xt,vt,bt)),Et&&bt&&typeof vt=="number")return dt&&xt.children?bt.children.splice(vt,1,...xt.children):bt.children.splice(vt,1),vt}}}function defaultUrlTransform(o){const et=o.indexOf(":"),tt=o.indexOf("?"),nt=o.indexOf("#"),rt=o.indexOf("/");return et<0||rt>-1&&et>rt||tt>-1&&et>tt||nt>-1&&et>nt||safeProtocol.test(o.slice(0,et))?o:""}const PrivacyPolicyOptIn=({onOptIn:o})=>{const[et,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:()=>o(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:et,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[o,et]=reactExports.useState(!1);reactExports.useEffect(()=>{const nt=localStorage.getItem("privacyPolicyOptIn");nt!==null&&et(nt==="true")},[]);const tt=()=>{const nt=!o;et(nt),localStorage.setItem("privacyPolicyOptIn",nt.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: ",o?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:o?"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:o,onChainUpdate:et,isLoading:tt})=>{const{chainUUID:nt,blockUUID:rt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=o.find(ct=>ct.chainUUID===nt&&ct.blockUUID===rt);at&&it(at)},[o,nt,rt]),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 book..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Book"})}),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:o,onSuccess:et})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Book Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested book or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Books"})]})]})},StatusIndicator=({status:o,label:et})=>{const tt=()=>{switch(o){case"success":return jsxRuntimeExports.jsx(CircleCheck,{className:"h-4 w-4 text-green-500"});case"error":return jsxRuntimeExports.jsx(CircleX,{className:"h-4 w-4 text-red-500"});case"in-progress":return jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin text-yellow-500"})}},nt=()=>{switch(o){case"success":return"bg-green-500/10 text-green-500";case"error":return"bg-red-500/10 text-red-500";case"in-progress":return"bg-yellow-500/10 text-yellow-500"}};return jsxRuntimeExports.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded-full ${nt()}`,children:[tt(),jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:et})]})},ConnectionStatus=({filter:o,store:et})=>jsxRuntimeExports.jsx(Card,{className:"fixed bottom-4 left-4 right-4 md:static md:bottom-auto md:left-auto p-2 bg-background/80 backdrop-blur-sm border shadow-lg z-50 md:z-auto",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-row justify-around md:justify-start md:gap-4",children:[jsxRuntimeExports.jsx(StatusIndicator,{status:o,label:"Connection"}),jsxRuntimeExports.jsx(StatusIndicator,{status:et,label:"History"})]})});function App(){const[o,et]=reactExports.useState(!1),[tt,nt]=reactExports.useState([]),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"});globalThis.window.waku=it;const[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{if(rt||!it||it.libp2p.getConnections().length===0||tt.length>0||o){console.log("not starting message listening"),console.log({isWakuLoading:rt,node:it,connections:it==null?void 0:it.libp2p.getConnections().length,chainsData:tt,isListening:o});return}et(!0),console.log("connections",it.libp2p.getConnections().length),setTimeout(()=>{mt()},2e3)},[it,rt,st]);const ft=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(rt)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 mt=async()=>{console.log("Starting message listening"),console.log("connections",it.libp2p.getConnections().length);const yt=3e4,gt=new Promise((vt,bt)=>{setTimeout(()=>bt(new Error("Store query timeout")),yt)});try{at(bt=>({...bt,store:"in-progress"})),ht(!0);const vt=getMessagesFromStore(it);try{await Promise.race([(async()=>{for await(const bt of vt)nt(Et=>Et.some(kt=>kt.blockUUID===bt.blockUUID)?Et:[...Et,bt])})(),gt]),at(bt=>({...bt,store:"success"}))}catch(bt){console.error("Error processing message:",bt),at(Et=>({...Et,store:"error"}))}}catch(vt){console.error("Error fetching messages from store:",vt),at(bt=>({...bt,store:"error"}))}finally{ht(!1)}const xt=15e3;try{at(bt=>({...bt,filter:"in-progress"}));const vt=subscribeToFilter(it,bt=>{pt(bt)});await Promise.race([vt,new Promise((bt,Et)=>setTimeout(()=>Et(new Error("Filter subscription timeout")),xt))]),at(bt=>({...bt,filter:"success"}))}catch(vt){console.error("Error subscribing to filter:",vt),at(bt=>({...bt,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=>{nt(gt=>gt.some(vt=>vt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:ft}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("div",{className:"md:hidden",children:jsxRuntimeExports.jsx(ConnectionStatus,{filter:st.filter,store:st.store})}),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 Book"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new book."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your books!"})]}),projectId="1d93edc21291f98e3bed6ff7617ff539",config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:projectId,chains:[mainnet],transports:{[mainnet.id]:http()}}));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:"/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BaseError$3 as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,getDefaultExportFromCjs as a,size$2 as b,concat$3 as c,BytesSizeMismatchError as d,encodeAbiParameters as e,stringToHex as f,getAugmentedNamespace as g,bytesToHex$4 as h,isAddress as i,commonjsGlobal as j,keccak256$1 as k,encodeFunctionData as l,sha3$2 as m,numberToHex as n,bytesToHex$3 as o,sha256$2 as p,buffer$2 as q,browserExports as r,stringify$2 as s,toHex as t,tslib_es6$1 as u,detect as v,__viteBrowserExternal$1 as w,getUrl as x,decodeErrorResult as y,call as z}; diff --git a/buddybook/assets/index-yzjEDxfO.js b/buddybook/assets/index-yzjEDxfO.js new file mode 100644 index 0000000..4a2458f --- /dev/null +++ b/buddybook/assets/index-yzjEDxfO.js @@ -0,0 +1,3 @@ +import{g as rt,m as at,a as ot,o as ct,p as dt,E as lt}from"./index-tpwTCyHS.js";import{B as Y,_ as h,h as ae,y as ht}from"./hooks.module-D0gf0yJl.js";const ut=(t,e)=>{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' 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 s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' 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 `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",pt="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return pt}return e}function ft(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function gt(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&ft(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.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 b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.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:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!mt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function mt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),wt=se(),bt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return bt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function yt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=yt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return wt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||kt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function vt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function kt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function Et(){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:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Ct(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function It(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function St(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function Mt(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function xt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return St(e,s)}async function At(t,e){return JSON.parse(await Mt(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class _t{constructor(){this.storage=new v("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($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Ct();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await It(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.3",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function Lt(){return globalThis.coinbaseWalletExtension}function Pt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=Lt();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Pt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Nt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new _t,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},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(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await xt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await At(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Tt=rt(at),{keccak_256:Dt}=Tt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Ot(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function Ht(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Kt(t){return t.lastIndexOf("]")===t.length-1}function Vt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);Ht(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function zt(t,e){return w.keccak(Fe(t,e))}var Zt={rawEncode:Vt,solidityPack:Fe,soliditySHA3:zt};const y=Ve,U=Zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",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);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var Ft={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return $t(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function $t(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const q=ot(Ft),Gt="walletUsername",ee="Addresses",Yt="AppVersion";function m(t){return t.errorMessage!==void 0}class Jt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Qt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(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(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Xt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,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,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,es=6e4;class ts{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Gt,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated(Yt,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Jt(e.secret),this.listener=n;const i=new Xt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Qt(s,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}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(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);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>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:es}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class ss{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ct(dt(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ns(){try{return window.frameElement!==null}catch{return!1}}function is(){try{return ns()&&window.top?window.top.location:window.location}catch{return window.location}}function rs(){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)}function Ge(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const as='@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}';function Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(as)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(hs,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,os),h("div",{class:"-cbwsdk-snackbar"},t.children)),hs=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);ht(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:cs,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:ds,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class us{constructor(){this.attached=!1,this.snackbar=new ls}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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}]}:s={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(s)}}const ps=".-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}";class fs{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(gs,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const gs=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,ps),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},ms="https://keys.coinbase.com/connect",be="https://www.walletlink.org",ws="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new fs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(ws);s.searchParams.append("redirect_url",is().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.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()}}}class S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=rs(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new ss,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new ts({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new us;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)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 s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return A(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:vt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function bs(){return tt.getItem(et)}function ys(t){tt.setItem(et,t)}async function vs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;Es(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ks(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Nt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function Es(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const Cs=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. + +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Is=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,s=await fetch(e,{method:"HEAD"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=s.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(Cs)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:st,getCrossOriginOpenerPolicy:Ss}=Is(),Ee=420,Ce=540;function Ms(t){const e=(window.innerWidth-Ee)/2+window.screenX,s=(window.innerHeight-Ce)/2+window.screenY;As(t);const n=window.open(t,"Smart Wallet",`width=${Ee}, height=${Ce}, left=${e}, top=${s}`);if(n==null||n.focus(),!n)throw l.rpc.internal("Pop up window failed to open");return n}function xs(t){t&&!t.closed&&t.close()}function As(t){const e={sdkName:Oe,sdkVersion:T,origin:window.location.origin,coop:Ss()};for(const[s,n]of Object.entries(e))t.searchParams.append(s,n.toString())}class _s{constructor({url:e=ms,metadata:s,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const r=this.onMessage(({requestId:a})=>a===i.id);return this.postMessage(i),await r},this.onMessage=async i=>new Promise((r,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const d=c.data;i(d)&&(r(d),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{xs(this.popup),this.popup=null,this.listeners.forEach(({reject:i},r)=>{i(l.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=Ms(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:T,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw l.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=s,this.preference=n}}function Ls(t){const e=gt(Ps(t),{shouldIncludeStack:!0}),s=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return s.searchParams.set("version",T),s.searchParams.set("code",e.code.toString()),s.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:s.href})}function Ps(t){var e;if(typeof t=="string")return{message:t,code:u.rpc.internal};if(m(t)){const s=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:s.match(/(denied|rejected)/i)?u.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:s,code:n,data:{method:t.method}})}return t}class Rs extends lt{}var Ns=function(t,e){var s={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i(i||(i=Ts(n)),i)}}export{Us as CoinbaseWalletSDK,Ws as createCoinbaseWalletSDK,Us as default}; diff --git a/buddybook/assets/index.es-BwINMB1n.js b/buddybook/assets/index.es-D5UVwycq.js similarity index 72% rename from buddybook/assets/index.es-BwINMB1n.js rename to buddybook/assets/index.es-D5UVwycq.js index 6570362..b44c2cd 100644 --- a/buddybook/assets/index.es-BwINMB1n.js +++ b/buddybook/assets/index.es-D5UVwycq.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dt2-TQyK.js","assets/index-BpI4vT-j.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); -import{j as ev,f as tv,u as w4,h as Ld,_ as _4}from"./index-BpI4vT-j.js";import{e as Vi,J as Fd}from"./events-DyQEop7s.js";import{r as zd,i as Pf}from"./inherits_browser-B8fZ3Rhe.js";var Ae={};/*! ***************************************************************************** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Do02Tqa-.js","assets/index-tpwTCyHS.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{g as tv,j as rv,v as w4,a as Fd,_ as _4}from"./index-tpwTCyHS.js";import{e as Vi,J as zd}from"./events-DTVtRakk.js";import{r as jd,i as Of}from"./inherits_browser-c-WsrrNw.js";var Ae={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -12,23 +12,23 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var ad=function(r,e){return ad=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},ad(r,e)};function D4(r,e){ad(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var od=function(){return od=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;f--)(c=r[f])&&(a=(n<3?c(a):n>3?c(e,t,a):c(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a}function x4(r,e){return function(t,i){e(t,i,r)}}function S4(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function M4(r,e,t,i){function n(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{d(i.next(m))}catch(w){c(w)}}function g(m){try{d(i.throw(m))}catch(w){c(w)}}function d(m){m.done?a(m.value):n(m.value).then(f,g)}d((i=i.apply(r,e||[])).next())})}function I4(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(d){return function(m){return g([d,m])}}function g(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(a=d[0]&2?n.return:d[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,d[1])).done)return a;switch(n=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,n=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function rv(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,a=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(f){c={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return a}function O4(){for(var r=[],e=0;e1||f(O,C)})})}function f(O,C){try{g(i[O](C))}catch(P){w(a[0][3],P)}}function g(O){O.value instanceof bc?Promise.resolve(O.value.v).then(d,m):w(a[0][2],O)}function d(O){f("next",O)}function m(O){f("throw",O)}function w(O,C){O(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function N4(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,a){e[n]=r[n]?function(c){return(t=!t)?{value:bc(r[n](c)),done:n==="return"}:a?a(c):c}:a}}function B4(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof cd=="function"?cd(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(c){return new Promise(function(f,g){c=r[a](c),n(f,g,c.done,c.value)})}}function n(a,c,f,g){Promise.resolve(g).then(function(d){a({value:d,done:f})},c)}}function $4(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function U4(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function q4(r){return r&&r.__esModule?r:{default:r}}function L4(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function F4(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const z4=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return od},__asyncDelegator:N4,__asyncGenerator:R4,__asyncValues:B4,__await:bc,__awaiter:M4,__classPrivateFieldGet:L4,__classPrivateFieldSet:F4,__createBinding:C4,__decorate:A4,__exportStar:P4,__extends:D4,__generator:I4,__importDefault:q4,__importStar:U4,__makeTemplateObject:$4,__metadata:S4,__param:x4,__read:rv,__rest:E4,__spread:O4,__spreadArrays:T4,__values:cd},Symbol.toStringTag,{value:"Module"})),Of=ev(z4);var gl={},Go={},w1;function j4(){if(w1)return Go;w1=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Go.delay=r,Go}var sa={},bl={},aa={},_1;function k4(){return _1||(_1=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.ONE_THOUSAND=aa.ONE_HUNDRED=void 0,aa.ONE_HUNDRED=100,aa.ONE_THOUSAND=1e3),aa}var vl={},D1;function H4(){return D1||(D1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(vl)),vl}var E1;function iv(){return E1||(E1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Of;e.__exportStar(k4(),r),e.__exportStar(H4(),r)}(bl)),bl}var A1;function K4(){if(A1)return sa;A1=1,Object.defineProperty(sa,"__esModule",{value:!0}),sa.fromMiliseconds=sa.toMiliseconds=void 0;const r=iv();function e(i){return i*r.ONE_THOUSAND}sa.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return sa.fromMiliseconds=t,sa}var x1;function V4(){return x1||(x1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Of;e.__exportStar(j4(),r),e.__exportStar(K4(),r)}(gl)),gl}var Ga={},S1;function G4(){if(S1)return Ga;S1=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return Ga.Watch=r,Ga.default=r,Ga}var ml={},Jo={},M1;function J4(){if(M1)return Jo;M1=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.IWatch=void 0;class r{}return Jo.IWatch=r,Jo}var I1;function W4(){return I1||(I1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Of.__exportStar(J4(),r)}(ml)),ml}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Of;e.__exportStar(V4(),r),e.__exportStar(G4(),r),e.__exportStar(W4(),r),e.__exportStar(iv(),r)})(Ae);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.getLocalStorage=Vt.getLocalStorageOrThrow=Vt.getCrypto=Vt.getCryptoOrThrow=nv=Vt.getLocation=Vt.getLocationOrThrow=jd=Vt.getNavigator=Vt.getNavigatorOrThrow=Tf=Vt.getDocument=Vt.getDocumentOrThrow=Vt.getFromWindowOrThrow=Vt.getFromWindow=void 0;function _a(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Vt.getFromWindow=_a;function ho(r){const e=_a(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Vt.getFromWindowOrThrow=ho;function Y4(){return ho("document")}Vt.getDocumentOrThrow=Y4;function Q4(){return _a("document")}var Tf=Vt.getDocument=Q4;function X4(){return ho("navigator")}Vt.getNavigatorOrThrow=X4;function Z4(){return _a("navigator")}var jd=Vt.getNavigator=Z4;function e_(){return ho("location")}Vt.getLocationOrThrow=e_;function t_(){return _a("location")}var nv=Vt.getLocation=t_;function r_(){return ho("crypto")}Vt.getCryptoOrThrow=r_;function i_(){return _a("crypto")}Vt.getCrypto=i_;function n_(){return ho("localStorage")}Vt.getLocalStorageOrThrow=n_;function s_(){return _a("localStorage")}Vt.getLocalStorage=s_;var kd={};Object.defineProperty(kd,"__esModule",{value:!0});var sv=kd.getWindowMetadata=void 0;const C1=Vt;function a_(){let r,e;try{r=C1.getDocumentOrThrow(),e=C1.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),O=[];for(let C=0;C-1){const K=P.getAttribute("href");if(K)if(K.toLowerCase().indexOf("https:")===-1&&K.toLowerCase().indexOf("http:")===-1&&K.indexOf("//")!==0){let Y=e.protocol+"//"+e.host;if(K.indexOf("/")===0)Y+=K;else{const z=e.pathname.split("/");z.pop();const W=z.join("/");Y+=W+"/"+K}O.push(Y)}else if(K.indexOf("//")===0){const Y=e.protocol+K;O.push(Y)}else O.push(K)}}return O}function i(...w){const O=r.getElementsByTagName("meta");for(let C=0;CP.getAttribute(K)).filter(K=>K?w.includes(K):!1);if(q.length&&q){const K=P.getAttribute("content");if(K)return K}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function a(){return i("description","og:description","twitter:description","keywords")}const c=n(),f=a(),g=e.origin,d=t();return{description:f,url:g,icons:d,name:c}}sv=kd.getWindowMetadata=a_;var vc={},o_=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),av="%[a-f0-9]{2}",P1=new RegExp("("+av+")|([^%]+?)","gi"),O1=new RegExp("("+av+")+","gi");function ud(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],ud(t),ud(i))}function c_(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(P1)||[],t=1;t{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},l_=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),a=0;az==null,c=Symbol("encodeFragmentIdentifier");function f(z){switch(z.arrayFormat){case"index":return W=>(B,j)=>{const k=B.length;return j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),"[",k,"]"].join("")]:[...B,[m(W,z),"[",m(k,z),"]=",m(j,z)].join("")]};case"bracket":return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),"[]"].join("")]:[...B,[m(W,z),"[]=",m(j,z)].join("")];case"colon-list-separator":return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),":list="].join("")]:[...B,[m(W,z),":list=",m(j,z)].join("")];case"comma":case"separator":case"bracket-separator":{const W=z.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(j,k)=>k===void 0||z.skipNull&&k===null||z.skipEmptyString&&k===""?j:(k=k===null?"":k,j.length===0?[[m(B,z),W,m(k,z)].join("")]:[[j,m(k,z)].join(z.arrayFormatSeparator)])}default:return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,m(W,z)]:[...B,[m(W,z),"=",m(j,z)].join("")]}}function g(z){let W;switch(z.arrayFormat){case"index":return(B,j,k)=>{if(W=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!W){k[B]=j;return}k[B]===void 0&&(k[B]={}),k[B][W[1]]=j};case"bracket":return(B,j,k)=>{if(W=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!W){k[B]=j;return}if(k[B]===void 0){k[B]=[j];return}k[B]=[].concat(k[B],j)};case"colon-list-separator":return(B,j,k)=>{if(W=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!W){k[B]=j;return}if(k[B]===void 0){k[B]=[j];return}k[B]=[].concat(k[B],j)};case"comma":case"separator":return(B,j,k)=>{const _=typeof j=="string"&&j.includes(z.arrayFormatSeparator),N=typeof j=="string"&&!_&&w(j,z).includes(z.arrayFormatSeparator);j=N?w(j,z):j;const se=_||N?j.split(z.arrayFormatSeparator).map(le=>w(le,z)):j===null?j:w(j,z);k[B]=se};case"bracket-separator":return(B,j,k)=>{const _=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!_){k[B]=j&&w(j,z);return}const N=j===null?[]:j.split(z.arrayFormatSeparator).map(se=>w(se,z));if(k[B]===void 0){k[B]=N;return}k[B]=[].concat(k[B],N)};default:return(B,j,k)=>{if(k[B]===void 0){k[B]=j;return}k[B]=[].concat(k[B],j)}}}function d(z){if(typeof z!="string"||z.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(z,W){return W.encode?W.strict?e(z):encodeURIComponent(z):z}function w(z,W){return W.decode?t(z):z}function O(z){return Array.isArray(z)?z.sort():typeof z=="object"?O(Object.keys(z)).sort((W,B)=>Number(W)-Number(B)).map(W=>z[W]):z}function C(z){const W=z.indexOf("#");return W!==-1&&(z=z.slice(0,W)),z}function P(z){let W="";const B=z.indexOf("#");return B!==-1&&(W=z.slice(B)),W}function q(z){z=C(z);const W=z.indexOf("?");return W===-1?"":z.slice(W+1)}function K(z,W){return W.parseNumbers&&!Number.isNaN(Number(z))&&typeof z=="string"&&z.trim()!==""?z=Number(z):W.parseBooleans&&z!==null&&(z.toLowerCase()==="true"||z.toLowerCase()==="false")&&(z=z.toLowerCase()==="true"),z}function Y(z,W){W=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},W),d(W.arrayFormatSeparator);const B=g(W),j=Object.create(null);if(typeof z!="string"||(z=z.trim().replace(/^[?#&]/,""),!z))return j;for(const k of z.split("&")){if(k==="")continue;let[_,N]=i(W.decode?k.replace(/\+/g," "):k,"=");N=N===void 0?null:["comma","separator","bracket-separator"].includes(W.arrayFormat)?N:w(N,W),B(w(_,W),N,j)}for(const k of Object.keys(j)){const _=j[k];if(typeof _=="object"&&_!==null)for(const N of Object.keys(_))_[N]=K(_[N],W);else j[k]=K(_,W)}return W.sort===!1?j:(W.sort===!0?Object.keys(j).sort():Object.keys(j).sort(W.sort)).reduce((k,_)=>{const N=j[_];return N&&typeof N=="object"&&!Array.isArray(N)?k[_]=O(N):k[_]=N,k},Object.create(null))}r.extract=q,r.parse=Y,r.stringify=(z,W)=>{if(!z)return"";W=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},W),d(W.arrayFormatSeparator);const B=N=>W.skipNull&&a(z[N])||W.skipEmptyString&&z[N]==="",j=f(W),k={};for(const N of Object.keys(z))B(N)||(k[N]=z[N]);const _=Object.keys(k);return W.sort!==!1&&_.sort(W.sort),_.map(N=>{const se=z[N];return se===void 0?"":se===null?m(N,W):Array.isArray(se)?se.length===0&&W.arrayFormat==="bracket-separator"?m(N,W)+"[]":se.reduce(j(N),[]).join("&"):m(N,W)+"="+m(se,W)}).filter(N=>N.length>0).join("&")},r.parseUrl=(z,W)=>{W=Object.assign({decode:!0},W);const[B,j]=i(z,"#");return Object.assign({url:B.split("?")[0]||"",query:Y(q(z),W)},W&&W.parseFragmentIdentifier&&j?{fragmentIdentifier:w(j,W)}:{})},r.stringifyUrl=(z,W)=>{W=Object.assign({encode:!0,strict:!0,[c]:!0},W);const B=C(z.url).split("?")[0]||"",j=r.extract(z.url),k=r.parse(j,{sort:!1}),_=Object.assign(k,z.query);let N=r.stringify(_,W);N&&(N=`?${N}`);let se=P(z.url);return z.fragmentIdentifier&&(se=`#${W[c]?m(z.fragmentIdentifier,W):z.fragmentIdentifier}`),`${B}${N}${se}`},r.pick=(z,W,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[c]:!1},B);const{url:j,query:k,fragmentIdentifier:_}=r.parseUrl(z,B);return r.stringifyUrl({url:j,query:n(k,W),fragmentIdentifier:_},B)},r.exclude=(z,W,B)=>{const j=Array.isArray(W)?k=>!W.includes(k):(k,_)=>!W(k,_);return r.pick(z,j,B)}})(vc);var Hd={},Rf={},mt={},ov={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,g){var d=f>>>16&65535,m=f&65535,w=g>>>16&65535,O=g&65535;return m*O+(d*O+m*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,g){return f+g|0}r.add=t;function i(f,g){return f-g|0}r.sub=i;function n(f,g){return f<>>32-g}r.rotl=n;function a(f,g){return f<<32-g|f>>>g}r.rotr=a;function c(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})(ov);Object.defineProperty(mt,"__esModule",{value:!0});var cv=ov;function d_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}mt.readInt16BE=d_;function p_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}mt.readUint16BE=p_;function g_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}mt.readInt16LE=g_;function b_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}mt.readUint16LE=b_;function uv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}mt.writeUint16BE=uv;mt.writeInt16BE=uv;function fv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}mt.writeUint16LE=fv;mt.writeInt16LE=fv;function fd(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}mt.readInt32BE=fd;function hd(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}mt.readUint32BE=hd;function ld(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}mt.readInt32LE=ld;function dd(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}mt.readUint32LE=dd;function lf(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}mt.writeUint32BE=lf;mt.writeInt32BE=lf;function df(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}mt.writeUint32LE=df;mt.writeInt32LE=df;function v_(r,e){e===void 0&&(e=0);var t=fd(r,e),i=fd(r,e+4);return t*4294967296+i-(i>>31)*4294967296}mt.readInt64BE=v_;function m_(r,e){e===void 0&&(e=0);var t=hd(r,e),i=hd(r,e+4);return t*4294967296+i}mt.readUint64BE=m_;function y_(r,e){e===void 0&&(e=0);var t=ld(r,e),i=ld(r,e+4);return i*4294967296+t-(t>>31)*4294967296}mt.readInt64LE=y_;function w_(r,e){e===void 0&&(e=0);var t=dd(r,e),i=dd(r,e+4);return i*4294967296+t}mt.readUint64LE=w_;function hv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),lf(r/4294967296>>>0,e,t),lf(r>>>0,e,t+4),e}mt.writeUint64BE=hv;mt.writeInt64BE=hv;function lv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),df(r>>>0,e,t),df(r/4294967296>>>0,e,t+4),e}mt.writeUint64LE=lv;mt.writeInt64LE=lv;function __(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,a=r/8+t-1;a>=t;a--)i+=e[a]*n,n*=256;return i}mt.readUintBE=__;function D_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,a=t;a=i;a--)t[a]=e/n&255,n*=256;return t}mt.writeUintBE=E_;function A_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!cv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,a=i;a>>16|v<<16,U=U+v|0,_^=U,_=_>>>20|_<<12,B=B+N|0,E^=B,E=E>>>16|E<<16,y=y+E|0,N^=y,N=N>>>20|N<<12,j=j+se|0,S^=j,S=S>>>16|S<<16,u=u+S|0,se^=u,se=se>>>20|se<<12,k=k+le|0,M^=k,M=M>>>16|M<<16,h=h+M|0,le^=h,le=le>>>20|le<<12,j=j+se|0,S^=j,S=S>>>24|S<<8,u=u+S|0,se^=u,se=se>>>25|se<<7,k=k+le|0,M^=k,M=M>>>24|M<<8,h=h+M|0,le^=h,le=le>>>25|le<<7,B=B+N|0,E^=B,E=E>>>24|E<<8,y=y+E|0,N^=y,N=N>>>25|N<<7,W=W+_|0,v^=W,v=v>>>24|v<<8,U=U+v|0,_^=U,_=_>>>25|_<<7,W=W+N|0,M^=W,M=M>>>16|M<<16,u=u+M|0,N^=u,N=N>>>20|N<<12,B=B+se|0,v^=B,v=v>>>16|v<<16,h=h+v|0,se^=h,se=se>>>20|se<<12,j=j+le|0,E^=j,E=E>>>16|E<<16,U=U+E|0,le^=U,le=le>>>20|le<<12,k=k+_|0,S^=k,S=S>>>16|S<<16,y=y+S|0,_^=y,_=_>>>20|_<<12,j=j+le|0,E^=j,E=E>>>24|E<<8,U=U+E|0,le^=U,le=le>>>25|le<<7,k=k+_|0,S^=k,S=S>>>24|S<<8,y=y+S|0,_^=y,_=_>>>25|_<<7,B=B+se|0,v^=B,v=v>>>24|v<<8,h=h+v|0,se^=h,se=se>>>25|se<<7,W=W+N|0,M^=W,M=M>>>24|M<<8,u=u+M|0,N^=u,N=N>>>25|N<<7;Fr.writeUint32LE(W+i|0,r,0),Fr.writeUint32LE(B+n|0,r,4),Fr.writeUint32LE(j+a|0,r,8),Fr.writeUint32LE(k+c|0,r,12),Fr.writeUint32LE(_+f|0,r,16),Fr.writeUint32LE(N+g|0,r,20),Fr.writeUint32LE(se+d|0,r,24),Fr.writeUint32LE(le+m|0,r,28),Fr.writeUint32LE(U+w|0,r,32),Fr.writeUint32LE(y+O|0,r,36),Fr.writeUint32LE(u+C|0,r,40),Fr.writeUint32LE(h+P|0,r,44),Fr.writeUint32LE(v+q|0,r,48),Fr.writeUint32LE(E+K|0,r,52),Fr.writeUint32LE(S+Y|0,r,56),Fr.writeUint32LE(M+z|0,r,60)}function dv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var pv={},js={};Object.defineProperty(js,"__esModule",{value:!0});function q_(r,e,t){return~(r-1)&e|r-1&t}js.select=q_;function L_(r,e){return(r|0)-(e|0)-1>>>31&1}js.lessOrEqual=L_;function gv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}js.compare=gv;function F_(r,e){return r.length===0||e.length===0?!1:gv(r,e)!==0}js.equal=F_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=js,t=xi;r.DIGEST_LENGTH=16;var i=function(){function c(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var g=f[0]|f[1]<<8;this._r[0]=g&8191;var d=f[2]|f[3]<<8;this._r[1]=(g>>>13|d<<3)&8191;var m=f[4]|f[5]<<8;this._r[2]=(d>>>10|m<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(m>>>7|w<<9)&8191;var O=f[8]|f[9]<<8;this._r[4]=(w>>>4|O<<12)&255,this._r[5]=O>>>1&8190;var C=f[10]|f[11]<<8;this._r[6]=(O>>>14|C<<2)&8191;var P=f[12]|f[13]<<8;this._r[7]=(C>>>11|P<<5)&8065;var q=f[14]|f[15]<<8;this._r[8]=(P>>>8|q<<8)&8191,this._r[9]=q>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return c.prototype._blocks=function(f,g,d){for(var m=this._fin?0:2048,w=this._h[0],O=this._h[1],C=this._h[2],P=this._h[3],q=this._h[4],K=this._h[5],Y=this._h[6],z=this._h[7],W=this._h[8],B=this._h[9],j=this._r[0],k=this._r[1],_=this._r[2],N=this._r[3],se=this._r[4],le=this._r[5],U=this._r[6],y=this._r[7],u=this._r[8],h=this._r[9];d>=16;){var v=f[g+0]|f[g+1]<<8;w+=v&8191;var E=f[g+2]|f[g+3]<<8;O+=(v>>>13|E<<3)&8191;var S=f[g+4]|f[g+5]<<8;C+=(E>>>10|S<<6)&8191;var M=f[g+6]|f[g+7]<<8;P+=(S>>>7|M<<9)&8191;var x=f[g+8]|f[g+9]<<8;q+=(M>>>4|x<<12)&8191,K+=x>>>1&8191;var p=f[g+10]|f[g+11]<<8;Y+=(x>>>14|p<<2)&8191;var b=f[g+12]|f[g+13]<<8;z+=(p>>>11|b<<5)&8191;var R=f[g+14]|f[g+15]<<8;W+=(b>>>8|R<<8)&8191,B+=R>>>5|m;var Z=0,ae=Z;ae+=w*j,ae+=O*(5*h),ae+=C*(5*u),ae+=P*(5*y),ae+=q*(5*U),Z=ae>>>13,ae&=8191,ae+=K*(5*le),ae+=Y*(5*se),ae+=z*(5*N),ae+=W*(5*_),ae+=B*(5*k),Z+=ae>>>13,ae&=8191;var I=Z;I+=w*k,I+=O*j,I+=C*(5*h),I+=P*(5*u),I+=q*(5*y),Z=I>>>13,I&=8191,I+=K*(5*U),I+=Y*(5*le),I+=z*(5*se),I+=W*(5*N),I+=B*(5*_),Z+=I>>>13,I&=8191;var ee=Z;ee+=w*_,ee+=O*k,ee+=C*j,ee+=P*(5*h),ee+=q*(5*u),Z=ee>>>13,ee&=8191,ee+=K*(5*y),ee+=Y*(5*U),ee+=z*(5*le),ee+=W*(5*se),ee+=B*(5*N),Z+=ee>>>13,ee&=8191;var L=Z;L+=w*N,L+=O*_,L+=C*k,L+=P*j,L+=q*(5*h),Z=L>>>13,L&=8191,L+=K*(5*u),L+=Y*(5*y),L+=z*(5*U),L+=W*(5*le),L+=B*(5*se),Z+=L>>>13,L&=8191;var V=Z;V+=w*se,V+=O*N,V+=C*_,V+=P*k,V+=q*j,Z=V>>>13,V&=8191,V+=K*(5*h),V+=Y*(5*u),V+=z*(5*y),V+=W*(5*U),V+=B*(5*le),Z+=V>>>13,V&=8191;var G=Z;G+=w*le,G+=O*se,G+=C*N,G+=P*_,G+=q*k,Z=G>>>13,G&=8191,G+=K*j,G+=Y*(5*h),G+=z*(5*u),G+=W*(5*y),G+=B*(5*U),Z+=G>>>13,G&=8191;var D=Z;D+=w*U,D+=O*le,D+=C*se,D+=P*N,D+=q*_,Z=D>>>13,D&=8191,D+=K*k,D+=Y*j,D+=z*(5*h),D+=W*(5*u),D+=B*(5*y),Z+=D>>>13,D&=8191;var H=Z;H+=w*y,H+=O*U,H+=C*le,H+=P*se,H+=q*N,Z=H>>>13,H&=8191,H+=K*_,H+=Y*k,H+=z*j,H+=W*(5*h),H+=B*(5*u),Z+=H>>>13,H&=8191;var ne=Z;ne+=w*u,ne+=O*y,ne+=C*U,ne+=P*le,ne+=q*se,Z=ne>>>13,ne&=8191,ne+=K*N,ne+=Y*_,ne+=z*k,ne+=W*j,ne+=B*(5*h),Z+=ne>>>13,ne&=8191;var ce=Z;ce+=w*h,ce+=O*u,ce+=C*y,ce+=P*U,ce+=q*le,Z=ce>>>13,ce&=8191,ce+=K*se,ce+=Y*N,ce+=z*_,ce+=W*k,ce+=B*j,Z+=ce>>>13,ce&=8191,Z=(Z<<2)+Z|0,Z=Z+ae|0,ae=Z&8191,Z=Z>>>13,I+=Z,w=ae,O=I,C=ee,P=L,q=V,K=G,Y=D,z=H,W=ne,B=ce,g+=16,d-=16}this._h[0]=w,this._h[1]=O,this._h[2]=C,this._h[3]=P,this._h[4]=q,this._h[5]=K,this._h[6]=Y,this._h[7]=z,this._h[8]=W,this._h[9]=B},c.prototype.finish=function(f,g){g===void 0&&(g=0);var d=new Uint16Array(10),m,w,O,C;if(this._leftover){for(C=this._leftover,this._buffer[C++]=1;C<16;C++)this._buffer[C]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,C=2;C<10;C++)this._h[C]+=m,m=this._h[C]>>>13,this._h[C]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,d[0]=this._h[0]+5,m=d[0]>>>13,d[0]&=8191,C=1;C<10;C++)d[C]=this._h[C]+m,m=d[C]>>>13,d[C]&=8191;for(d[9]-=8192,w=(m^1)-1,C=0;C<10;C++)d[C]&=w;for(w=~w,C=0;C<10;C++)this._h[C]=this._h[C]&w|d[C];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,O=this._h[0]+this._pad[0],this._h[0]=O&65535,C=1;C<8;C++)O=(this._h[C]+this._pad[C]|0)+(O>>>16)|0,this._h[C]=O&65535;return f[g+0]=this._h[0]>>>0,f[g+1]=this._h[0]>>>8,f[g+2]=this._h[1]>>>0,f[g+3]=this._h[1]>>>8,f[g+4]=this._h[2]>>>0,f[g+5]=this._h[2]>>>8,f[g+6]=this._h[3]>>>0,f[g+7]=this._h[3]>>>8,f[g+8]=this._h[4]>>>0,f[g+9]=this._h[4]>>>8,f[g+10]=this._h[5]>>>0,f[g+11]=this._h[5]>>>8,f[g+12]=this._h[6]>>>0,f[g+13]=this._h[6]>>>8,f[g+14]=this._h[7]>>>0,f[g+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(f){var g=0,d=f.length,m;if(this._leftover){m=16-this._leftover,m>d&&(m=d);for(var w=0;w=16&&(m=d-d%16,this._blocks(f,g,m),g+=m,d-=m),d){for(var w=0;w16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var C=new Uint8Array(16);C.set(d,C.length-d.length);var P=new Uint8Array(32);e.stream(this._key,C,P,4);var q=m.length+this.tagLength,K;if(O){if(O.length!==q)throw new Error("ChaCha20Poly1305: incorrect destination length");K=O}else K=new Uint8Array(q);return e.streamXOR(this._key,C,m,K,4),this._authenticate(K.subarray(K.length-this.tagLength,K.length),P,K.subarray(0,K.length-this.tagLength),w),i.wipe(C),K},g.prototype.open=function(d,m,w,O){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length0&&C.update(c.subarray(O.length%16))),C.update(w),w.length%16>0&&C.update(c.subarray(w.length%16));var P=new Uint8Array(8);O&&n.writeUint64LE(O.length,P),C.update(P),n.writeUint64LE(w.length,P),C.update(P);for(var q=C.digest(),K=0;Kthis.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i256)throw new Error("randomString charset is too long");let O="";const C=m.length,P=256-256%C;for(;d>0;){const q=n(Math.ceil(d*256/P),w);for(let K=0;K0;K++){const Y=q[K];Y0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=g[m++],d--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(m=a(this._temp,this._state,g,m,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=g[m++],d--;return this},f.prototype.finish=function(g){if(!this._finished){var d=this._bytesHashed,m=this._bufferLength,w=d/536870912|0,O=d<<3,C=d%64<56?64:128;this._buffer[m]=128;for(var P=m+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(g){return this._state.set(g.state),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(g){t.wipe(g.state),g.buffer&&t.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},f}();r.SHA256=i;var n=new Int32Array([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]);function a(f,g,d,m,w){for(;w>=64;){for(var O=g[0],C=g[1],P=g[2],q=g[3],K=g[4],Y=g[5],z=g[6],W=g[7],B=0;B<16;B++){var j=m+B*4;f[B]=e.readUint32BE(d,j)}for(var B=16;B<64;B++){var k=f[B-2],_=(k>>>17|k<<15)^(k>>>19|k<<13)^k>>>10;k=f[B-15];var N=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3;f[B]=(_+f[B-7]|0)+(N+f[B-16]|0)}for(var B=0;B<64;B++){var _=(((K>>>6|K<<26)^(K>>>11|K<<21)^(K>>>25|K<<7))+(K&Y^~K&z)|0)+(W+(n[B]+f[B]|0)|0)|0,N=((O>>>2|O<<30)^(O>>>13|O<<19)^(O>>>22|O<<10))+(O&C^O&P^C&P)|0;W=z,z=Y,Y=K,K=q+_|0,q=P,P=C,C=O,O=_+N|0}g[0]+=O,g[1]+=C,g[2]+=P,g[3]+=q,g[4]+=K,g[5]+=Y,g[6]+=z,g[7]+=W,m+=64,w-=64}return m}function c(f){var g=new i;g.update(f);var d=g.digest();return g.clean(),d}r.hash=c})(Sc);var Vd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=ks,t=xi;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const j=new Float64Array(16);if(B)for(let k=0;k>16&1),k[le-1]&=65535;k[15]=_[15]-32767-(k[14]>>16&1);const se=k[15]>>16&1;k[14]&=65535,f(_,k,1-se)}for(let N=0;N<16;N++)B[2*N]=_[N]&255,B[2*N+1]=_[N]>>8}function d(B,j){for(let k=0;k<16;k++)B[k]=j[2*k]+(j[2*k+1]<<8);B[15]&=32767}function m(B,j,k){for(let _=0;_<16;_++)B[_]=j[_]+k[_]}function w(B,j,k){for(let _=0;_<16;_++)B[_]=j[_]-k[_]}function O(B,j,k){let _,N,se=0,le=0,U=0,y=0,u=0,h=0,v=0,E=0,S=0,M=0,x=0,p=0,b=0,R=0,Z=0,ae=0,I=0,ee=0,L=0,V=0,G=0,D=0,H=0,ne=0,ce=0,fe=0,ye=0,we=0,Te=0,Qe=0,Ce=0,Re=k[0],Se=k[1],me=k[2],Pe=k[3],Ne=k[4],be=k[5],Oe=k[6],xe=k[7],ve=k[8],qe=k[9],Me=k[10],_e=k[11],He=k[12],Ve=k[13],Ee=k[14],Ke=k[15];_=j[0],se+=_*Re,le+=_*Se,U+=_*me,y+=_*Pe,u+=_*Ne,h+=_*be,v+=_*Oe,E+=_*xe,S+=_*ve,M+=_*qe,x+=_*Me,p+=_*_e,b+=_*He,R+=_*Ve,Z+=_*Ee,ae+=_*Ke,_=j[1],le+=_*Re,U+=_*Se,y+=_*me,u+=_*Pe,h+=_*Ne,v+=_*be,E+=_*Oe,S+=_*xe,M+=_*ve,x+=_*qe,p+=_*Me,b+=_*_e,R+=_*He,Z+=_*Ve,ae+=_*Ee,I+=_*Ke,_=j[2],U+=_*Re,y+=_*Se,u+=_*me,h+=_*Pe,v+=_*Ne,E+=_*be,S+=_*Oe,M+=_*xe,x+=_*ve,p+=_*qe,b+=_*Me,R+=_*_e,Z+=_*He,ae+=_*Ve,I+=_*Ee,ee+=_*Ke,_=j[3],y+=_*Re,u+=_*Se,h+=_*me,v+=_*Pe,E+=_*Ne,S+=_*be,M+=_*Oe,x+=_*xe,p+=_*ve,b+=_*qe,R+=_*Me,Z+=_*_e,ae+=_*He,I+=_*Ve,ee+=_*Ee,L+=_*Ke,_=j[4],u+=_*Re,h+=_*Se,v+=_*me,E+=_*Pe,S+=_*Ne,M+=_*be,x+=_*Oe,p+=_*xe,b+=_*ve,R+=_*qe,Z+=_*Me,ae+=_*_e,I+=_*He,ee+=_*Ve,L+=_*Ee,V+=_*Ke,_=j[5],h+=_*Re,v+=_*Se,E+=_*me,S+=_*Pe,M+=_*Ne,x+=_*be,p+=_*Oe,b+=_*xe,R+=_*ve,Z+=_*qe,ae+=_*Me,I+=_*_e,ee+=_*He,L+=_*Ve,V+=_*Ee,G+=_*Ke,_=j[6],v+=_*Re,E+=_*Se,S+=_*me,M+=_*Pe,x+=_*Ne,p+=_*be,b+=_*Oe,R+=_*xe,Z+=_*ve,ae+=_*qe,I+=_*Me,ee+=_*_e,L+=_*He,V+=_*Ve,G+=_*Ee,D+=_*Ke,_=j[7],E+=_*Re,S+=_*Se,M+=_*me,x+=_*Pe,p+=_*Ne,b+=_*be,R+=_*Oe,Z+=_*xe,ae+=_*ve,I+=_*qe,ee+=_*Me,L+=_*_e,V+=_*He,G+=_*Ve,D+=_*Ee,H+=_*Ke,_=j[8],S+=_*Re,M+=_*Se,x+=_*me,p+=_*Pe,b+=_*Ne,R+=_*be,Z+=_*Oe,ae+=_*xe,I+=_*ve,ee+=_*qe,L+=_*Me,V+=_*_e,G+=_*He,D+=_*Ve,H+=_*Ee,ne+=_*Ke,_=j[9],M+=_*Re,x+=_*Se,p+=_*me,b+=_*Pe,R+=_*Ne,Z+=_*be,ae+=_*Oe,I+=_*xe,ee+=_*ve,L+=_*qe,V+=_*Me,G+=_*_e,D+=_*He,H+=_*Ve,ne+=_*Ee,ce+=_*Ke,_=j[10],x+=_*Re,p+=_*Se,b+=_*me,R+=_*Pe,Z+=_*Ne,ae+=_*be,I+=_*Oe,ee+=_*xe,L+=_*ve,V+=_*qe,G+=_*Me,D+=_*_e,H+=_*He,ne+=_*Ve,ce+=_*Ee,fe+=_*Ke,_=j[11],p+=_*Re,b+=_*Se,R+=_*me,Z+=_*Pe,ae+=_*Ne,I+=_*be,ee+=_*Oe,L+=_*xe,V+=_*ve,G+=_*qe,D+=_*Me,H+=_*_e,ne+=_*He,ce+=_*Ve,fe+=_*Ee,ye+=_*Ke,_=j[12],b+=_*Re,R+=_*Se,Z+=_*me,ae+=_*Pe,I+=_*Ne,ee+=_*be,L+=_*Oe,V+=_*xe,G+=_*ve,D+=_*qe,H+=_*Me,ne+=_*_e,ce+=_*He,fe+=_*Ve,ye+=_*Ee,we+=_*Ke,_=j[13],R+=_*Re,Z+=_*Se,ae+=_*me,I+=_*Pe,ee+=_*Ne,L+=_*be,V+=_*Oe,G+=_*xe,D+=_*ve,H+=_*qe,ne+=_*Me,ce+=_*_e,fe+=_*He,ye+=_*Ve,we+=_*Ee,Te+=_*Ke,_=j[14],Z+=_*Re,ae+=_*Se,I+=_*me,ee+=_*Pe,L+=_*Ne,V+=_*be,G+=_*Oe,D+=_*xe,H+=_*ve,ne+=_*qe,ce+=_*Me,fe+=_*_e,ye+=_*He,we+=_*Ve,Te+=_*Ee,Qe+=_*Ke,_=j[15],ae+=_*Re,I+=_*Se,ee+=_*me,L+=_*Pe,V+=_*Ne,G+=_*be,D+=_*Oe,H+=_*xe,ne+=_*ve,ce+=_*qe,fe+=_*Me,ye+=_*_e,we+=_*He,Te+=_*Ve,Qe+=_*Ee,Ce+=_*Ke,se+=38*I,le+=38*ee,U+=38*L,y+=38*V,u+=38*G,h+=38*D,v+=38*H,E+=38*ne,S+=38*ce,M+=38*fe,x+=38*ye,p+=38*we,b+=38*Te,R+=38*Qe,Z+=38*Ce,N=1,_=se+N+65535,N=Math.floor(_/65536),se=_-N*65536,_=le+N+65535,N=Math.floor(_/65536),le=_-N*65536,_=U+N+65535,N=Math.floor(_/65536),U=_-N*65536,_=y+N+65535,N=Math.floor(_/65536),y=_-N*65536,_=u+N+65535,N=Math.floor(_/65536),u=_-N*65536,_=h+N+65535,N=Math.floor(_/65536),h=_-N*65536,_=v+N+65535,N=Math.floor(_/65536),v=_-N*65536,_=E+N+65535,N=Math.floor(_/65536),E=_-N*65536,_=S+N+65535,N=Math.floor(_/65536),S=_-N*65536,_=M+N+65535,N=Math.floor(_/65536),M=_-N*65536,_=x+N+65535,N=Math.floor(_/65536),x=_-N*65536,_=p+N+65535,N=Math.floor(_/65536),p=_-N*65536,_=b+N+65535,N=Math.floor(_/65536),b=_-N*65536,_=R+N+65535,N=Math.floor(_/65536),R=_-N*65536,_=Z+N+65535,N=Math.floor(_/65536),Z=_-N*65536,_=ae+N+65535,N=Math.floor(_/65536),ae=_-N*65536,se+=N-1+37*(N-1),N=1,_=se+N+65535,N=Math.floor(_/65536),se=_-N*65536,_=le+N+65535,N=Math.floor(_/65536),le=_-N*65536,_=U+N+65535,N=Math.floor(_/65536),U=_-N*65536,_=y+N+65535,N=Math.floor(_/65536),y=_-N*65536,_=u+N+65535,N=Math.floor(_/65536),u=_-N*65536,_=h+N+65535,N=Math.floor(_/65536),h=_-N*65536,_=v+N+65535,N=Math.floor(_/65536),v=_-N*65536,_=E+N+65535,N=Math.floor(_/65536),E=_-N*65536,_=S+N+65535,N=Math.floor(_/65536),S=_-N*65536,_=M+N+65535,N=Math.floor(_/65536),M=_-N*65536,_=x+N+65535,N=Math.floor(_/65536),x=_-N*65536,_=p+N+65535,N=Math.floor(_/65536),p=_-N*65536,_=b+N+65535,N=Math.floor(_/65536),b=_-N*65536,_=R+N+65535,N=Math.floor(_/65536),R=_-N*65536,_=Z+N+65535,N=Math.floor(_/65536),Z=_-N*65536,_=ae+N+65535,N=Math.floor(_/65536),ae=_-N*65536,se+=N-1+37*(N-1),B[0]=se,B[1]=le,B[2]=U,B[3]=y,B[4]=u,B[5]=h,B[6]=v,B[7]=E,B[8]=S,B[9]=M,B[10]=x,B[11]=p,B[12]=b,B[13]=R,B[14]=Z,B[15]=ae}function C(B,j){O(B,j,j)}function P(B,j){const k=i();for(let _=0;_<16;_++)k[_]=j[_];for(let _=253;_>=0;_--)C(k,k),_!==2&&_!==4&&O(k,k,j);for(let _=0;_<16;_++)B[_]=k[_]}function q(B,j){const k=new Uint8Array(32),_=new Float64Array(80),N=i(),se=i(),le=i(),U=i(),y=i(),u=i();for(let S=0;S<31;S++)k[S]=B[S];k[31]=B[31]&127|64,k[0]&=248,d(_,j);for(let S=0;S<16;S++)se[S]=_[S];N[0]=U[0]=1;for(let S=254;S>=0;--S){const M=k[S>>>3]>>>(S&7)&1;f(N,se,M),f(le,U,M),m(y,N,le),w(N,N,le),m(le,se,U),w(se,se,U),C(U,y),C(u,N),O(N,le,N),O(le,se,y),m(y,N,le),w(N,N,le),C(se,N),w(le,U,u),O(N,le,a),m(N,N,U),O(le,le,N),O(N,U,u),O(U,se,_),C(se,y),f(N,se,M),f(le,U,M)}for(let S=0;S<16;S++)_[S+16]=N[S],_[S+32]=le[S],_[S+48]=se[S],_[S+64]=U[S];const h=_.subarray(32),v=_.subarray(16);P(h,h),O(v,v,h);const E=new Uint8Array(32);return g(E,v),E}r.scalarMult=q;function K(B){return q(B,n)}r.scalarMultBase=K;function Y(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const j=new Uint8Array(B);return{publicKey:K(j),secretKey:j}}r.generateKeyPairFromSeed=Y;function z(B){const j=(0,e.randomBytes)(32,B),k=Y(j);return(0,t.wipe)(j),k}r.generateKeyPair=z;function W(B,j,k=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(j.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=q(B,j);if(k){let N=0;for(let se=0;se<_.length;se++)N|=_[se];if(N===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=W})(Vd);function mv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function yl(r,e){e||(e=r.reduce((n,a)=>n+a.length,0));const t=mv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function e7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function C(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:C}}var t7=e7,r7=t7;const i7=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},n7=r=>new TextEncoder().encode(r),s7=r=>new TextDecoder().decode(r);let a7=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},o7=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return yv(this,e)}},c7=class{constructor(e){this.decoders=e}or(e){return yv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const yv=(r,e)=>new c7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});let u7=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new a7(e,t,i),this.decoder=new o7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Uf=({name:r,prefix:e,encode:t,decode:i})=>new u7(r,e,t,i),Mc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=r7(t,e);return Uf({prefix:r,name:e,encode:i,decode:a=>i7(n(a))})},f7=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},h7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<Uf({prefix:e,name:r,encode(n){return h7(n,i,t)},decode(n){return f7(n,i,t,r)}}),l7=Uf({prefix:"\0",name:"identity",encode:r=>s7(r),decode:r=>n7(r)}),d7=Object.freeze(Object.defineProperty({__proto__:null,identity:l7},Symbol.toStringTag,{value:"Module"})),p7=Ir({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),g7=Object.freeze(Object.defineProperty({__proto__:null,base2:p7},Symbol.toStringTag,{value:"Module"})),b7=Ir({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),v7=Object.freeze(Object.defineProperty({__proto__:null,base8:b7},Symbol.toStringTag,{value:"Module"})),m7=Mc({prefix:"9",name:"base10",alphabet:"0123456789"}),y7=Object.freeze(Object.defineProperty({__proto__:null,base10:m7},Symbol.toStringTag,{value:"Module"})),w7=Ir({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_7=Ir({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),D7=Object.freeze(Object.defineProperty({__proto__:null,base16:w7,base16upper:_7},Symbol.toStringTag,{value:"Module"})),E7=Ir({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),A7=Ir({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),x7=Ir({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),S7=Ir({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),M7=Ir({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),I7=Ir({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),C7=Ir({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P7=Ir({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),O7=Ir({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),T7=Object.freeze(Object.defineProperty({__proto__:null,base32:E7,base32hex:M7,base32hexpad:C7,base32hexpadupper:P7,base32hexupper:I7,base32pad:x7,base32padupper:S7,base32upper:A7,base32z:O7},Symbol.toStringTag,{value:"Module"})),R7=Mc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),N7=Mc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),B7=Object.freeze(Object.defineProperty({__proto__:null,base36:R7,base36upper:N7},Symbol.toStringTag,{value:"Module"})),$7=Mc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),U7=Mc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),q7=Object.freeze(Object.defineProperty({__proto__:null,base58btc:$7,base58flickr:U7},Symbol.toStringTag,{value:"Module"})),L7=Ir({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),F7=Ir({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),z7=Ir({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),j7=Ir({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),k7=Object.freeze(Object.defineProperty({__proto__:null,base64:L7,base64pad:F7,base64url:z7,base64urlpad:j7},Symbol.toStringTag,{value:"Module"})),wv=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),H7=wv.reduce((r,e,t)=>(r[t]=e,r),[]),K7=wv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function V7(r){return r.reduce((e,t)=>(e+=H7[t],e),"")}function G7(r){const e=[];for(const t of r){const i=K7[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const J7=Uf({prefix:"🚀",name:"base256emoji",encode:V7,decode:G7}),W7=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:J7},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const B1={...d7,...g7,...v7,...y7,...D7,...T7,...B7,...q7,...k7,...W7};function _v(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const $1=_v("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),wl=_v("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=mv(r.length);for(let t=0;t",s9="MIT",a9={url:"https://github.com/indutny/elliptic/issues"},o9="https://github.com/indutny/elliptic",c9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},u9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},f9={name:Y7,version:Q7,description:X7,main:Z7,files:e9,scripts:t9,repository:r9,keywords:i9,author:n9,license:s9,bugs:a9,homepage:o9,devDependencies:c9,dependencies:u9};var Si={},Gd={exports:{}};Gd.exports;(function(r){(function(e,t){function i(U,y){if(!U)throw new Error(y||"Assertion failed")}function n(U,y){U.super_=y;var u=function(){};u.prototype=y.prototype,U.prototype=new u,U.prototype.constructor=U}function a(U,y,u){if(a.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((y==="le"||y==="be")&&(u=y,y=10),this._init(U||0,y||10,u||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=zd.Buffer}catch{}a.isBN=function(y){return y instanceof a?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===a.wordSize&&Array.isArray(y.words)},a.max=function(y,u){return y.cmp(u)>0?y:u},a.min=function(y,u){return y.cmp(u)<0?y:u},a.prototype._init=function(y,u,h){if(typeof y=="number")return this._initNumber(y,u,h);if(typeof y=="object")return this._initArray(y,u,h);u==="hex"&&(u=16),i(u===(u|0)&&u>=2&&u<=36),y=y.toString().replace(/\s+/g,"");var v=0;y[0]==="-"&&(v++,this.negative=1),v=0;v-=3)S=y[v]|y[v-1]<<8|y[v-2]<<16,this.words[E]|=S<>>26-M&67108863,M+=24,M>=26&&(M-=26,E++);else if(h==="le")for(v=0,E=0;v>>26-M&67108863,M+=24,M>=26&&(M-=26,E++);return this.strip()};function f(U,y){var u=U.charCodeAt(y);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function g(U,y,u){var h=f(U,u);return u-1>=y&&(h|=f(U,u-1)<<4),h}a.prototype._parseHex=function(y,u,h){this.length=Math.ceil((y.length-u)/6),this.words=new Array(this.length);for(var v=0;v=u;v-=2)M=g(y,u,v)<=18?(E-=18,S+=1,this.words[S]|=M>>>26):E+=8;else{var x=y.length-u;for(v=x%2===0?u+1:u;v=18?(E-=18,S+=1,this.words[S]|=M>>>26):E+=8}this.strip()};function d(U,y,u,h){for(var v=0,E=Math.min(U.length,u),S=y;S=49?v+=M-49+10:M>=17?v+=M-17+10:v+=M}return v}a.prototype._parseBase=function(y,u,h){this.words=[0],this.length=1;for(var v=0,E=1;E<=67108863;E*=u)v++;v--,E=E/u|0;for(var S=y.length-h,M=S%v,x=Math.min(S,S-M)+h,p=0,b=h;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var m=["","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"],w=[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],O=[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];a.prototype.toString=function(y,u){y=y||10,u=u|0||1;var h;if(y===16||y==="hex"){h="";for(var v=0,E=0,S=0;S>>24-v&16777215,E!==0||S!==this.length-1?h=m[6-x.length]+x+h:h=x+h,v+=2,v>=26&&(v-=26,S--)}for(E!==0&&(h=E.toString(16)+h);h.length%u!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(y===(y|0)&&y>=2&&y<=36){var p=w[y],b=O[y];h="";var R=this.clone();for(R.negative=0;!R.isZero();){var Z=R.modn(b).toString(y);R=R.idivn(b),R.isZero()?h=Z+h:h=m[p-Z.length]+Z+h}for(this.isZero()&&(h="0"+h);h.length%u!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(y,u){return i(typeof c<"u"),this.toArrayLike(c,y,u)},a.prototype.toArray=function(y,u){return this.toArrayLike(Array,y,u)},a.prototype.toArrayLike=function(y,u,h){var v=this.byteLength(),E=h||Math.max(1,v);i(v<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0"),this.strip();var S=u==="le",M=new y(E),x,p,b=this.clone();if(S){for(p=0;!b.isZero();p++)x=b.andln(255),b.iushrn(8),M[p]=x;for(;p=4096&&(h+=13,u>>>=13),u>=64&&(h+=7,u>>>=7),u>=8&&(h+=4,u>>>=4),u>=2&&(h+=2,u>>>=2),h+u},a.prototype._zeroBits=function(y){if(y===0)return 26;var u=y,h=0;return u&8191||(h+=13,u>>>=13),u&127||(h+=7,u>>>=7),u&15||(h+=4,u>>>=4),u&3||(h+=2,u>>>=2),u&1||h++,h},a.prototype.bitLength=function(){var y=this.words[this.length-1],u=this._countBits(y);return(this.length-1)*26+u};function C(U){for(var y=new Array(U.bitLength()),u=0;u>>v}return y}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,u=0;uy.length?this.clone().ior(y):y.clone().ior(this)},a.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},a.prototype.iuand=function(y){var u;this.length>y.length?u=y:u=this;for(var h=0;hy.length?this.clone().iand(y):y.clone().iand(this)},a.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},a.prototype.iuxor=function(y){var u,h;this.length>y.length?(u=this,h=y):(u=y,h=this);for(var v=0;vy.length?this.clone().ixor(y):y.clone().ixor(this)},a.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},a.prototype.inotn=function(y){i(typeof y=="number"&&y>=0);var u=Math.ceil(y/26)|0,h=y%26;this._expand(u),h>0&&u--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-h),this.strip()},a.prototype.notn=function(y){return this.clone().inotn(y)},a.prototype.setn=function(y,u){i(typeof y=="number"&&y>=0);var h=y/26|0,v=y%26;return this._expand(h+1),u?this.words[h]=this.words[h]|1<y.length?(h=this,v=y):(h=y,v=this);for(var E=0,S=0;S>>26;for(;E!==0&&S>>26;if(this.length=h.length,E!==0)this.words[this.length]=E,this.length++;else if(h!==this)for(;Sy.length?this.clone().iadd(y):y.clone().iadd(this)},a.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var u=this.iadd(y);return y.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var h=this.cmp(y);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,E;h>0?(v=this,E=y):(v=y,E=this);for(var S=0,M=0;M>26,this.words[M]=u&67108863;for(;S!==0&&M>26,this.words[M]=u&67108863;if(S===0&&M>>26,R=x&67108863,Z=Math.min(p,y.length-1),ae=Math.max(0,p-U.length+1);ae<=Z;ae++){var I=p-ae|0;v=U.words[I]|0,E=y.words[ae]|0,S=v*E+R,b+=S/67108864|0,R=S&67108863}u.words[p]=R|0,x=b|0}return x!==0?u.words[p]=x|0:u.length--,u.strip()}var q=function(y,u,h){var v=y.words,E=u.words,S=h.words,M=0,x,p,b,R=v[0]|0,Z=R&8191,ae=R>>>13,I=v[1]|0,ee=I&8191,L=I>>>13,V=v[2]|0,G=V&8191,D=V>>>13,H=v[3]|0,ne=H&8191,ce=H>>>13,fe=v[4]|0,ye=fe&8191,we=fe>>>13,Te=v[5]|0,Qe=Te&8191,Ce=Te>>>13,Re=v[6]|0,Se=Re&8191,me=Re>>>13,Pe=v[7]|0,Ne=Pe&8191,be=Pe>>>13,Oe=v[8]|0,xe=Oe&8191,ve=Oe>>>13,qe=v[9]|0,Me=qe&8191,_e=qe>>>13,He=E[0]|0,Ve=He&8191,Ee=He>>>13,Ke=E[1]|0,ht=Ke&8191,Ge=Ke>>>13,_t=E[2]|0,lt=_t&8191,We=_t>>>13,Et=E[3]|0,St=Et&8191,Be=Et>>>13,Xe=E[4]|0,tt=Xe&8191,$e=Xe>>>13,et=E[5]|0,Ze=et&8191,Fe=et>>>13,ut=E[6]|0,rt=ut&8191,ze=ut>>>13,it=E[7]|0,st=it&8191,Ue=it>>>13,Ye=E[8]|0,ft=Ye&8191,je=Ye>>>13,Rt=E[9]|0,Nt=Rt&8191,at=Rt>>>13;h.negative=y.negative^u.negative,h.length=19,x=Math.imul(Z,Ve),p=Math.imul(Z,Ee),p=p+Math.imul(ae,Ve)|0,b=Math.imul(ae,Ee);var vt=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(vt>>>26)|0,vt&=67108863,x=Math.imul(ee,Ve),p=Math.imul(ee,Ee),p=p+Math.imul(L,Ve)|0,b=Math.imul(L,Ee),x=x+Math.imul(Z,ht)|0,p=p+Math.imul(Z,Ge)|0,p=p+Math.imul(ae,ht)|0,b=b+Math.imul(ae,Ge)|0;var Rr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,x=Math.imul(G,Ve),p=Math.imul(G,Ee),p=p+Math.imul(D,Ve)|0,b=Math.imul(D,Ee),x=x+Math.imul(ee,ht)|0,p=p+Math.imul(ee,Ge)|0,p=p+Math.imul(L,ht)|0,b=b+Math.imul(L,Ge)|0,x=x+Math.imul(Z,lt)|0,p=p+Math.imul(Z,We)|0,p=p+Math.imul(ae,lt)|0,b=b+Math.imul(ae,We)|0;var Nr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,x=Math.imul(ne,Ve),p=Math.imul(ne,Ee),p=p+Math.imul(ce,Ve)|0,b=Math.imul(ce,Ee),x=x+Math.imul(G,ht)|0,p=p+Math.imul(G,Ge)|0,p=p+Math.imul(D,ht)|0,b=b+Math.imul(D,Ge)|0,x=x+Math.imul(ee,lt)|0,p=p+Math.imul(ee,We)|0,p=p+Math.imul(L,lt)|0,b=b+Math.imul(L,We)|0,x=x+Math.imul(Z,St)|0,p=p+Math.imul(Z,Be)|0,p=p+Math.imul(ae,St)|0,b=b+Math.imul(ae,Be)|0;var Br=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Br>>>26)|0,Br&=67108863,x=Math.imul(ye,Ve),p=Math.imul(ye,Ee),p=p+Math.imul(we,Ve)|0,b=Math.imul(we,Ee),x=x+Math.imul(ne,ht)|0,p=p+Math.imul(ne,Ge)|0,p=p+Math.imul(ce,ht)|0,b=b+Math.imul(ce,Ge)|0,x=x+Math.imul(G,lt)|0,p=p+Math.imul(G,We)|0,p=p+Math.imul(D,lt)|0,b=b+Math.imul(D,We)|0,x=x+Math.imul(ee,St)|0,p=p+Math.imul(ee,Be)|0,p=p+Math.imul(L,St)|0,b=b+Math.imul(L,Be)|0,x=x+Math.imul(Z,tt)|0,p=p+Math.imul(Z,$e)|0,p=p+Math.imul(ae,tt)|0,b=b+Math.imul(ae,$e)|0;var $r=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+($r>>>26)|0,$r&=67108863,x=Math.imul(Qe,Ve),p=Math.imul(Qe,Ee),p=p+Math.imul(Ce,Ve)|0,b=Math.imul(Ce,Ee),x=x+Math.imul(ye,ht)|0,p=p+Math.imul(ye,Ge)|0,p=p+Math.imul(we,ht)|0,b=b+Math.imul(we,Ge)|0,x=x+Math.imul(ne,lt)|0,p=p+Math.imul(ne,We)|0,p=p+Math.imul(ce,lt)|0,b=b+Math.imul(ce,We)|0,x=x+Math.imul(G,St)|0,p=p+Math.imul(G,Be)|0,p=p+Math.imul(D,St)|0,b=b+Math.imul(D,Be)|0,x=x+Math.imul(ee,tt)|0,p=p+Math.imul(ee,$e)|0,p=p+Math.imul(L,tt)|0,b=b+Math.imul(L,$e)|0,x=x+Math.imul(Z,Ze)|0,p=p+Math.imul(Z,Fe)|0,p=p+Math.imul(ae,Ze)|0,b=b+Math.imul(ae,Fe)|0;var Ur=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,x=Math.imul(Se,Ve),p=Math.imul(Se,Ee),p=p+Math.imul(me,Ve)|0,b=Math.imul(me,Ee),x=x+Math.imul(Qe,ht)|0,p=p+Math.imul(Qe,Ge)|0,p=p+Math.imul(Ce,ht)|0,b=b+Math.imul(Ce,Ge)|0,x=x+Math.imul(ye,lt)|0,p=p+Math.imul(ye,We)|0,p=p+Math.imul(we,lt)|0,b=b+Math.imul(we,We)|0,x=x+Math.imul(ne,St)|0,p=p+Math.imul(ne,Be)|0,p=p+Math.imul(ce,St)|0,b=b+Math.imul(ce,Be)|0,x=x+Math.imul(G,tt)|0,p=p+Math.imul(G,$e)|0,p=p+Math.imul(D,tt)|0,b=b+Math.imul(D,$e)|0,x=x+Math.imul(ee,Ze)|0,p=p+Math.imul(ee,Fe)|0,p=p+Math.imul(L,Ze)|0,b=b+Math.imul(L,Fe)|0,x=x+Math.imul(Z,rt)|0,p=p+Math.imul(Z,ze)|0,p=p+Math.imul(ae,rt)|0,b=b+Math.imul(ae,ze)|0;var er=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(er>>>26)|0,er&=67108863,x=Math.imul(Ne,Ve),p=Math.imul(Ne,Ee),p=p+Math.imul(be,Ve)|0,b=Math.imul(be,Ee),x=x+Math.imul(Se,ht)|0,p=p+Math.imul(Se,Ge)|0,p=p+Math.imul(me,ht)|0,b=b+Math.imul(me,Ge)|0,x=x+Math.imul(Qe,lt)|0,p=p+Math.imul(Qe,We)|0,p=p+Math.imul(Ce,lt)|0,b=b+Math.imul(Ce,We)|0,x=x+Math.imul(ye,St)|0,p=p+Math.imul(ye,Be)|0,p=p+Math.imul(we,St)|0,b=b+Math.imul(we,Be)|0,x=x+Math.imul(ne,tt)|0,p=p+Math.imul(ne,$e)|0,p=p+Math.imul(ce,tt)|0,b=b+Math.imul(ce,$e)|0,x=x+Math.imul(G,Ze)|0,p=p+Math.imul(G,Fe)|0,p=p+Math.imul(D,Ze)|0,b=b+Math.imul(D,Fe)|0,x=x+Math.imul(ee,rt)|0,p=p+Math.imul(ee,ze)|0,p=p+Math.imul(L,rt)|0,b=b+Math.imul(L,ze)|0,x=x+Math.imul(Z,st)|0,p=p+Math.imul(Z,Ue)|0,p=p+Math.imul(ae,st)|0,b=b+Math.imul(ae,Ue)|0;var Xr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,x=Math.imul(xe,Ve),p=Math.imul(xe,Ee),p=p+Math.imul(ve,Ve)|0,b=Math.imul(ve,Ee),x=x+Math.imul(Ne,ht)|0,p=p+Math.imul(Ne,Ge)|0,p=p+Math.imul(be,ht)|0,b=b+Math.imul(be,Ge)|0,x=x+Math.imul(Se,lt)|0,p=p+Math.imul(Se,We)|0,p=p+Math.imul(me,lt)|0,b=b+Math.imul(me,We)|0,x=x+Math.imul(Qe,St)|0,p=p+Math.imul(Qe,Be)|0,p=p+Math.imul(Ce,St)|0,b=b+Math.imul(Ce,Be)|0,x=x+Math.imul(ye,tt)|0,p=p+Math.imul(ye,$e)|0,p=p+Math.imul(we,tt)|0,b=b+Math.imul(we,$e)|0,x=x+Math.imul(ne,Ze)|0,p=p+Math.imul(ne,Fe)|0,p=p+Math.imul(ce,Ze)|0,b=b+Math.imul(ce,Fe)|0,x=x+Math.imul(G,rt)|0,p=p+Math.imul(G,ze)|0,p=p+Math.imul(D,rt)|0,b=b+Math.imul(D,ze)|0,x=x+Math.imul(ee,st)|0,p=p+Math.imul(ee,Ue)|0,p=p+Math.imul(L,st)|0,b=b+Math.imul(L,Ue)|0,x=x+Math.imul(Z,ft)|0,p=p+Math.imul(Z,je)|0,p=p+Math.imul(ae,ft)|0,b=b+Math.imul(ae,je)|0;var Wi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,x=Math.imul(Me,Ve),p=Math.imul(Me,Ee),p=p+Math.imul(_e,Ve)|0,b=Math.imul(_e,Ee),x=x+Math.imul(xe,ht)|0,p=p+Math.imul(xe,Ge)|0,p=p+Math.imul(ve,ht)|0,b=b+Math.imul(ve,Ge)|0,x=x+Math.imul(Ne,lt)|0,p=p+Math.imul(Ne,We)|0,p=p+Math.imul(be,lt)|0,b=b+Math.imul(be,We)|0,x=x+Math.imul(Se,St)|0,p=p+Math.imul(Se,Be)|0,p=p+Math.imul(me,St)|0,b=b+Math.imul(me,Be)|0,x=x+Math.imul(Qe,tt)|0,p=p+Math.imul(Qe,$e)|0,p=p+Math.imul(Ce,tt)|0,b=b+Math.imul(Ce,$e)|0,x=x+Math.imul(ye,Ze)|0,p=p+Math.imul(ye,Fe)|0,p=p+Math.imul(we,Ze)|0,b=b+Math.imul(we,Fe)|0,x=x+Math.imul(ne,rt)|0,p=p+Math.imul(ne,ze)|0,p=p+Math.imul(ce,rt)|0,b=b+Math.imul(ce,ze)|0,x=x+Math.imul(G,st)|0,p=p+Math.imul(G,Ue)|0,p=p+Math.imul(D,st)|0,b=b+Math.imul(D,Ue)|0,x=x+Math.imul(ee,ft)|0,p=p+Math.imul(ee,je)|0,p=p+Math.imul(L,ft)|0,b=b+Math.imul(L,je)|0,x=x+Math.imul(Z,Nt)|0,p=p+Math.imul(Z,at)|0,p=p+Math.imul(ae,Nt)|0,b=b+Math.imul(ae,at)|0;var Zr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,x=Math.imul(Me,ht),p=Math.imul(Me,Ge),p=p+Math.imul(_e,ht)|0,b=Math.imul(_e,Ge),x=x+Math.imul(xe,lt)|0,p=p+Math.imul(xe,We)|0,p=p+Math.imul(ve,lt)|0,b=b+Math.imul(ve,We)|0,x=x+Math.imul(Ne,St)|0,p=p+Math.imul(Ne,Be)|0,p=p+Math.imul(be,St)|0,b=b+Math.imul(be,Be)|0,x=x+Math.imul(Se,tt)|0,p=p+Math.imul(Se,$e)|0,p=p+Math.imul(me,tt)|0,b=b+Math.imul(me,$e)|0,x=x+Math.imul(Qe,Ze)|0,p=p+Math.imul(Qe,Fe)|0,p=p+Math.imul(Ce,Ze)|0,b=b+Math.imul(Ce,Fe)|0,x=x+Math.imul(ye,rt)|0,p=p+Math.imul(ye,ze)|0,p=p+Math.imul(we,rt)|0,b=b+Math.imul(we,ze)|0,x=x+Math.imul(ne,st)|0,p=p+Math.imul(ne,Ue)|0,p=p+Math.imul(ce,st)|0,b=b+Math.imul(ce,Ue)|0,x=x+Math.imul(G,ft)|0,p=p+Math.imul(G,je)|0,p=p+Math.imul(D,ft)|0,b=b+Math.imul(D,je)|0,x=x+Math.imul(ee,Nt)|0,p=p+Math.imul(ee,at)|0,p=p+Math.imul(L,Nt)|0,b=b+Math.imul(L,at)|0;var Yi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,x=Math.imul(Me,lt),p=Math.imul(Me,We),p=p+Math.imul(_e,lt)|0,b=Math.imul(_e,We),x=x+Math.imul(xe,St)|0,p=p+Math.imul(xe,Be)|0,p=p+Math.imul(ve,St)|0,b=b+Math.imul(ve,Be)|0,x=x+Math.imul(Ne,tt)|0,p=p+Math.imul(Ne,$e)|0,p=p+Math.imul(be,tt)|0,b=b+Math.imul(be,$e)|0,x=x+Math.imul(Se,Ze)|0,p=p+Math.imul(Se,Fe)|0,p=p+Math.imul(me,Ze)|0,b=b+Math.imul(me,Fe)|0,x=x+Math.imul(Qe,rt)|0,p=p+Math.imul(Qe,ze)|0,p=p+Math.imul(Ce,rt)|0,b=b+Math.imul(Ce,ze)|0,x=x+Math.imul(ye,st)|0,p=p+Math.imul(ye,Ue)|0,p=p+Math.imul(we,st)|0,b=b+Math.imul(we,Ue)|0,x=x+Math.imul(ne,ft)|0,p=p+Math.imul(ne,je)|0,p=p+Math.imul(ce,ft)|0,b=b+Math.imul(ce,je)|0,x=x+Math.imul(G,Nt)|0,p=p+Math.imul(G,at)|0,p=p+Math.imul(D,Nt)|0,b=b+Math.imul(D,at)|0;var Qi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,x=Math.imul(Me,St),p=Math.imul(Me,Be),p=p+Math.imul(_e,St)|0,b=Math.imul(_e,Be),x=x+Math.imul(xe,tt)|0,p=p+Math.imul(xe,$e)|0,p=p+Math.imul(ve,tt)|0,b=b+Math.imul(ve,$e)|0,x=x+Math.imul(Ne,Ze)|0,p=p+Math.imul(Ne,Fe)|0,p=p+Math.imul(be,Ze)|0,b=b+Math.imul(be,Fe)|0,x=x+Math.imul(Se,rt)|0,p=p+Math.imul(Se,ze)|0,p=p+Math.imul(me,rt)|0,b=b+Math.imul(me,ze)|0,x=x+Math.imul(Qe,st)|0,p=p+Math.imul(Qe,Ue)|0,p=p+Math.imul(Ce,st)|0,b=b+Math.imul(Ce,Ue)|0,x=x+Math.imul(ye,ft)|0,p=p+Math.imul(ye,je)|0,p=p+Math.imul(we,ft)|0,b=b+Math.imul(we,je)|0,x=x+Math.imul(ne,Nt)|0,p=p+Math.imul(ne,at)|0,p=p+Math.imul(ce,Nt)|0,b=b+Math.imul(ce,at)|0;var ei=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(ei>>>26)|0,ei&=67108863,x=Math.imul(Me,tt),p=Math.imul(Me,$e),p=p+Math.imul(_e,tt)|0,b=Math.imul(_e,$e),x=x+Math.imul(xe,Ze)|0,p=p+Math.imul(xe,Fe)|0,p=p+Math.imul(ve,Ze)|0,b=b+Math.imul(ve,Fe)|0,x=x+Math.imul(Ne,rt)|0,p=p+Math.imul(Ne,ze)|0,p=p+Math.imul(be,rt)|0,b=b+Math.imul(be,ze)|0,x=x+Math.imul(Se,st)|0,p=p+Math.imul(Se,Ue)|0,p=p+Math.imul(me,st)|0,b=b+Math.imul(me,Ue)|0,x=x+Math.imul(Qe,ft)|0,p=p+Math.imul(Qe,je)|0,p=p+Math.imul(Ce,ft)|0,b=b+Math.imul(Ce,je)|0,x=x+Math.imul(ye,Nt)|0,p=p+Math.imul(ye,at)|0,p=p+Math.imul(we,Nt)|0,b=b+Math.imul(we,at)|0;var Mi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,x=Math.imul(Me,Ze),p=Math.imul(Me,Fe),p=p+Math.imul(_e,Ze)|0,b=Math.imul(_e,Fe),x=x+Math.imul(xe,rt)|0,p=p+Math.imul(xe,ze)|0,p=p+Math.imul(ve,rt)|0,b=b+Math.imul(ve,ze)|0,x=x+Math.imul(Ne,st)|0,p=p+Math.imul(Ne,Ue)|0,p=p+Math.imul(be,st)|0,b=b+Math.imul(be,Ue)|0,x=x+Math.imul(Se,ft)|0,p=p+Math.imul(Se,je)|0,p=p+Math.imul(me,ft)|0,b=b+Math.imul(me,je)|0,x=x+Math.imul(Qe,Nt)|0,p=p+Math.imul(Qe,at)|0,p=p+Math.imul(Ce,Nt)|0,b=b+Math.imul(Ce,at)|0;var Ii=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,x=Math.imul(Me,rt),p=Math.imul(Me,ze),p=p+Math.imul(_e,rt)|0,b=Math.imul(_e,ze),x=x+Math.imul(xe,st)|0,p=p+Math.imul(xe,Ue)|0,p=p+Math.imul(ve,st)|0,b=b+Math.imul(ve,Ue)|0,x=x+Math.imul(Ne,ft)|0,p=p+Math.imul(Ne,je)|0,p=p+Math.imul(be,ft)|0,b=b+Math.imul(be,je)|0,x=x+Math.imul(Se,Nt)|0,p=p+Math.imul(Se,at)|0,p=p+Math.imul(me,Nt)|0,b=b+Math.imul(me,at)|0;var lr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(lr>>>26)|0,lr&=67108863,x=Math.imul(Me,st),p=Math.imul(Me,Ue),p=p+Math.imul(_e,st)|0,b=Math.imul(_e,Ue),x=x+Math.imul(xe,ft)|0,p=p+Math.imul(xe,je)|0,p=p+Math.imul(ve,ft)|0,b=b+Math.imul(ve,je)|0,x=x+Math.imul(Ne,Nt)|0,p=p+Math.imul(Ne,at)|0,p=p+Math.imul(be,Nt)|0,b=b+Math.imul(be,at)|0;var Xi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,x=Math.imul(Me,ft),p=Math.imul(Me,je),p=p+Math.imul(_e,ft)|0,b=Math.imul(_e,je),x=x+Math.imul(xe,Nt)|0,p=p+Math.imul(xe,at)|0,p=p+Math.imul(ve,Nt)|0,b=b+Math.imul(ve,at)|0;var Zi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,x=Math.imul(Me,Nt),p=Math.imul(Me,at),p=p+Math.imul(_e,Nt)|0,b=Math.imul(_e,at);var en=(M+x|0)+((p&8191)<<13)|0;return M=(b+(p>>>13)|0)+(en>>>26)|0,en&=67108863,S[0]=vt,S[1]=Rr,S[2]=Nr,S[3]=Br,S[4]=$r,S[5]=Ur,S[6]=er,S[7]=Xr,S[8]=Wi,S[9]=Zr,S[10]=Yi,S[11]=Qi,S[12]=ei,S[13]=Mi,S[14]=Ii,S[15]=lr,S[16]=Xi,S[17]=Zi,S[18]=en,M!==0&&(S[19]=M,h.length++),h};Math.imul||(q=P);function K(U,y,u){u.negative=y.negative^U.negative,u.length=U.length+y.length;for(var h=0,v=0,E=0;E>>26)|0,v+=S>>>26,S&=67108863}u.words[E]=M,h=S,S=v}return h!==0?u.words[E]=h:u.length--,u.strip()}function Y(U,y,u){var h=new z;return h.mulp(U,y,u)}a.prototype.mulTo=function(y,u){var h,v=this.length+y.length;return this.length===10&&y.length===10?h=q(this,y,u):v<63?h=P(this,y,u):v<1024?h=K(this,y,u):h=Y(this,y,u),h};function z(U,y){this.x=U,this.y=y}z.prototype.makeRBT=function(y){for(var u=new Array(y),h=a.prototype._countBits(y)-1,v=0;v>=1;return v},z.prototype.permute=function(y,u,h,v,E,S){for(var M=0;M>>1)E++;return 1<>>13,h[2*S+1]=E&8191,E=E>>>13;for(S=2*u;S>=26,u+=v/67108864|0,u+=E>>>26,this.words[h]=E&67108863}return u!==0&&(this.words[h]=u,this.length++),this},a.prototype.muln=function(y){return this.clone().imuln(y)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(y){var u=C(y);if(u.length===0)return new a(1);for(var h=this,v=0;v=0);var u=y%26,h=(y-u)/26,v=67108863>>>26-u<<26-u,E;if(u!==0){var S=0;for(E=0;E>>26-u}S&&(this.words[E]=S,this.length++)}if(h!==0){for(E=this.length-1;E>=0;E--)this.words[E+h]=this.words[E];for(E=0;E=0);var v;u?v=(u-u%26)/26:v=0;var E=y%26,S=Math.min((y-E)/26,this.length),M=67108863^67108863>>>E<S)for(this.length-=S,p=0;p=0&&(b!==0||p>=v);p--){var R=this.words[p]|0;this.words[p]=b<<26-E|R>>>E,b=R&M}return x&&b!==0&&(x.words[x.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(y,u,h){return i(this.negative===0),this.iushrn(y,u,h)},a.prototype.shln=function(y){return this.clone().ishln(y)},a.prototype.ushln=function(y){return this.clone().iushln(y)},a.prototype.shrn=function(y){return this.clone().ishrn(y)},a.prototype.ushrn=function(y){return this.clone().iushrn(y)},a.prototype.testn=function(y){i(typeof y=="number"&&y>=0);var u=y%26,h=(y-u)/26,v=1<=0);var u=y%26,h=(y-u)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(u!==0&&h++,this.length=Math.min(h,this.length),u!==0){var v=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},a.prototype.isubn=function(y){if(i(typeof y=="number"),i(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(x/67108864|0),this.words[E+h]=S&67108863}for(;E>26,this.words[E+h]=S&67108863;if(M===0)return this.strip();for(i(M===-1),M=0,E=0;E>26,this.words[E]=S&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(y,u){var h=this.length-y.length,v=this.clone(),E=y,S=E.words[E.length-1]|0,M=this._countBits(S);h=26-M,h!==0&&(E=E.ushln(h),v.iushln(h),S=E.words[E.length-1]|0);var x=v.length-E.length,p;if(u!=="mod"){p=new a(null),p.length=x+1,p.words=new Array(p.length);for(var b=0;b=0;Z--){var ae=(v.words[E.length+Z]|0)*67108864+(v.words[E.length+Z-1]|0);for(ae=Math.min(ae/S|0,67108863),v._ishlnsubmul(E,ae,Z);v.negative!==0;)ae--,v.negative=0,v._ishlnsubmul(E,1,Z),v.isZero()||(v.negative^=1);p&&(p.words[Z]=ae)}return p&&p.strip(),v.strip(),u!=="div"&&h!==0&&v.iushrn(h),{div:p||null,mod:v}},a.prototype.divmod=function(y,u,h){if(i(!y.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var v,E,S;return this.negative!==0&&y.negative===0?(S=this.neg().divmod(y,u),u!=="mod"&&(v=S.div.neg()),u!=="div"&&(E=S.mod.neg(),h&&E.negative!==0&&E.iadd(y)),{div:v,mod:E}):this.negative===0&&y.negative!==0?(S=this.divmod(y.neg(),u),u!=="mod"&&(v=S.div.neg()),{div:v,mod:S.mod}):this.negative&y.negative?(S=this.neg().divmod(y.neg(),u),u!=="div"&&(E=S.mod.neg(),h&&E.negative!==0&&E.isub(y)),{div:S.div,mod:E}):y.length>this.length||this.cmp(y)<0?{div:new a(0),mod:this}:y.length===1?u==="div"?{div:this.divn(y.words[0]),mod:null}:u==="mod"?{div:null,mod:new a(this.modn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new a(this.modn(y.words[0]))}:this._wordDiv(y,u)},a.prototype.div=function(y){return this.divmod(y,"div",!1).div},a.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},a.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},a.prototype.divRound=function(y){var u=this.divmod(y);if(u.mod.isZero())return u.div;var h=u.div.negative!==0?u.mod.isub(y):u.mod,v=y.ushrn(1),E=y.andln(1),S=h.cmp(v);return S<0||E===1&&S===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},a.prototype.modn=function(y){i(y<=67108863);for(var u=(1<<26)%y,h=0,v=this.length-1;v>=0;v--)h=(u*h+(this.words[v]|0))%y;return h},a.prototype.idivn=function(y){i(y<=67108863);for(var u=0,h=this.length-1;h>=0;h--){var v=(this.words[h]|0)+u*67108864;this.words[h]=v/y|0,u=v%y}return this.strip()},a.prototype.divn=function(y){return this.clone().idivn(y)},a.prototype.egcd=function(y){i(y.negative===0),i(!y.isZero());var u=this,h=y.clone();u.negative!==0?u=u.umod(y):u=u.clone();for(var v=new a(1),E=new a(0),S=new a(0),M=new a(1),x=0;u.isEven()&&h.isEven();)u.iushrn(1),h.iushrn(1),++x;for(var p=h.clone(),b=u.clone();!u.isZero();){for(var R=0,Z=1;!(u.words[0]&Z)&&R<26;++R,Z<<=1);if(R>0)for(u.iushrn(R);R-- >0;)(v.isOdd()||E.isOdd())&&(v.iadd(p),E.isub(b)),v.iushrn(1),E.iushrn(1);for(var ae=0,I=1;!(h.words[0]&I)&&ae<26;++ae,I<<=1);if(ae>0)for(h.iushrn(ae);ae-- >0;)(S.isOdd()||M.isOdd())&&(S.iadd(p),M.isub(b)),S.iushrn(1),M.iushrn(1);u.cmp(h)>=0?(u.isub(h),v.isub(S),E.isub(M)):(h.isub(u),S.isub(v),M.isub(E))}return{a:S,b:M,gcd:h.iushln(x)}},a.prototype._invmp=function(y){i(y.negative===0),i(!y.isZero());var u=this,h=y.clone();u.negative!==0?u=u.umod(y):u=u.clone();for(var v=new a(1),E=new a(0),S=h.clone();u.cmpn(1)>0&&h.cmpn(1)>0;){for(var M=0,x=1;!(u.words[0]&x)&&M<26;++M,x<<=1);if(M>0)for(u.iushrn(M);M-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);for(var p=0,b=1;!(h.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(h.iushrn(p);p-- >0;)E.isOdd()&&E.iadd(S),E.iushrn(1);u.cmp(h)>=0?(u.isub(h),v.isub(E)):(h.isub(u),E.isub(v))}var R;return u.cmpn(1)===0?R=v:R=E,R.cmpn(0)<0&&R.iadd(y),R},a.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var u=this.clone(),h=y.clone();u.negative=0,h.negative=0;for(var v=0;u.isEven()&&h.isEven();v++)u.iushrn(1),h.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;h.isEven();)h.iushrn(1);var E=u.cmp(h);if(E<0){var S=u;u=h,h=S}else if(E===0||h.cmpn(1)===0)break;u.isub(h)}while(!0);return h.iushln(v)},a.prototype.invm=function(y){return this.egcd(y).a.umod(y)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(y){return this.words[0]&y},a.prototype.bincn=function(y){i(typeof y=="number");var u=y%26,h=(y-u)/26,v=1<>>26,M&=67108863,this.words[S]=M}return E!==0&&(this.words[S]=E,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(y){var u=y<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var h;if(this.length>1)h=1;else{u&&(y=-y),i(y<=67108863,"Number is too big");var v=this.words[0]|0;h=v===y?0:vy.length)return 1;if(this.length=0;h--){var v=this.words[h]|0,E=y.words[h]|0;if(v!==E){vE&&(u=1);break}}return u},a.prototype.gtn=function(y){return this.cmpn(y)===1},a.prototype.gt=function(y){return this.cmp(y)===1},a.prototype.gten=function(y){return this.cmpn(y)>=0},a.prototype.gte=function(y){return this.cmp(y)>=0},a.prototype.ltn=function(y){return this.cmpn(y)===-1},a.prototype.lt=function(y){return this.cmp(y)===-1},a.prototype.lten=function(y){return this.cmpn(y)<=0},a.prototype.lte=function(y){return this.cmp(y)<=0},a.prototype.eqn=function(y){return this.cmpn(y)===0},a.prototype.eq=function(y){return this.cmp(y)===0},a.red=function(y){return new se(y)},a.prototype.toRed=function(y){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(y){return this.red=y,this},a.prototype.forceRed=function(y){return i(!this.red,"Already a number in reduction context"),this._forceRed(y)},a.prototype.redAdd=function(y){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},a.prototype.redIAdd=function(y){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},a.prototype.redSub=function(y){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},a.prototype.redISub=function(y){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},a.prototype.redShl=function(y){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},a.prototype.redMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},a.prototype.redIMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(y){return i(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var W={k256:null,p224:null,p192:null,p25519:null};function B(U,y){this.name=U,this.p=new a(y,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var y=new a(null);return y.words=new Array(Math.ceil(this.n/13)),y},B.prototype.ireduce=function(y){var u=y,h;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),h=u.bitLength();while(h>this.n);var v=h0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},B.prototype.split=function(y,u){y.iushrn(this.n,0,u)},B.prototype.imulK=function(y){return y.imul(this.k)};function j(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(j,B),j.prototype.split=function(y,u){for(var h=4194303,v=Math.min(y.length,9),E=0;E>>22,S=M}S>>>=22,y.words[E-10]=S,S===0&&y.length>10?y.length-=10:y.length-=9},j.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var u=0,h=0;h>>=26,y.words[h]=E,u=v}return u!==0&&(y.words[y.length++]=u),y},a._prime=function(y){if(W[y])return W[y];var u;if(y==="k256")u=new j;else if(y==="p224")u=new k;else if(y==="p192")u=new _;else if(y==="p25519")u=new N;else throw new Error("Unknown prime "+y);return W[y]=u,u};function se(U){if(typeof U=="string"){var y=a._prime(U);this.m=y.p,this.prime=y}else i(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}se.prototype._verify1=function(y){i(y.negative===0,"red works only with positives"),i(y.red,"red works only with red numbers")},se.prototype._verify2=function(y,u){i((y.negative|u.negative)===0,"red works only with positives"),i(y.red&&y.red===u.red,"red works only with red numbers")},se.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):y.umod(this.m)._forceRed(this)},se.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},se.prototype.add=function(y,u){this._verify2(y,u);var h=y.add(u);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},se.prototype.iadd=function(y,u){this._verify2(y,u);var h=y.iadd(u);return h.cmp(this.m)>=0&&h.isub(this.m),h},se.prototype.sub=function(y,u){this._verify2(y,u);var h=y.sub(u);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},se.prototype.isub=function(y,u){this._verify2(y,u);var h=y.isub(u);return h.cmpn(0)<0&&h.iadd(this.m),h},se.prototype.shl=function(y,u){return this._verify1(y),this.imod(y.ushln(u))},se.prototype.imul=function(y,u){return this._verify2(y,u),this.imod(y.imul(u))},se.prototype.mul=function(y,u){return this._verify2(y,u),this.imod(y.mul(u))},se.prototype.isqr=function(y){return this.imul(y,y.clone())},se.prototype.sqr=function(y){return this.mul(y,y)},se.prototype.sqrt=function(y){if(y.isZero())return y.clone();var u=this.m.andln(3);if(i(u%2===1),u===3){var h=this.m.add(new a(1)).iushrn(2);return this.pow(y,h)}for(var v=this.m.subn(1),E=0;!v.isZero()&&v.andln(1)===0;)E++,v.iushrn(1);i(!v.isZero());var S=new a(1).toRed(this),M=S.redNeg(),x=this.m.subn(1).iushrn(1),p=this.m.bitLength();for(p=new a(2*p*p).toRed(this);this.pow(p,x).cmp(M)!==0;)p.redIAdd(M);for(var b=this.pow(p,v),R=this.pow(y,v.addn(1).iushrn(1)),Z=this.pow(y,v),ae=E;Z.cmp(S)!==0;){for(var I=Z,ee=0;I.cmp(S)!==0;ee++)I=I.redSqr();i(ee=0;E--){for(var b=u.words[E],R=p-1;R>=0;R--){var Z=b>>R&1;if(S!==v[0]&&(S=this.sqr(S)),Z===0&&M===0){x=0;continue}M<<=1,M|=Z,x++,!(x!==h&&(E!==0||R!==0))&&(S=this.mul(S,v[M]),x=0,M=0)}p=26}return S},se.prototype.convertTo=function(y){var u=y.umod(this.m);return u===y?u.clone():u},se.prototype.convertFrom=function(y){var u=y.clone();return u.red=null,u},a.mont=function(y){return new le(y)};function le(U){se.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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)}n(le,se),le.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},le.prototype.convertFrom=function(y){var u=this.imod(y.mul(this.rinv));return u.red=null,u},le.prototype.imul=function(y,u){if(y.isZero()||u.isZero())return y.words[0]=0,y.length=1,y;var h=y.imul(u),v=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(v).iushrn(this.shift),S=E;return E.cmp(this.m)>=0?S=E.isub(this.m):E.cmpn(0)<0&&(S=E.iadd(this.m)),S._forceRed(this)},le.prototype.mul=function(y,u){if(y.isZero()||u.isZero())return new a(0)._forceRed(this);var h=y.mul(u),v=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(v).iushrn(this.shift),S=E;return E.cmp(this.m)>=0?S=E.isub(this.m):E.cmpn(0)<0&&(S=E.iadd(this.m)),S._forceRed(this)},le.prototype.invm=function(y){var u=this.imod(y._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(r,tv)})(Gd);var ws=Gd.exports,Da=Av;function Av(r,e){if(!r)throw new Error(e||"Assertion failed")}Av.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var Jd={};(function(r){var e=r;function t(a,c){if(Array.isArray(a))return a.slice();if(!a)return[];var f=[];if(typeof a!="string"){for(var g=0;g>8,w=d&255;m?f.push(m,w):f.push(w)}return f}e.toArray=t;function i(a){return a.length===1?"0"+a:a}e.zero2=i;function n(a){for(var c="",f=0;f(q>>1)-1?Y=(q>>1)-z:Y=z,K.isubn(Y)):Y=0,C[P]=Y,K.iushrn(1)}return C}e.getNAF=a;function c(m,w){var O=[[],[]];m=m.clone(),w=w.clone();for(var C=0,P=0,q;m.cmpn(-C)>0||w.cmpn(-P)>0;){var K=m.andln(3)+C&3,Y=w.andln(3)+P&3;K===3&&(K=-1),Y===3&&(Y=-1);var z;K&1?(q=m.andln(7)+C&7,(q===3||q===5)&&Y===2?z=-K:z=K):z=0,O[0].push(z);var W;Y&1?(q=w.andln(7)+P&7,(q===3||q===5)&&K===2?W=-Y:W=Y):W=0,O[1].push(W),2*C===z+1&&(C=1-C),2*P===W+1&&(P=1-P),m.iushrn(1),w.iushrn(1)}return O}e.getJSF=c;function f(m,w,O){var C="_"+w;m.prototype[w]=function(){return this[C]!==void 0?this[C]:this[C]=O.call(this)}}e.cachedProperty=f;function g(m){return typeof m=="string"?e.toArray(m,"hex"):m}e.parseBytes=g;function d(m){return new t(m,"hex","le")}e.intFromLE=d})(Si);var Wd={exports:{}},_l;Wd.exports=function(e){return _l||(_l=new qs(null)),_l.generate(e)};function qs(r){this.rand=r}Wd.exports.Rand=qs;qs.prototype.generate=function(e){return this._rand(e)};qs.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var qf=Hs;Hs.prototype.point=function(){throw new Error("Not implemented")};Hs.prototype.validate=function(){throw new Error("Not implemented")};Hs.prototype._fixedNafMul=function(e,t){gf(e.precomputed);var i=e._getDoubles(),n=pf(t,1,this._bitLength),a=(1<=f;d--)g=(g<<1)+n[d];c.push(g)}for(var m=this.jpoint(null,null,null),w=this.jpoint(null,null,null),O=a;O>0;O--){for(f=0;f=0;g--){for(var d=0;g>=0&&c[g]===0;g--)d++;if(g>=0&&d++,f=f.dblp(d),g<0)break;var m=c[g];gf(m!==0),e.type==="affine"?m>0?f=f.mixedAdd(a[m-1>>1]):f=f.mixedAdd(a[-m-1>>1].neg()):m>0?f=f.add(a[m-1>>1]):f=f.add(a[-m-1>>1].neg())}return e.type==="affine"?f.toP():f};Hs.prototype._wnafMulAdd=function(e,t,i,n,a){var c=this._wnafT1,f=this._wnafT2,g=this._wnafT3,d=0,m,w,O;for(m=0;m=1;m-=2){var P=m-1,q=m;if(c[P]!==1||c[q]!==1){g[P]=pf(i[P],c[P],this._bitLength),g[q]=pf(i[q],c[q],this._bitLength),d=Math.max(g[P].length,d),d=Math.max(g[q].length,d);continue}var K=[t[P],null,null,t[q]];t[P].y.cmp(t[q].y)===0?(K[1]=t[P].add(t[q]),K[2]=t[P].toJ().mixedAdd(t[q].neg())):t[P].y.cmp(t[q].y.redNeg())===0?(K[1]=t[P].toJ().mixedAdd(t[q]),K[2]=t[P].add(t[q].neg())):(K[1]=t[P].toJ().mixedAdd(t[q]),K[2]=t[P].toJ().mixedAdd(t[q].neg()));var Y=[-3,-1,-5,-7,0,7,5,1,3],z=h9(i[P],i[q]);for(d=Math.max(z[0].length,d),g[P]=new Array(d),g[q]=new Array(d),w=0;w=0;m--){for(var _=0;m>=0;){var N=!0;for(w=0;w=0&&_++,j=j.dblp(_),m<0)break;for(w=0;w0?O=f[w][se-1>>1]:se<0&&(O=f[w][-se-1>>1].neg()),O.type==="affine"?j=j.mixedAdd(O):j=j.add(O))}}for(m=0;m=Math.ceil((e.bitLength()+1)/t.step):!1};Gi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,a=0;a=0&&(C=d,P=m),w.negative&&(w=w.neg(),O=O.neg()),C.negative&&(C=C.neg(),P=P.neg()),[{a:w,b:O},{a:C,b:P}]};Ji.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),c=i.b.neg().mul(e).divRound(this.n),f=a.mul(i.a),g=c.mul(n.a),d=a.mul(i.b),m=c.mul(n.b),w=e.sub(f).sub(g),O=d.add(m).neg();return{k1:w,k2:O}};Ji.prototype.pointFromX=function(e,t){e=new nr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)};Ji.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(a).cmpn(0)===0};Ji.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,a=this._endoWnafT2,c=0;c":""};Ar.prototype.isInfinity=function(){return this.inf};Ar.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};Ar.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),a=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),c=a.redSqr().redISub(this.x.redAdd(this.x)),f=a.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,f)};Ar.prototype.getX=function(){return this.x.fromRed()};Ar.prototype.getY=function(){return this.y.fromRed()};Ar.prototype.mul=function(e){return e=new nr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ar.prototype.mulAdd=function(e,t,i){var n=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)};Ar.prototype.jmulAdd=function(e,t,i){var n=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)};Ar.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ar.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(a){return a.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t};Ar.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Cr(r,e,t,i){lo.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new nr(0)):(this.x=new nr(e,16),this.y=new nr(t,16),this.z=new nr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Qd(Cr,lo.BasePoint);Ji.prototype.jpoint=function(e,t,i){return new Cr(this,e,t,i)};Cr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)};Cr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Cr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),a=e.x.redMul(i),c=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),g=n.redSub(a),d=c.redSub(f);if(g.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=g.redSqr(),w=m.redMul(g),O=n.redMul(m),C=d.redSqr().redIAdd(w).redISub(O).redISub(O),P=d.redMul(O.redISub(C)).redISub(c.redMul(w)),q=this.z.redMul(e.z).redMul(g);return this.curve.jpoint(C,P,q)};Cr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),a=this.y,c=e.y.redMul(t).redMul(this.z),f=i.redSub(n),g=a.redSub(c);if(f.cmpn(0)===0)return g.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=f.redSqr(),m=d.redMul(f),w=i.redMul(d),O=g.redSqr().redIAdd(m).redISub(w).redISub(w),C=g.redMul(w.redISub(O)).redISub(a.redMul(m)),P=this.z.redMul(f);return this.curve.jpoint(O,C,P)};Cr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t=0)return!1;if(i.redIAdd(a),this.x.cmp(i)===0)return!0}};Cr.prototype.inspect=function(){return this.isInfinity()?"":""};Cr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var to=ws,Sv=Pf,Lf=qf,g9=Si;function po(r){Lf.call(this,"mont",r),this.a=new to(r.a,16).toRed(this.red),this.b=new to(r.b,16).toRed(this.red),this.i4=new to(4).toRed(this.red).redInvm(),this.two=new to(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Sv(po,Lf);var b9=po;po.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),a=n.redSqrt();return a.redSqr().cmp(n)===0};function Er(r,e,t){Lf.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new to(e,16),this.z=new to(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Sv(Er,Lf.BasePoint);po.prototype.decodePoint=function(e,t){return this.point(g9.toArray(e,t),1)};po.prototype.point=function(e,t){return new Er(this,e,t)};po.prototype.pointFromJSON=function(e){return Er.fromJSON(this,e)};Er.prototype.precompute=function(){};Er.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Er.fromJSON=function(e,t){return new Er(e,t[0],t[1]||e.one)};Er.prototype.inspect=function(){return this.isInfinity()?"":""};Er.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Er.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),a=t.redSub(n),c=t.redMul(n),f=a.redMul(n.redAdd(this.curve.a24.redMul(a)));return this.curve.point(c,f)};Er.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),c=e.x.redSub(e.z),f=c.redMul(i),g=a.redMul(n),d=t.z.redMul(f.redAdd(g).redSqr()),m=t.x.redMul(f.redISub(g).redSqr());return this.curve.point(d,m)};Er.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),a=this,c=[];t.cmpn(0)!==0;t.iushrn(1))c.push(t.andln(1));for(var f=c.length-1;f>=0;f--)c[f]===0?(i=i.diffAdd(n,a),n=n.dbl()):(n=i.diffAdd(n,a),i=i.dbl());return n};Er.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Er.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Er.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var v9=Si,ps=ws,Mv=Pf,Ff=qf,m9=v9.assert;function Vn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Ff.call(this,"edwards",r),this.a=new ps(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ps(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ps(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),m9(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}Mv(Vn,Ff);var y9=Vn;Vn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Vn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Vn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)};Vn.prototype.pointFromX=function(e,t){e=new ps(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),c=n.redMul(a.redInvm()),f=c.redSqrt();if(f.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");var g=f.fromRed().isOdd();return(t&&!g||!t&&g)&&(f=f.redNeg()),this.point(e,f)};Vn.prototype.pointFromY=function(e,t){e=new ps(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),a=i.redMul(this.d).redMul(this.c2).redSub(this.a),c=n.redMul(a.redInvm());if(c.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=c.redSqrt();if(f.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)};Vn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(a)===0};function Jt(r,e,t,i,n){Ff.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ps(e,16),this.y=new ps(t,16),this.z=i?new ps(i,16):this.curve.one,this.t=n&&new ps(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}Mv(Jt,Ff.BasePoint);Vn.prototype.pointFromJSON=function(e){return Jt.fromJSON(this,e)};Vn.prototype.point=function(e,t,i,n){return new Jt(this,e,t,i,n)};Jt.fromJSON=function(e,t){return new Jt(e,t[0],t[1],t[2])};Jt.prototype.inspect=function(){return this.isInfinity()?"":""};Jt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Jt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),c=n.redAdd(t),f=c.redSub(i),g=n.redSub(t),d=a.redMul(f),m=c.redMul(g),w=a.redMul(g),O=f.redMul(c);return this.curve.point(d,m,O,w)};Jt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,a,c,f,g,d;if(this.curve.twisted){f=this.curve._mulA(t);var m=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(m.redSub(this.curve.two)),a=m.redMul(f.redSub(i)),c=m.redSqr().redSub(m).redSub(m)):(g=this.z.redSqr(),d=m.redSub(g).redISub(g),n=e.redSub(t).redISub(i).redMul(d),a=m.redMul(f.redSub(i)),c=m.redMul(d))}else f=t.redAdd(i),g=this.curve._mulC(this.z).redSqr(),d=f.redSub(g).redSub(g),n=this.curve._mulC(e.redISub(f)).redMul(d),a=this.curve._mulC(f).redMul(t.redISub(i)),c=f.redMul(d);return this.curve.point(n,a,c)};Jt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Jt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),c=i.redSub(t),f=a.redSub(n),g=a.redAdd(n),d=i.redAdd(t),m=c.redMul(f),w=g.redMul(d),O=c.redMul(d),C=f.redMul(g);return this.curve.point(m,w,C,O)};Jt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),a=this.y.redMul(e.y),c=this.curve.d.redMul(n).redMul(a),f=i.redSub(c),g=i.redAdd(c),d=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(a),m=t.redMul(f).redMul(d),w,O;return this.curve.twisted?(w=t.redMul(g).redMul(a.redSub(this.curve._mulA(n))),O=f.redMul(g)):(w=t.redMul(g).redMul(a.redSub(n)),O=this.curve._mulC(f).redMul(g)),this.curve.point(m,w,O)};Jt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Jt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Jt.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)};Jt.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)};Jt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Jt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Jt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Jt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Jt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Jt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}};Jt.prototype.toP=Jt.prototype.normalize;Jt.prototype.mixedAdd=Jt.prototype.add;(function(r){var e=r;e.base=qf,e.short=p9,e.mont=b9,e.edwards=y9})(Yd);var zf={},jf={},Ct={},w9=Da,_9=Pf;Ct.inherits=_9;function D9(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function E9(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n>6|192,t[i++]=a&63|128):D9(r,n)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=a>>18|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128,t[i++]=a&63|128):(t[i++]=a>>12|224,t[i++]=a>>6&63|128,t[i++]=a&63|128)}else for(n=0;n>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Ct.htonl=Iv;function x9(r,e){for(var t="",i=0;i>>0}return a}Ct.join32=S9;function M9(r,e){for(var t=new Array(r.length*4),i=0,n=0;i>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}Ct.split32=M9;function I9(r,e){return r>>>e|r<<32-e}Ct.rotr32=I9;function C9(r,e){return r<>>32-e}Ct.rotl32=C9;function P9(r,e){return r+e>>>0}Ct.sum32=P9;function O9(r,e,t){return r+e+t>>>0}Ct.sum32_3=O9;function T9(r,e,t,i){return r+e+t+i>>>0}Ct.sum32_4=T9;function R9(r,e,t,i,n){return r+e+t+i+n>>>0}Ct.sum32_5=R9;function N9(r,e,t,i){var n=r[e],a=r[e+1],c=i+a>>>0,f=(c>>0,r[e+1]=c}Ct.sum64=N9;function B9(r,e,t,i){var n=e+i>>>0,a=(n>>0}Ct.sum64_hi=B9;function $9(r,e,t,i){var n=e+i;return n>>>0}Ct.sum64_lo=$9;function U9(r,e,t,i,n,a,c,f){var g=0,d=e;d=d+i>>>0,g+=d>>0,g+=d>>0,g+=d>>0}Ct.sum64_4_hi=U9;function q9(r,e,t,i,n,a,c,f){var g=e+i+a+f;return g>>>0}Ct.sum64_4_lo=q9;function L9(r,e,t,i,n,a,c,f,g,d){var m=0,w=e;w=w+i>>>0,m+=w>>0,m+=w>>0,m+=w>>0,m+=w>>0}Ct.sum64_5_hi=L9;function F9(r,e,t,i,n,a,c,f,g,d){var m=e+i+a+f+d;return m>>>0}Ct.sum64_5_lo=F9;function z9(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Ct.rotr64_hi=z9;function j9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ct.rotr64_lo=j9;function k9(r,e,t){return r>>>t}Ct.shr64_hi=k9;function H9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ct.shr64_lo=H9;var go={},q1=Ct,K9=Da;function kf(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}go.BlockHash=kf;kf.prototype.update=function(e,t){if(e=q1.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=q1.join32(e,0,e.length-i,this.endian);for(var n=0;n>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,c=8;c>>3}Gn.g0_256=Y9;function Q9(r){return Rn(r,17)^Rn(r,19)^r>>>10}Gn.g1_256=Q9;var so=Ct,X9=go,Z9=Gn,Dl=so.rotl32,Wo=so.sum32,eD=so.sum32_5,tD=Z9.ft_1,Nv=X9.BlockHash,rD=[1518500249,1859775393,2400959708,3395469782];function zn(){if(!(this instanceof zn))return new zn;Nv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}so.inherits(zn,Nv);var iD=zn;zn.blockSize=512;zn.outSize=160;zn.hmacStrength=80;zn.padLength=64;zn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;nthis.blockSize&&(e=new this.Hash().update(e).digest()),HD(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var JD=zs;zs.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};zs.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=pa.toArray(i,n||"hex"),this._update(i));for(var a=[];a.length"};var bf=ws,Xd=Si,XD=Xd.assert;function Hf(r,e){if(r instanceof Hf)return r;this._importDER(r,e)||(XD(r.r&&r.s,"Signature without r or s"),this.r=new bf(r.r,16),this.s=new bf(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var ZD=Hf;function eE(){this.place=0}function Sl(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,a=0,c=e.place;a>>=0;return n<=127?!1:(e.place=c,n)}function k1(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Hf.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=k1(t),i=k1(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];Ml(n,t.length),n=n.concat(t),n.push(2),Ml(n,i.length);var a=n.concat(i),c=[48];return Ml(c,a.length),c=c.concat(a),Xd.encode(c,e)};var gs=ws,Vv=JD,tE=Si,Il=zf,rE=xv,Gv=tE.assert,Zd=QD,Kf=ZD;function Ki(r){if(!(this instanceof Ki))return new Ki(r);typeof r=="string"&&(Gv(Object.prototype.hasOwnProperty.call(Il,r),"Unknown curve "+r),r=Il[r]),r instanceof Il.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var iE=Ki;Ki.prototype.keyPair=function(e){return new Zd(this,e)};Ki.prototype.keyFromPrivate=function(e,t){return Zd.fromPrivate(this,e,t)};Ki.prototype.keyFromPublic=function(e,t){return Zd.fromPublic(this,e,t)};Ki.prototype.genKeyPair=function(e){e||(e={});for(var t=new Vv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rE(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new gs(2));;){var a=new gs(t.generate(i));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}};Ki.prototype._truncateToN=function(e,t,i){var n;if(gs.isBN(e)||typeof e=="number")e=new gs(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new gs(e,16);else{var a=e.toString();n=a.length+1>>>1,e=new gs(a,16)}typeof i!="number"&&(i=n*8);var c=i-this.n.bitLength();return c>0&&(e=e.ushrn(c)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};Ki.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,n.msgBitLength);for(var a=this.n.byteLength(),c=t.getPrivate().toArray("be",a),f=e.toArray("be",a),g=new Vv({hash:this.hash,entropy:c,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),d=this.n.sub(new gs(1)),m=0;;m++){var w=n.k?n.k(m):new gs(g.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(d)>=0)){var O=this.g.mul(w);if(!O.isInfinity()){var C=O.getX(),P=C.umod(this.n);if(P.cmpn(0)!==0){var q=w.invm(this.n).mul(P.mul(t.getPrivate()).iadd(e));if(q=q.umod(this.n),q.cmpn(0)!==0){var K=(O.getY().isOdd()?1:0)|(C.cmp(P)!==0?2:0);return n.canonical&&q.cmp(this.nh)>0&&(q=this.n.sub(q),K^=1),new Kf({r:P,s:q,recoveryParam:K})}}}}}};Ki.prototype.verify=function(e,t,i,n,a){a||(a={}),e=this._truncateToN(e,!1,a.msgBitLength),i=this.keyFromPublic(i,n),t=new Kf(t,"hex");var c=t.r,f=t.s;if(c.cmpn(1)<0||c.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var g=f.invm(this.n),d=g.mul(e).umod(this.n),m=g.mul(c).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(d,i.getPublic(),m),w.isInfinity()?!1:w.eqXToP(c)):(w=this.g.mulAdd(d,i.getPublic(),m),w.isInfinity()?!1:w.getX().umod(this.n).cmp(c)===0)};Ki.prototype.recoverPubKey=function(r,e,t,i){Gv((3&t)===t,"The recovery param is more than two bits"),e=new Kf(e,i);var n=this.n,a=new gs(r),c=e.r,f=e.s,g=t&1,d=t>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?c=this.curve.pointFromX(c.add(this.curve.n),g):c=this.curve.pointFromX(c,g);var m=e.r.invm(n),w=n.sub(a).mul(m).umod(n),O=f.mul(m).umod(n);return this.g.mulAdd(w,c,O)};Ki.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Kf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(r,e,n)}catch{continue}if(a.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var Cc=Si,Jv=Cc.assert,H1=Cc.parseBytes,mo=Cc.cachedProperty;function Dr(r,e){this.eddsa=r,this._secret=H1(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=H1(e.pub)}Dr.fromPublic=function(e,t){return t instanceof Dr?t:new Dr(e,{pub:t})};Dr.fromSecret=function(e,t){return t instanceof Dr?t:new Dr(e,{secret:t})};Dr.prototype.secret=function(){return this._secret};mo(Dr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});mo(Dr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});mo(Dr,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n});mo(Dr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});mo(Dr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});mo(Dr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Dr.prototype.sign=function(e){return Jv(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Dr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};Dr.prototype.getSecret=function(e){return Jv(this._secret,"KeyPair is public only"),Cc.encode(this.secret(),e)};Dr.prototype.getPublic=function(e){return Cc.encode(this.pubBytes(),e)};var nE=Dr,sE=ws,Vf=Si,K1=Vf.assert,Gf=Vf.cachedProperty,aE=Vf.parseBytes;function Ea(r,e){this.eddsa=r,typeof e!="object"&&(e=aE(e)),Array.isArray(e)&&(K1(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),K1(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof sE&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Gf(Ea,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Gf(Ea,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Gf(Ea,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Gf(Ea,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Ea.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Ea.prototype.toHex=function(){return Vf.encode(this.toBytes(),"hex").toUpperCase()};var oE=Ea,cE=jf,uE=zf,co=Si,fE=co.assert,Wv=co.parseBytes,Yv=nE,V1=oE;function li(r){if(fE(r==="ed25519","only tested with ed25519 so far"),!(this instanceof li))return new li(r);r=uE[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=cE.sha512}var hE=li;li.prototype.sign=function(e,t){e=Wv(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),a=this.g.mul(n),c=this.encodePoint(a),f=this.hashInt(c,i.pubBytes(),e).mul(i.priv()),g=n.add(f).umod(this.curve.n);return this.makeSignature({R:a,S:g,Rencoded:c})};li.prototype.verify=function(e,t,i){if(e=Wv(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),c=this.g.mul(t.S()),f=t.R().add(n.pub().mul(a));return f.eq(c)};li.prototype.hashInt=function(){for(var e=this.hash(),t=0;t0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=g[m++],d--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(m=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,m,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=g[m++],d--;return this},f.prototype.finish=function(g){if(!this._finished){var d=this._bytesHashed,m=this._bufferLength,w=d/536870912|0,O=d<<3,C=d%128<112?128:256;this._buffer[m]=128;for(var P=m+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(g){t.wipe(g.stateHi),t.wipe(g.stateLo),g.buffer&&t.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},f}();r.SHA512=i;var n=new Int32Array([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]);function a(f,g,d,m,w,O,C){for(var P=d[0],q=d[1],K=d[2],Y=d[3],z=d[4],W=d[5],B=d[6],j=d[7],k=m[0],_=m[1],N=m[2],se=m[3],le=m[4],U=m[5],y=m[6],u=m[7],h,v,E,S,M,x,p,b;C>=128;){for(var R=0;R<16;R++){var Z=8*R+O;f[R]=e.readUint32BE(w,Z),g[R]=e.readUint32BE(w,Z+4)}for(var R=0;R<80;R++){var ae=P,I=q,ee=K,L=Y,V=z,G=W,D=B,H=j,ne=k,ce=_,fe=N,ye=se,we=le,Te=U,Qe=y,Ce=u;if(h=j,v=u,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=(z>>>14|le<<18)^(z>>>18|le<<14)^(le>>>9|z<<23),v=(le>>>14|z<<18)^(le>>>18|z<<14)^(z>>>9|le<<23),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=z&W^~z&B,v=le&U^~le&y,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=n[R*2],v=n[R*2+1],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=f[R%16],v=g[R%16],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,E=p&65535|b<<16,S=M&65535|x<<16,h=E,v=S,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=(P>>>28|k<<4)^(k>>>2|P<<30)^(k>>>7|P<<25),v=(k>>>28|P<<4)^(P>>>2|k<<30)^(P>>>7|k<<25),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=P&q^P&K^q&K,v=k&_^k&N^_&N,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,H=p&65535|b<<16,Ce=M&65535|x<<16,h=L,v=ye,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=E,v=S,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,L=p&65535|b<<16,ye=M&65535|x<<16,q=ae,K=I,Y=ee,z=L,W=V,B=G,j=D,P=H,_=ne,N=ce,se=fe,le=ye,U=we,y=Te,u=Qe,k=Ce,R%16===15)for(var Z=0;Z<16;Z++)h=f[Z],v=g[Z],M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=f[(Z+9)%16],v=g[(Z+9)%16],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,E=f[(Z+1)%16],S=g[(Z+1)%16],h=(E>>>1|S<<31)^(E>>>8|S<<24)^E>>>7,v=(S>>>1|E<<31)^(S>>>8|E<<24)^(S>>>7|E<<25),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,E=f[(Z+14)%16],S=g[(Z+14)%16],h=(E>>>19|S<<13)^(S>>>29|E<<3)^E>>>6,v=(S>>>19|E<<13)^(E>>>29|S<<3)^(S>>>6|E<<26),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,f[Z]=p&65535|b<<16,g[Z]=M&65535|x<<16}h=P,v=k,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[0],v=m[0],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[0]=P=p&65535|b<<16,m[0]=k=M&65535|x<<16,h=q,v=_,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[1],v=m[1],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[1]=q=p&65535|b<<16,m[1]=_=M&65535|x<<16,h=K,v=N,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[2],v=m[2],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[2]=K=p&65535|b<<16,m[2]=N=M&65535|x<<16,h=Y,v=se,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[3],v=m[3],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[3]=Y=p&65535|b<<16,m[3]=se=M&65535|x<<16,h=z,v=le,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[4],v=m[4],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[4]=z=p&65535|b<<16,m[4]=le=M&65535|x<<16,h=W,v=U,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[5],v=m[5],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[5]=W=p&65535|b<<16,m[5]=U=M&65535|x<<16,h=B,v=y,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[6],v=m[6],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[6]=B=p&65535|b<<16,m[6]=y=M&65535|x<<16,h=j,v=u,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[7],v=m[7],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[7]=j=p&65535|b<<16,m[7]=u=M&65535|x<<16,O+=128,C-=128}return O}function c(f){var g=new i;g.update(f);var d=g.digest();return g.clean(),d}r.hash=c})(Qv);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=ks,t=Qv,i=xi;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(L){const V=new Float64Array(16);if(L)for(let G=0;G>16&1),G[ce-1]&=65535;G[15]=D[15]-32767-(G[14]>>16&1);const ne=G[15]>>16&1;G[14]&=65535,q(D,G,1-ne)}for(let H=0;H<16;H++)L[2*H]=D[H]&255,L[2*H+1]=D[H]>>8}function Y(L,V){let G=0;for(let D=0;D<32;D++)G|=L[D]^V[D];return(1&G-1>>>8)-1}function z(L,V){const G=new Uint8Array(32),D=new Uint8Array(32);return K(G,L),K(D,V),Y(G,D)}function W(L){const V=new Uint8Array(32);return K(V,L),V[0]&1}function B(L,V){for(let G=0;G<16;G++)L[G]=V[2*G]+(V[2*G+1]<<8);L[15]&=32767}function j(L,V,G){for(let D=0;D<16;D++)L[D]=V[D]+G[D]}function k(L,V,G){for(let D=0;D<16;D++)L[D]=V[D]-G[D]}function _(L,V,G){let D,H,ne=0,ce=0,fe=0,ye=0,we=0,Te=0,Qe=0,Ce=0,Re=0,Se=0,me=0,Pe=0,Ne=0,be=0,Oe=0,xe=0,ve=0,qe=0,Me=0,_e=0,He=0,Ve=0,Ee=0,Ke=0,ht=0,Ge=0,_t=0,lt=0,We=0,Et=0,St=0,Be=G[0],Xe=G[1],tt=G[2],$e=G[3],et=G[4],Ze=G[5],Fe=G[6],ut=G[7],rt=G[8],ze=G[9],it=G[10],st=G[11],Ue=G[12],Ye=G[13],ft=G[14],je=G[15];D=V[0],ne+=D*Be,ce+=D*Xe,fe+=D*tt,ye+=D*$e,we+=D*et,Te+=D*Ze,Qe+=D*Fe,Ce+=D*ut,Re+=D*rt,Se+=D*ze,me+=D*it,Pe+=D*st,Ne+=D*Ue,be+=D*Ye,Oe+=D*ft,xe+=D*je,D=V[1],ce+=D*Be,fe+=D*Xe,ye+=D*tt,we+=D*$e,Te+=D*et,Qe+=D*Ze,Ce+=D*Fe,Re+=D*ut,Se+=D*rt,me+=D*ze,Pe+=D*it,Ne+=D*st,be+=D*Ue,Oe+=D*Ye,xe+=D*ft,ve+=D*je,D=V[2],fe+=D*Be,ye+=D*Xe,we+=D*tt,Te+=D*$e,Qe+=D*et,Ce+=D*Ze,Re+=D*Fe,Se+=D*ut,me+=D*rt,Pe+=D*ze,Ne+=D*it,be+=D*st,Oe+=D*Ue,xe+=D*Ye,ve+=D*ft,qe+=D*je,D=V[3],ye+=D*Be,we+=D*Xe,Te+=D*tt,Qe+=D*$e,Ce+=D*et,Re+=D*Ze,Se+=D*Fe,me+=D*ut,Pe+=D*rt,Ne+=D*ze,be+=D*it,Oe+=D*st,xe+=D*Ue,ve+=D*Ye,qe+=D*ft,Me+=D*je,D=V[4],we+=D*Be,Te+=D*Xe,Qe+=D*tt,Ce+=D*$e,Re+=D*et,Se+=D*Ze,me+=D*Fe,Pe+=D*ut,Ne+=D*rt,be+=D*ze,Oe+=D*it,xe+=D*st,ve+=D*Ue,qe+=D*Ye,Me+=D*ft,_e+=D*je,D=V[5],Te+=D*Be,Qe+=D*Xe,Ce+=D*tt,Re+=D*$e,Se+=D*et,me+=D*Ze,Pe+=D*Fe,Ne+=D*ut,be+=D*rt,Oe+=D*ze,xe+=D*it,ve+=D*st,qe+=D*Ue,Me+=D*Ye,_e+=D*ft,He+=D*je,D=V[6],Qe+=D*Be,Ce+=D*Xe,Re+=D*tt,Se+=D*$e,me+=D*et,Pe+=D*Ze,Ne+=D*Fe,be+=D*ut,Oe+=D*rt,xe+=D*ze,ve+=D*it,qe+=D*st,Me+=D*Ue,_e+=D*Ye,He+=D*ft,Ve+=D*je,D=V[7],Ce+=D*Be,Re+=D*Xe,Se+=D*tt,me+=D*$e,Pe+=D*et,Ne+=D*Ze,be+=D*Fe,Oe+=D*ut,xe+=D*rt,ve+=D*ze,qe+=D*it,Me+=D*st,_e+=D*Ue,He+=D*Ye,Ve+=D*ft,Ee+=D*je,D=V[8],Re+=D*Be,Se+=D*Xe,me+=D*tt,Pe+=D*$e,Ne+=D*et,be+=D*Ze,Oe+=D*Fe,xe+=D*ut,ve+=D*rt,qe+=D*ze,Me+=D*it,_e+=D*st,He+=D*Ue,Ve+=D*Ye,Ee+=D*ft,Ke+=D*je,D=V[9],Se+=D*Be,me+=D*Xe,Pe+=D*tt,Ne+=D*$e,be+=D*et,Oe+=D*Ze,xe+=D*Fe,ve+=D*ut,qe+=D*rt,Me+=D*ze,_e+=D*it,He+=D*st,Ve+=D*Ue,Ee+=D*Ye,Ke+=D*ft,ht+=D*je,D=V[10],me+=D*Be,Pe+=D*Xe,Ne+=D*tt,be+=D*$e,Oe+=D*et,xe+=D*Ze,ve+=D*Fe,qe+=D*ut,Me+=D*rt,_e+=D*ze,He+=D*it,Ve+=D*st,Ee+=D*Ue,Ke+=D*Ye,ht+=D*ft,Ge+=D*je,D=V[11],Pe+=D*Be,Ne+=D*Xe,be+=D*tt,Oe+=D*$e,xe+=D*et,ve+=D*Ze,qe+=D*Fe,Me+=D*ut,_e+=D*rt,He+=D*ze,Ve+=D*it,Ee+=D*st,Ke+=D*Ue,ht+=D*Ye,Ge+=D*ft,_t+=D*je,D=V[12],Ne+=D*Be,be+=D*Xe,Oe+=D*tt,xe+=D*$e,ve+=D*et,qe+=D*Ze,Me+=D*Fe,_e+=D*ut,He+=D*rt,Ve+=D*ze,Ee+=D*it,Ke+=D*st,ht+=D*Ue,Ge+=D*Ye,_t+=D*ft,lt+=D*je,D=V[13],be+=D*Be,Oe+=D*Xe,xe+=D*tt,ve+=D*$e,qe+=D*et,Me+=D*Ze,_e+=D*Fe,He+=D*ut,Ve+=D*rt,Ee+=D*ze,Ke+=D*it,ht+=D*st,Ge+=D*Ue,_t+=D*Ye,lt+=D*ft,We+=D*je,D=V[14],Oe+=D*Be,xe+=D*Xe,ve+=D*tt,qe+=D*$e,Me+=D*et,_e+=D*Ze,He+=D*Fe,Ve+=D*ut,Ee+=D*rt,Ke+=D*ze,ht+=D*it,Ge+=D*st,_t+=D*Ue,lt+=D*Ye,We+=D*ft,Et+=D*je,D=V[15],xe+=D*Be,ve+=D*Xe,qe+=D*tt,Me+=D*$e,_e+=D*et,He+=D*Ze,Ve+=D*Fe,Ee+=D*ut,Ke+=D*rt,ht+=D*ze,Ge+=D*it,_t+=D*st,lt+=D*Ue,We+=D*Ye,Et+=D*ft,St+=D*je,ne+=38*ve,ce+=38*qe,fe+=38*Me,ye+=38*_e,we+=38*He,Te+=38*Ve,Qe+=38*Ee,Ce+=38*Ke,Re+=38*ht,Se+=38*Ge,me+=38*_t,Pe+=38*lt,Ne+=38*We,be+=38*Et,Oe+=38*St,H=1,D=ne+H+65535,H=Math.floor(D/65536),ne=D-H*65536,D=ce+H+65535,H=Math.floor(D/65536),ce=D-H*65536,D=fe+H+65535,H=Math.floor(D/65536),fe=D-H*65536,D=ye+H+65535,H=Math.floor(D/65536),ye=D-H*65536,D=we+H+65535,H=Math.floor(D/65536),we=D-H*65536,D=Te+H+65535,H=Math.floor(D/65536),Te=D-H*65536,D=Qe+H+65535,H=Math.floor(D/65536),Qe=D-H*65536,D=Ce+H+65535,H=Math.floor(D/65536),Ce=D-H*65536,D=Re+H+65535,H=Math.floor(D/65536),Re=D-H*65536,D=Se+H+65535,H=Math.floor(D/65536),Se=D-H*65536,D=me+H+65535,H=Math.floor(D/65536),me=D-H*65536,D=Pe+H+65535,H=Math.floor(D/65536),Pe=D-H*65536,D=Ne+H+65535,H=Math.floor(D/65536),Ne=D-H*65536,D=be+H+65535,H=Math.floor(D/65536),be=D-H*65536,D=Oe+H+65535,H=Math.floor(D/65536),Oe=D-H*65536,D=xe+H+65535,H=Math.floor(D/65536),xe=D-H*65536,ne+=H-1+37*(H-1),H=1,D=ne+H+65535,H=Math.floor(D/65536),ne=D-H*65536,D=ce+H+65535,H=Math.floor(D/65536),ce=D-H*65536,D=fe+H+65535,H=Math.floor(D/65536),fe=D-H*65536,D=ye+H+65535,H=Math.floor(D/65536),ye=D-H*65536,D=we+H+65535,H=Math.floor(D/65536),we=D-H*65536,D=Te+H+65535,H=Math.floor(D/65536),Te=D-H*65536,D=Qe+H+65535,H=Math.floor(D/65536),Qe=D-H*65536,D=Ce+H+65535,H=Math.floor(D/65536),Ce=D-H*65536,D=Re+H+65535,H=Math.floor(D/65536),Re=D-H*65536,D=Se+H+65535,H=Math.floor(D/65536),Se=D-H*65536,D=me+H+65535,H=Math.floor(D/65536),me=D-H*65536,D=Pe+H+65535,H=Math.floor(D/65536),Pe=D-H*65536,D=Ne+H+65535,H=Math.floor(D/65536),Ne=D-H*65536,D=be+H+65535,H=Math.floor(D/65536),be=D-H*65536,D=Oe+H+65535,H=Math.floor(D/65536),Oe=D-H*65536,D=xe+H+65535,H=Math.floor(D/65536),xe=D-H*65536,ne+=H-1+37*(H-1),L[0]=ne,L[1]=ce,L[2]=fe,L[3]=ye,L[4]=we,L[5]=Te,L[6]=Qe,L[7]=Ce,L[8]=Re,L[9]=Se,L[10]=me,L[11]=Pe,L[12]=Ne,L[13]=be,L[14]=Oe,L[15]=xe}function N(L,V){_(L,V,V)}function se(L,V){const G=n();let D;for(D=0;D<16;D++)G[D]=V[D];for(D=253;D>=0;D--)N(G,G),D!==2&&D!==4&&_(G,G,V);for(D=0;D<16;D++)L[D]=G[D]}function le(L,V){const G=n();let D;for(D=0;D<16;D++)G[D]=V[D];for(D=250;D>=0;D--)N(G,G),D!==1&&_(G,G,V);for(D=0;D<16;D++)L[D]=G[D]}function U(L,V){const G=n(),D=n(),H=n(),ne=n(),ce=n(),fe=n(),ye=n(),we=n(),Te=n();k(G,L[1],L[0]),k(Te,V[1],V[0]),_(G,G,Te),j(D,L[0],L[1]),j(Te,V[0],V[1]),_(D,D,Te),_(H,L[3],V[3]),_(H,H,d),_(ne,L[2],V[2]),j(ne,ne,ne),k(ce,D,G),k(fe,ne,H),j(ye,ne,H),j(we,D,G),_(L[0],ce,fe),_(L[1],we,ye),_(L[2],ye,fe),_(L[3],ce,we)}function y(L,V,G){for(let D=0;D<4;D++)q(L[D],V[D],G)}function u(L,V){const G=n(),D=n(),H=n();se(H,V[2]),_(G,V[0],H),_(D,V[1],H),K(L,D),L[31]^=W(G)<<7}function h(L,V,G){C(L[0],c),C(L[1],f),C(L[2],f),C(L[3],c);for(let D=255;D>=0;--D){const H=G[D/8|0]>>(D&7)&1;y(L,V,H),U(V,L),U(L,L),y(L,V,H)}}function v(L,V){const G=[n(),n(),n(),n()];C(G[0],m),C(G[1],w),C(G[2],f),_(G[3],m,w),h(L,G,V)}function E(L){if(L.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const V=(0,t.hash)(L);V[0]&=248,V[31]&=127,V[31]|=64;const G=new Uint8Array(32),D=[n(),n(),n(),n()];v(D,V),u(G,D);const H=new Uint8Array(64);return H.set(L),H.set(G,32),{publicKey:G,secretKey:H}}r.generateKeyPairFromSeed=E;function S(L){const V=(0,e.randomBytes)(32,L),G=E(V);return(0,i.wipe)(V),G}r.generateKeyPair=S;function M(L){if(L.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(L.subarray(32))}r.extractPublicKeyFromSecretKey=M;const x=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function p(L,V){let G,D,H,ne;for(D=63;D>=32;--D){for(G=0,H=D-32,ne=D-12;H>4)*x[H],G=V[H]>>8,V[H]&=255;for(H=0;H<32;H++)V[H]-=G*x[H];for(D=0;D<32;D++)V[D+1]+=V[D]>>8,L[D]=V[D]&255}function b(L){const V=new Float64Array(64);for(let G=0;G<64;G++)V[G]=L[G];for(let G=0;G<64;G++)L[G]=0;p(L,V)}function R(L,V){const G=new Float64Array(64),D=[n(),n(),n(),n()],H=(0,t.hash)(L.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const ne=new Uint8Array(64);ne.set(H.subarray(32),32);const ce=new t.SHA512;ce.update(ne.subarray(32)),ce.update(V);const fe=ce.digest();ce.clean(),b(fe),v(D,fe),u(ne,D),ce.reset(),ce.update(ne.subarray(0,32)),ce.update(L.subarray(32)),ce.update(V);const ye=ce.digest();b(ye);for(let we=0;we<32;we++)G[we]=fe[we];for(let we=0;we<32;we++)for(let Te=0;Te<32;Te++)G[we+Te]+=ye[we]*H[Te];return p(ne.subarray(32),G),ne}r.sign=R;function Z(L,V){const G=n(),D=n(),H=n(),ne=n(),ce=n(),fe=n(),ye=n();return C(L[2],f),B(L[1],V),N(H,L[1]),_(ne,H,g),k(H,H,L[2]),j(ne,L[2],ne),N(ce,ne),N(fe,ce),_(ye,fe,ce),_(G,ye,H),_(G,G,ne),le(G,G),_(G,G,H),_(G,G,ne),_(G,G,ne),_(L[0],G,ne),N(D,L[0]),_(D,D,ne),z(D,H)&&_(L[0],L[0],O),N(D,L[0]),_(D,D,ne),z(D,H)?-1:(W(L[0])===V[31]>>7&&k(L[0],c,L[0]),_(L[3],L[0],L[1]),0)}function ae(L,V,G){const D=new Uint8Array(32),H=[n(),n(),n(),n()],ne=[n(),n(),n(),n()];if(G.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(Z(ne,L))return!1;const ce=new t.SHA512;ce.update(G.subarray(0,32)),ce.update(L),ce.update(V);const fe=ce.digest();return b(fe),h(H,ne,fe),v(ne,G.subarray(32)),U(H,ne),u(D,H),!Y(G,D)}r.verify=ae;function I(L){let V=[n(),n(),n(),n()];if(Z(V,L))throw new Error("Ed25519: invalid public key");let G=n(),D=n(),H=V[1];j(G,f,H),k(D,f,H),se(D,D),_(G,G,D);let ne=new Uint8Array(32);return K(ne,G),ne}r.convertPublicKeyToX25519=I;function ee(L){const V=(0,t.hash)(L.subarray(0,32));V[0]&=248,V[31]&=127,V[31]|=64;const G=new Uint8Array(V.subarray(0,32));return(0,i.wipe)(V),G}r.convertSecretKeyToX25519=ee})(e0);const lE="EdDSA",dE="JWT",vf=".",Jf="base64url",Xv="utf8",Zv="utf8",pE=":",gE="did",bE="key",G1="base58btc",vE="z",mE="K36",yE=32;function t0(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function e3(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?t0(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function wE(r,e){e||(e=r.reduce((n,a)=>n+a.length,0));const t=e3(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t0(t)}function _E(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function C(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:C}}var DE=_E,EE=DE;const AE=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},xE=r=>new TextEncoder().encode(r),SE=r=>new TextDecoder().decode(r);let ME=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},IE=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return t3(this,e)}},CE=class{constructor(e){this.decoders=e}or(e){return t3(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const t3=(r,e)=>new CE({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});let PE=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ME(e,t,i),this.decoder=new IE(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Wf=({name:r,prefix:e,encode:t,decode:i})=>new PE(r,e,t,i),Pc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=EE(t,e);return Wf({prefix:r,name:e,encode:i,decode:a=>AE(n(a))})},OE=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},TE=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<Wf({prefix:e,name:r,encode(n){return TE(n,i,t)},decode(n){return OE(n,i,t,r)}}),RE=Wf({prefix:"\0",name:"identity",encode:r=>SE(r),decode:r=>xE(r)}),NE=Object.freeze(Object.defineProperty({__proto__:null,identity:RE},Symbol.toStringTag,{value:"Module"})),BE=Pr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),$E=Object.freeze(Object.defineProperty({__proto__:null,base2:BE},Symbol.toStringTag,{value:"Module"})),UE=Pr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),qE=Object.freeze(Object.defineProperty({__proto__:null,base8:UE},Symbol.toStringTag,{value:"Module"})),LE=Pc({prefix:"9",name:"base10",alphabet:"0123456789"}),FE=Object.freeze(Object.defineProperty({__proto__:null,base10:LE},Symbol.toStringTag,{value:"Module"})),zE=Pr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jE=Pr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),kE=Object.freeze(Object.defineProperty({__proto__:null,base16:zE,base16upper:jE},Symbol.toStringTag,{value:"Module"})),HE=Pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KE=Pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),VE=Pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),GE=Pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),JE=Pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),WE=Pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YE=Pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QE=Pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XE=Pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ZE=Object.freeze(Object.defineProperty({__proto__:null,base32:HE,base32hex:JE,base32hexpad:YE,base32hexpadupper:QE,base32hexupper:WE,base32pad:VE,base32padupper:GE,base32upper:KE,base32z:XE},Symbol.toStringTag,{value:"Module"})),eA=Pc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tA=Pc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),rA=Object.freeze(Object.defineProperty({__proto__:null,base36:eA,base36upper:tA},Symbol.toStringTag,{value:"Module"})),iA=Pc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nA=Pc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),sA=Object.freeze(Object.defineProperty({__proto__:null,base58btc:iA,base58flickr:nA},Symbol.toStringTag,{value:"Module"})),aA=Pr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oA=Pr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cA=Pr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uA=Pr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),fA=Object.freeze(Object.defineProperty({__proto__:null,base64:aA,base64pad:oA,base64url:cA,base64urlpad:uA},Symbol.toStringTag,{value:"Module"})),r3=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),hA=r3.reduce((r,e,t)=>(r[t]=e,r),[]),lA=r3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function dA(r){return r.reduce((e,t)=>(e+=hA[t],e),"")}function pA(r){const e=[];for(const t of r){const i=lA[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const gA=Wf({prefix:"🚀",name:"base256emoji",encode:dA,decode:pA}),bA=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:gA},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const J1={...NE,...$E,...qE,...FE,...kE,...ZE,...rA,...sA,...fA,...bA};function i3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const W1=i3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Cl=i3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=e3(r.length);for(let t=0;tJSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),mA=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function ma(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return mA(r)}catch{return r}}function ys(r){return typeof r=="string"?r:vA(r)||""}function Y1(r){return ma(Yf(yo(r,Jf),Xv))}function mf(r){return Yf(yo(ys(r),Xv),Jf)}function s3(r){const e=yo(mE,G1),t=vE+Yf(wE([e,r]),G1);return[gE,bE,t].join(pE)}function yA(r){return Yf(r,Jf)}function wA(r){return yo(r,Jf)}function _A(r){return yo([mf(r.header),mf(r.payload)].join(vf),Zv)}function DA(r){return[mf(r.header),mf(r.payload),yA(r.signature)].join(vf)}function md(r){const e=r.split(vf),t=Y1(e[0]),i=Y1(e[1]),n=wA(e[2]),a=yo(e.slice(0,2).join(vf),Zv);return{header:t,payload:i,signature:n,data:a}}function Q1(r=ks.randomBytes(yE)){return e0.generateKeyPairFromSeed(r)}async function EA(r,e,t,i,n=Ae.fromMiliseconds(Date.now())){const a={alg:lE,typ:dE},c=s3(i.publicKey),f=n+t,g={iss:c,sub:r,aud:e,iat:n,exp:f},d=_A({header:a,payload:g}),m=e0.sign(i.secretKey,d);return DA({header:a,payload:g,signature:m})}const AA={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var ga={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},xA={};const SA=":";function fc(r){const[e,t]=r.split(SA);return{namespace:e,reference:t}}function X1(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function a3(r,e){return r.includes(":")?[r]:e.chains||[]}var MA=Object.defineProperty,Z1=Object.getOwnPropertySymbols,IA=Object.prototype.hasOwnProperty,CA=Object.prototype.propertyIsEnumerable,eg=(r,e,t)=>e in r?MA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tg=(r,e)=>{for(var t in e||(e={}))IA.call(e,t)&&eg(r,t,e[t]);if(Z1)for(var t of Z1(e))CA.call(e,t)&&eg(r,t,e[t]);return r};const PA="ReactNative",_i={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},OA="js";function yf(){return typeof ga<"u"&&typeof ga.versions<"u"&&typeof ga.versions.node<"u"}function wo(){return!Tf()&&!!jd()&&navigator.product===PA}function Oc(){return!yf()&&!!jd()&&!!Tf()}function Tc(){return wo()?_i.reactNative:yf()?_i.node:Oc()?_i.browser:_i.unknown}function TA(){var r;try{return wo()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(r=globalThis.Application)==null?void 0:r.applicationId:void 0}catch{return}}function RA(r,e){let t=vc.parse(r);return t=tg(tg({},t),e),r=vc.stringify(t),r}function o3(){return sv()||{name:"",description:"",url:"",icons:[""]}}function NA(){if(Tc()===_i.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:t,Version:i}=globalThis.Platform;return[t,i].join("-")}const r=w4();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function BA(){var r;const e=Tc();return e===_i.browser?[e,((r=nv())==null?void 0:r.host)||"unknown"].join(":"):e}function c3(r,e,t){const i=NA(),n=BA();return[[r,e].join("-"),[OA,t].join("-"),i,n].join("/")}function $A({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:a,useOnCloseEvent:c,bundleId:f}){const g=t.split("?"),d=c3(r,e,i),m={auth:n,ua:d,projectId:a,useOnCloseEvent:c||void 0,origin:f||void 0},w=RA(g[1]||"",m);return g[0]+"?"+w}function la(r,e){return r.filter(t=>e.includes(t)).length===r.length}function u3(r){return Object.fromEntries(r.entries())}function f3(r){return new Map(Object.entries(r))}function fa(r=Ae.FIVE_MINUTES,e){const t=Ae.toMiliseconds(r||Ae.FIVE_MINUTES);let i,n,a;return{resolve:c=>{a&&i&&(clearTimeout(a),i(c))},reject:c=>{a&&n&&(clearTimeout(a),n(c))},done:()=>new Promise((c,f)=>{a=setTimeout(()=>{f(new Error(e))},t),i=c,n=f})}}function ro(r,e,t){return new Promise(async(i,n)=>{const a=setTimeout(()=>n(new Error(t)),e);try{const c=await r;i(c)}catch(c){n(c)}clearTimeout(a)})}function h3(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function UA(r){return h3("topic",r)}function qA(r){return h3("id",r)}function l3(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function br(r,e){return Ae.fromMiliseconds(Date.now()+Ae.toMiliseconds(r))}function Rs(r){return Date.now()>=Ae.toMiliseconds(r)}function xt(r,e){return`${r}${e?`:${e}`:""}`}function rf(r=[],e=[]){return[...new Set([...r,...e])]}async function LA({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,a=n==null?void 0:n.href;if(typeof a!="string")return;const c=FA(a,r,e),f=Tc();if(f===_i.browser){if(!((i=Tf())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}c.startsWith("https://")||c.startsWith("http://")?window.open(c,"_blank","noreferrer noopener"):window.open(c,jA()?"_blank":"_self","noreferrer noopener")}else f===_i.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(c)}catch(n){console.error(n)}}function FA(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const a=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${a}${kA(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function zA(r,e){let t="";try{if(Oc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function rg(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function ig(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function r0(){return typeof ga<"u"&&xA.IS_VITEST==="true"}function jA(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function kA(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function d3(r){return Buffer.from(r,"base64").toString("utf-8")}var p3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function HA(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var g3={exports:{}};/** +***************************************************************************** */var od=function(r,e){return od=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},od(r,e)};function D4(r,e){od(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var cd=function(){return cd=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;f--)(c=r[f])&&(a=(n<3?c(a):n>3?c(e,t,a):c(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a}function x4(r,e){return function(t,i){e(t,i,r)}}function S4(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function M4(r,e,t,i){function n(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{d(i.next(m))}catch(w){c(w)}}function g(m){try{d(i.throw(m))}catch(w){c(w)}}function d(m){m.done?a(m.value):n(m.value).then(f,g)}d((i=i.apply(r,e||[])).next())})}function I4(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(d){return function(m){return g([d,m])}}function g(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(a=d[0]&2?n.return:d[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,d[1])).done)return a;switch(n=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,n=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function iv(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,a=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(f){c={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return a}function O4(){for(var r=[],e=0;e1||f(O,I)})})}function f(O,I){try{g(i[O](I))}catch(P){w(a[0][3],P)}}function g(O){O.value instanceof vc?Promise.resolve(O.value.v).then(d,m):w(a[0][2],O)}function d(O){f("next",O)}function m(O){f("throw",O)}function w(O,I){O(I),a.shift(),a.length&&f(a[0][0],a[0][1])}}function N4(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,a){e[n]=r[n]?function(c){return(t=!t)?{value:vc(r[n](c)),done:n==="return"}:a?a(c):c}:a}}function B4(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ud=="function"?ud(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(c){return new Promise(function(f,g){c=r[a](c),n(f,g,c.done,c.value)})}}function n(a,c,f,g){Promise.resolve(g).then(function(d){a({value:d,done:f})},c)}}function $4(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function U4(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function q4(r){return r&&r.__esModule?r:{default:r}}function L4(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function F4(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const z4=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return cd},__asyncDelegator:N4,__asyncGenerator:R4,__asyncValues:B4,__await:vc,__awaiter:M4,__classPrivateFieldGet:L4,__classPrivateFieldSet:F4,__createBinding:C4,__decorate:A4,__exportStar:P4,__extends:D4,__generator:I4,__importDefault:q4,__importStar:U4,__makeTemplateObject:$4,__metadata:S4,__param:x4,__read:iv,__rest:E4,__spread:O4,__spreadArrays:T4,__values:ud},Symbol.toStringTag,{value:"Module"})),Tf=tv(z4);var bl={},Jo={},_1;function j4(){if(_1)return Jo;_1=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Jo.delay=r,Jo}var sa={},vl={},aa={},D1;function k4(){return D1||(D1=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.ONE_THOUSAND=aa.ONE_HUNDRED=void 0,aa.ONE_HUNDRED=100,aa.ONE_THOUSAND=1e3),aa}var ml={},E1;function H4(){return E1||(E1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(ml)),ml}var A1;function nv(){return A1||(A1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Tf;e.__exportStar(k4(),r),e.__exportStar(H4(),r)}(vl)),vl}var x1;function K4(){if(x1)return sa;x1=1,Object.defineProperty(sa,"__esModule",{value:!0}),sa.fromMiliseconds=sa.toMiliseconds=void 0;const r=nv();function e(i){return i*r.ONE_THOUSAND}sa.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return sa.fromMiliseconds=t,sa}var S1;function V4(){return S1||(S1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Tf;e.__exportStar(j4(),r),e.__exportStar(K4(),r)}(bl)),bl}var Ja={},M1;function G4(){if(M1)return Ja;M1=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return Ja.Watch=r,Ja.default=r,Ja}var yl={},Wo={},I1;function J4(){if(I1)return Wo;I1=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.IWatch=void 0;class r{}return Wo.IWatch=r,Wo}var C1;function W4(){return C1||(C1=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Tf.__exportStar(J4(),r)}(yl)),yl}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Tf;e.__exportStar(V4(),r),e.__exportStar(G4(),r),e.__exportStar(W4(),r),e.__exportStar(nv(),r)})(Ae);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.getLocalStorage=Vt.getLocalStorageOrThrow=Vt.getCrypto=Vt.getCryptoOrThrow=sv=Vt.getLocation=Vt.getLocationOrThrow=kd=Vt.getNavigator=Vt.getNavigatorOrThrow=Rf=Vt.getDocument=Vt.getDocumentOrThrow=Vt.getFromWindowOrThrow=Vt.getFromWindow=void 0;function Da(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Vt.getFromWindow=Da;function lo(r){const e=Da(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Vt.getFromWindowOrThrow=lo;function Y4(){return lo("document")}Vt.getDocumentOrThrow=Y4;function Q4(){return Da("document")}var Rf=Vt.getDocument=Q4;function X4(){return lo("navigator")}Vt.getNavigatorOrThrow=X4;function Z4(){return Da("navigator")}var kd=Vt.getNavigator=Z4;function e_(){return lo("location")}Vt.getLocationOrThrow=e_;function t_(){return Da("location")}var sv=Vt.getLocation=t_;function r_(){return lo("crypto")}Vt.getCryptoOrThrow=r_;function i_(){return Da("crypto")}Vt.getCrypto=i_;function n_(){return lo("localStorage")}Vt.getLocalStorageOrThrow=n_;function s_(){return Da("localStorage")}Vt.getLocalStorage=s_;var Hd={};Object.defineProperty(Hd,"__esModule",{value:!0});var av=Hd.getWindowMetadata=void 0;const P1=Vt;function a_(){let r,e;try{r=P1.getDocumentOrThrow(),e=P1.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),O=[];for(let I=0;I-1){const K=P.getAttribute("href");if(K)if(K.toLowerCase().indexOf("https:")===-1&&K.toLowerCase().indexOf("http:")===-1&&K.indexOf("//")!==0){let Y=e.protocol+"//"+e.host;if(K.indexOf("/")===0)Y+=K;else{const z=e.pathname.split("/");z.pop();const W=z.join("/");Y+=W+"/"+K}O.push(Y)}else if(K.indexOf("//")===0){const Y=e.protocol+K;O.push(Y)}else O.push(K)}}return O}function i(...w){const O=r.getElementsByTagName("meta");for(let I=0;IP.getAttribute(K)).filter(K=>K?w.includes(K):!1);if(q.length&&q){const K=P.getAttribute("content");if(K)return K}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function a(){return i("description","og:description","twitter:description","keywords")}const c=n(),f=a(),g=e.origin,d=t();return{description:f,url:g,icons:d,name:c}}av=Hd.getWindowMetadata=a_;var mc={},o_=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),ov="%[a-f0-9]{2}",O1=new RegExp("("+ov+")|([^%]+?)","gi"),T1=new RegExp("("+ov+")+","gi");function fd(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],fd(t),fd(i))}function c_(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(O1)||[],t=1;t{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},l_=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),a=0;az==null,c=Symbol("encodeFragmentIdentifier");function f(z){switch(z.arrayFormat){case"index":return W=>(B,j)=>{const k=B.length;return j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),"[",k,"]"].join("")]:[...B,[m(W,z),"[",m(k,z),"]=",m(j,z)].join("")]};case"bracket":return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),"[]"].join("")]:[...B,[m(W,z),"[]=",m(j,z)].join("")];case"colon-list-separator":return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,[m(W,z),":list="].join("")]:[...B,[m(W,z),":list=",m(j,z)].join("")];case"comma":case"separator":case"bracket-separator":{const W=z.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(j,k)=>k===void 0||z.skipNull&&k===null||z.skipEmptyString&&k===""?j:(k=k===null?"":k,j.length===0?[[m(B,z),W,m(k,z)].join("")]:[[j,m(k,z)].join(z.arrayFormatSeparator)])}default:return W=>(B,j)=>j===void 0||z.skipNull&&j===null||z.skipEmptyString&&j===""?B:j===null?[...B,m(W,z)]:[...B,[m(W,z),"=",m(j,z)].join("")]}}function g(z){let W;switch(z.arrayFormat){case"index":return(B,j,k)=>{if(W=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!W){k[B]=j;return}k[B]===void 0&&(k[B]={}),k[B][W[1]]=j};case"bracket":return(B,j,k)=>{if(W=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!W){k[B]=j;return}if(k[B]===void 0){k[B]=[j];return}k[B]=[].concat(k[B],j)};case"colon-list-separator":return(B,j,k)=>{if(W=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!W){k[B]=j;return}if(k[B]===void 0){k[B]=[j];return}k[B]=[].concat(k[B],j)};case"comma":case"separator":return(B,j,k)=>{const _=typeof j=="string"&&j.includes(z.arrayFormatSeparator),N=typeof j=="string"&&!_&&w(j,z).includes(z.arrayFormatSeparator);j=N?w(j,z):j;const se=_||N?j.split(z.arrayFormatSeparator).map(le=>w(le,z)):j===null?j:w(j,z);k[B]=se};case"bracket-separator":return(B,j,k)=>{const _=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!_){k[B]=j&&w(j,z);return}const N=j===null?[]:j.split(z.arrayFormatSeparator).map(se=>w(se,z));if(k[B]===void 0){k[B]=N;return}k[B]=[].concat(k[B],N)};default:return(B,j,k)=>{if(k[B]===void 0){k[B]=j;return}k[B]=[].concat(k[B],j)}}}function d(z){if(typeof z!="string"||z.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(z,W){return W.encode?W.strict?e(z):encodeURIComponent(z):z}function w(z,W){return W.decode?t(z):z}function O(z){return Array.isArray(z)?z.sort():typeof z=="object"?O(Object.keys(z)).sort((W,B)=>Number(W)-Number(B)).map(W=>z[W]):z}function I(z){const W=z.indexOf("#");return W!==-1&&(z=z.slice(0,W)),z}function P(z){let W="";const B=z.indexOf("#");return B!==-1&&(W=z.slice(B)),W}function q(z){z=I(z);const W=z.indexOf("?");return W===-1?"":z.slice(W+1)}function K(z,W){return W.parseNumbers&&!Number.isNaN(Number(z))&&typeof z=="string"&&z.trim()!==""?z=Number(z):W.parseBooleans&&z!==null&&(z.toLowerCase()==="true"||z.toLowerCase()==="false")&&(z=z.toLowerCase()==="true"),z}function Y(z,W){W=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},W),d(W.arrayFormatSeparator);const B=g(W),j=Object.create(null);if(typeof z!="string"||(z=z.trim().replace(/^[?#&]/,""),!z))return j;for(const k of z.split("&")){if(k==="")continue;let[_,N]=i(W.decode?k.replace(/\+/g," "):k,"=");N=N===void 0?null:["comma","separator","bracket-separator"].includes(W.arrayFormat)?N:w(N,W),B(w(_,W),N,j)}for(const k of Object.keys(j)){const _=j[k];if(typeof _=="object"&&_!==null)for(const N of Object.keys(_))_[N]=K(_[N],W);else j[k]=K(_,W)}return W.sort===!1?j:(W.sort===!0?Object.keys(j).sort():Object.keys(j).sort(W.sort)).reduce((k,_)=>{const N=j[_];return N&&typeof N=="object"&&!Array.isArray(N)?k[_]=O(N):k[_]=N,k},Object.create(null))}r.extract=q,r.parse=Y,r.stringify=(z,W)=>{if(!z)return"";W=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},W),d(W.arrayFormatSeparator);const B=N=>W.skipNull&&a(z[N])||W.skipEmptyString&&z[N]==="",j=f(W),k={};for(const N of Object.keys(z))B(N)||(k[N]=z[N]);const _=Object.keys(k);return W.sort!==!1&&_.sort(W.sort),_.map(N=>{const se=z[N];return se===void 0?"":se===null?m(N,W):Array.isArray(se)?se.length===0&&W.arrayFormat==="bracket-separator"?m(N,W)+"[]":se.reduce(j(N),[]).join("&"):m(N,W)+"="+m(se,W)}).filter(N=>N.length>0).join("&")},r.parseUrl=(z,W)=>{W=Object.assign({decode:!0},W);const[B,j]=i(z,"#");return Object.assign({url:B.split("?")[0]||"",query:Y(q(z),W)},W&&W.parseFragmentIdentifier&&j?{fragmentIdentifier:w(j,W)}:{})},r.stringifyUrl=(z,W)=>{W=Object.assign({encode:!0,strict:!0,[c]:!0},W);const B=I(z.url).split("?")[0]||"",j=r.extract(z.url),k=r.parse(j,{sort:!1}),_=Object.assign(k,z.query);let N=r.stringify(_,W);N&&(N=`?${N}`);let se=P(z.url);return z.fragmentIdentifier&&(se=`#${W[c]?m(z.fragmentIdentifier,W):z.fragmentIdentifier}`),`${B}${N}${se}`},r.pick=(z,W,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[c]:!1},B);const{url:j,query:k,fragmentIdentifier:_}=r.parseUrl(z,B);return r.stringifyUrl({url:j,query:n(k,W),fragmentIdentifier:_},B)},r.exclude=(z,W,B)=>{const j=Array.isArray(W)?k=>!W.includes(k):(k,_)=>!W(k,_);return r.pick(z,j,B)}})(mc);var Kd={},Nf={},mt={},cv={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,g){var d=f>>>16&65535,m=f&65535,w=g>>>16&65535,O=g&65535;return m*O+(d*O+m*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,g){return f+g|0}r.add=t;function i(f,g){return f-g|0}r.sub=i;function n(f,g){return f<>>32-g}r.rotl=n;function a(f,g){return f<<32-g|f>>>g}r.rotr=a;function c(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})(cv);Object.defineProperty(mt,"__esModule",{value:!0});var uv=cv;function d_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}mt.readInt16BE=d_;function p_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}mt.readUint16BE=p_;function g_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}mt.readInt16LE=g_;function b_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}mt.readUint16LE=b_;function fv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}mt.writeUint16BE=fv;mt.writeInt16BE=fv;function hv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}mt.writeUint16LE=hv;mt.writeInt16LE=hv;function hd(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}mt.readInt32BE=hd;function ld(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}mt.readUint32BE=ld;function dd(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}mt.readInt32LE=dd;function pd(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}mt.readUint32LE=pd;function df(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}mt.writeUint32BE=df;mt.writeInt32BE=df;function pf(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}mt.writeUint32LE=pf;mt.writeInt32LE=pf;function v_(r,e){e===void 0&&(e=0);var t=hd(r,e),i=hd(r,e+4);return t*4294967296+i-(i>>31)*4294967296}mt.readInt64BE=v_;function m_(r,e){e===void 0&&(e=0);var t=ld(r,e),i=ld(r,e+4);return t*4294967296+i}mt.readUint64BE=m_;function y_(r,e){e===void 0&&(e=0);var t=dd(r,e),i=dd(r,e+4);return i*4294967296+t-(t>>31)*4294967296}mt.readInt64LE=y_;function w_(r,e){e===void 0&&(e=0);var t=pd(r,e),i=pd(r,e+4);return i*4294967296+t}mt.readUint64LE=w_;function lv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),df(r/4294967296>>>0,e,t),df(r>>>0,e,t+4),e}mt.writeUint64BE=lv;mt.writeInt64BE=lv;function dv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),pf(r>>>0,e,t),pf(r/4294967296>>>0,e,t+4),e}mt.writeUint64LE=dv;mt.writeInt64LE=dv;function __(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,a=r/8+t-1;a>=t;a--)i+=e[a]*n,n*=256;return i}mt.readUintBE=__;function D_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,a=t;a=i;a--)t[a]=e/n&255,n*=256;return t}mt.writeUintBE=E_;function A_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!uv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,a=i;a>>16|v<<16,U=U+v|0,_^=U,_=_>>>20|_<<12,B=B+N|0,E^=B,E=E>>>16|E<<16,y=y+E|0,N^=y,N=N>>>20|N<<12,j=j+se|0,S^=j,S=S>>>16|S<<16,u=u+S|0,se^=u,se=se>>>20|se<<12,k=k+le|0,M^=k,M=M>>>16|M<<16,h=h+M|0,le^=h,le=le>>>20|le<<12,j=j+se|0,S^=j,S=S>>>24|S<<8,u=u+S|0,se^=u,se=se>>>25|se<<7,k=k+le|0,M^=k,M=M>>>24|M<<8,h=h+M|0,le^=h,le=le>>>25|le<<7,B=B+N|0,E^=B,E=E>>>24|E<<8,y=y+E|0,N^=y,N=N>>>25|N<<7,W=W+_|0,v^=W,v=v>>>24|v<<8,U=U+v|0,_^=U,_=_>>>25|_<<7,W=W+N|0,M^=W,M=M>>>16|M<<16,u=u+M|0,N^=u,N=N>>>20|N<<12,B=B+se|0,v^=B,v=v>>>16|v<<16,h=h+v|0,se^=h,se=se>>>20|se<<12,j=j+le|0,E^=j,E=E>>>16|E<<16,U=U+E|0,le^=U,le=le>>>20|le<<12,k=k+_|0,S^=k,S=S>>>16|S<<16,y=y+S|0,_^=y,_=_>>>20|_<<12,j=j+le|0,E^=j,E=E>>>24|E<<8,U=U+E|0,le^=U,le=le>>>25|le<<7,k=k+_|0,S^=k,S=S>>>24|S<<8,y=y+S|0,_^=y,_=_>>>25|_<<7,B=B+se|0,v^=B,v=v>>>24|v<<8,h=h+v|0,se^=h,se=se>>>25|se<<7,W=W+N|0,M^=W,M=M>>>24|M<<8,u=u+M|0,N^=u,N=N>>>25|N<<7;Fr.writeUint32LE(W+i|0,r,0),Fr.writeUint32LE(B+n|0,r,4),Fr.writeUint32LE(j+a|0,r,8),Fr.writeUint32LE(k+c|0,r,12),Fr.writeUint32LE(_+f|0,r,16),Fr.writeUint32LE(N+g|0,r,20),Fr.writeUint32LE(se+d|0,r,24),Fr.writeUint32LE(le+m|0,r,28),Fr.writeUint32LE(U+w|0,r,32),Fr.writeUint32LE(y+O|0,r,36),Fr.writeUint32LE(u+I|0,r,40),Fr.writeUint32LE(h+P|0,r,44),Fr.writeUint32LE(v+q|0,r,48),Fr.writeUint32LE(E+K|0,r,52),Fr.writeUint32LE(S+Y|0,r,56),Fr.writeUint32LE(M+z|0,r,60)}function pv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var gv={},js={};Object.defineProperty(js,"__esModule",{value:!0});function q_(r,e,t){return~(r-1)&e|r-1&t}js.select=q_;function L_(r,e){return(r|0)-(e|0)-1>>>31&1}js.lessOrEqual=L_;function bv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}js.compare=bv;function F_(r,e){return r.length===0||e.length===0?!1:bv(r,e)!==0}js.equal=F_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=js,t=xi;r.DIGEST_LENGTH=16;var i=function(){function c(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var g=f[0]|f[1]<<8;this._r[0]=g&8191;var d=f[2]|f[3]<<8;this._r[1]=(g>>>13|d<<3)&8191;var m=f[4]|f[5]<<8;this._r[2]=(d>>>10|m<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(m>>>7|w<<9)&8191;var O=f[8]|f[9]<<8;this._r[4]=(w>>>4|O<<12)&255,this._r[5]=O>>>1&8190;var I=f[10]|f[11]<<8;this._r[6]=(O>>>14|I<<2)&8191;var P=f[12]|f[13]<<8;this._r[7]=(I>>>11|P<<5)&8065;var q=f[14]|f[15]<<8;this._r[8]=(P>>>8|q<<8)&8191,this._r[9]=q>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return c.prototype._blocks=function(f,g,d){for(var m=this._fin?0:2048,w=this._h[0],O=this._h[1],I=this._h[2],P=this._h[3],q=this._h[4],K=this._h[5],Y=this._h[6],z=this._h[7],W=this._h[8],B=this._h[9],j=this._r[0],k=this._r[1],_=this._r[2],N=this._r[3],se=this._r[4],le=this._r[5],U=this._r[6],y=this._r[7],u=this._r[8],h=this._r[9];d>=16;){var v=f[g+0]|f[g+1]<<8;w+=v&8191;var E=f[g+2]|f[g+3]<<8;O+=(v>>>13|E<<3)&8191;var S=f[g+4]|f[g+5]<<8;I+=(E>>>10|S<<6)&8191;var M=f[g+6]|f[g+7]<<8;P+=(S>>>7|M<<9)&8191;var x=f[g+8]|f[g+9]<<8;q+=(M>>>4|x<<12)&8191,K+=x>>>1&8191;var p=f[g+10]|f[g+11]<<8;Y+=(x>>>14|p<<2)&8191;var b=f[g+12]|f[g+13]<<8;z+=(p>>>11|b<<5)&8191;var R=f[g+14]|f[g+15]<<8;W+=(b>>>8|R<<8)&8191,B+=R>>>5|m;var Z=0,ae=Z;ae+=w*j,ae+=O*(5*h),ae+=I*(5*u),ae+=P*(5*y),ae+=q*(5*U),Z=ae>>>13,ae&=8191,ae+=K*(5*le),ae+=Y*(5*se),ae+=z*(5*N),ae+=W*(5*_),ae+=B*(5*k),Z+=ae>>>13,ae&=8191;var C=Z;C+=w*k,C+=O*j,C+=I*(5*h),C+=P*(5*u),C+=q*(5*y),Z=C>>>13,C&=8191,C+=K*(5*U),C+=Y*(5*le),C+=z*(5*se),C+=W*(5*N),C+=B*(5*_),Z+=C>>>13,C&=8191;var ee=Z;ee+=w*_,ee+=O*k,ee+=I*j,ee+=P*(5*h),ee+=q*(5*u),Z=ee>>>13,ee&=8191,ee+=K*(5*y),ee+=Y*(5*U),ee+=z*(5*le),ee+=W*(5*se),ee+=B*(5*N),Z+=ee>>>13,ee&=8191;var L=Z;L+=w*N,L+=O*_,L+=I*k,L+=P*j,L+=q*(5*h),Z=L>>>13,L&=8191,L+=K*(5*u),L+=Y*(5*y),L+=z*(5*U),L+=W*(5*le),L+=B*(5*se),Z+=L>>>13,L&=8191;var V=Z;V+=w*se,V+=O*N,V+=I*_,V+=P*k,V+=q*j,Z=V>>>13,V&=8191,V+=K*(5*h),V+=Y*(5*u),V+=z*(5*y),V+=W*(5*U),V+=B*(5*le),Z+=V>>>13,V&=8191;var G=Z;G+=w*le,G+=O*se,G+=I*N,G+=P*_,G+=q*k,Z=G>>>13,G&=8191,G+=K*j,G+=Y*(5*h),G+=z*(5*u),G+=W*(5*y),G+=B*(5*U),Z+=G>>>13,G&=8191;var D=Z;D+=w*U,D+=O*le,D+=I*se,D+=P*N,D+=q*_,Z=D>>>13,D&=8191,D+=K*k,D+=Y*j,D+=z*(5*h),D+=W*(5*u),D+=B*(5*y),Z+=D>>>13,D&=8191;var H=Z;H+=w*y,H+=O*U,H+=I*le,H+=P*se,H+=q*N,Z=H>>>13,H&=8191,H+=K*_,H+=Y*k,H+=z*j,H+=W*(5*h),H+=B*(5*u),Z+=H>>>13,H&=8191;var ne=Z;ne+=w*u,ne+=O*y,ne+=I*U,ne+=P*le,ne+=q*se,Z=ne>>>13,ne&=8191,ne+=K*N,ne+=Y*_,ne+=z*k,ne+=W*j,ne+=B*(5*h),Z+=ne>>>13,ne&=8191;var ce=Z;ce+=w*h,ce+=O*u,ce+=I*y,ce+=P*U,ce+=q*le,Z=ce>>>13,ce&=8191,ce+=K*se,ce+=Y*N,ce+=z*_,ce+=W*k,ce+=B*j,Z+=ce>>>13,ce&=8191,Z=(Z<<2)+Z|0,Z=Z+ae|0,ae=Z&8191,Z=Z>>>13,C+=Z,w=ae,O=C,I=ee,P=L,q=V,K=G,Y=D,z=H,W=ne,B=ce,g+=16,d-=16}this._h[0]=w,this._h[1]=O,this._h[2]=I,this._h[3]=P,this._h[4]=q,this._h[5]=K,this._h[6]=Y,this._h[7]=z,this._h[8]=W,this._h[9]=B},c.prototype.finish=function(f,g){g===void 0&&(g=0);var d=new Uint16Array(10),m,w,O,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=m,m=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,d[0]=this._h[0]+5,m=d[0]>>>13,d[0]&=8191,I=1;I<10;I++)d[I]=this._h[I]+m,m=d[I]>>>13,d[I]&=8191;for(d[9]-=8192,w=(m^1)-1,I=0;I<10;I++)d[I]&=w;for(w=~w,I=0;I<10;I++)this._h[I]=this._h[I]&w|d[I];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,O=this._h[0]+this._pad[0],this._h[0]=O&65535,I=1;I<8;I++)O=(this._h[I]+this._pad[I]|0)+(O>>>16)|0,this._h[I]=O&65535;return f[g+0]=this._h[0]>>>0,f[g+1]=this._h[0]>>>8,f[g+2]=this._h[1]>>>0,f[g+3]=this._h[1]>>>8,f[g+4]=this._h[2]>>>0,f[g+5]=this._h[2]>>>8,f[g+6]=this._h[3]>>>0,f[g+7]=this._h[3]>>>8,f[g+8]=this._h[4]>>>0,f[g+9]=this._h[4]>>>8,f[g+10]=this._h[5]>>>0,f[g+11]=this._h[5]>>>8,f[g+12]=this._h[6]>>>0,f[g+13]=this._h[6]>>>8,f[g+14]=this._h[7]>>>0,f[g+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(f){var g=0,d=f.length,m;if(this._leftover){m=16-this._leftover,m>d&&(m=d);for(var w=0;w=16&&(m=d-d%16,this._blocks(f,g,m),g+=m,d-=m),d){for(var w=0;w16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(d,I.length-d.length);var P=new Uint8Array(32);e.stream(this._key,I,P,4);var q=m.length+this.tagLength,K;if(O){if(O.length!==q)throw new Error("ChaCha20Poly1305: incorrect destination length");K=O}else K=new Uint8Array(q);return e.streamXOR(this._key,I,m,K,4),this._authenticate(K.subarray(K.length-this.tagLength,K.length),P,K.subarray(0,K.length-this.tagLength),w),i.wipe(I),K},g.prototype.open=function(d,m,w,O){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length0&&I.update(c.subarray(O.length%16))),I.update(w),w.length%16>0&&I.update(c.subarray(w.length%16));var P=new Uint8Array(8);O&&n.writeUint64LE(O.length,P),I.update(P),n.writeUint64LE(w.length,P),I.update(P);for(var q=I.digest(),K=0;Kthis.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i256)throw new Error("randomString charset is too long");let O="";const I=m.length,P=256-256%I;for(;d>0;){const q=n(Math.ceil(d*256/P),w);for(let K=0;K0;K++){const Y=q[K];Y0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=g[m++],d--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(m=a(this._temp,this._state,g,m,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=g[m++],d--;return this},f.prototype.finish=function(g){if(!this._finished){var d=this._bytesHashed,m=this._bufferLength,w=d/536870912|0,O=d<<3,I=d%64<56?64:128;this._buffer[m]=128;for(var P=m+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(g){return this._state.set(g.state),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(g){t.wipe(g.state),g.buffer&&t.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},f}();r.SHA256=i;var n=new Int32Array([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]);function a(f,g,d,m,w){for(;w>=64;){for(var O=g[0],I=g[1],P=g[2],q=g[3],K=g[4],Y=g[5],z=g[6],W=g[7],B=0;B<16;B++){var j=m+B*4;f[B]=e.readUint32BE(d,j)}for(var B=16;B<64;B++){var k=f[B-2],_=(k>>>17|k<<15)^(k>>>19|k<<13)^k>>>10;k=f[B-15];var N=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3;f[B]=(_+f[B-7]|0)+(N+f[B-16]|0)}for(var B=0;B<64;B++){var _=(((K>>>6|K<<26)^(K>>>11|K<<21)^(K>>>25|K<<7))+(K&Y^~K&z)|0)+(W+(n[B]+f[B]|0)|0)|0,N=((O>>>2|O<<30)^(O>>>13|O<<19)^(O>>>22|O<<10))+(O&I^O&P^I&P)|0;W=z,z=Y,Y=K,K=q+_|0,q=P,P=I,I=O,O=_+N|0}g[0]+=O,g[1]+=I,g[2]+=P,g[3]+=q,g[4]+=K,g[5]+=Y,g[6]+=z,g[7]+=W,m+=64,w-=64}return m}function c(f){var g=new i;g.update(f);var d=g.digest();return g.clean(),d}r.hash=c})(Mc);var Gd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=ks,t=xi;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const j=new Float64Array(16);if(B)for(let k=0;k>16&1),k[le-1]&=65535;k[15]=_[15]-32767-(k[14]>>16&1);const se=k[15]>>16&1;k[14]&=65535,f(_,k,1-se)}for(let N=0;N<16;N++)B[2*N]=_[N]&255,B[2*N+1]=_[N]>>8}function d(B,j){for(let k=0;k<16;k++)B[k]=j[2*k]+(j[2*k+1]<<8);B[15]&=32767}function m(B,j,k){for(let _=0;_<16;_++)B[_]=j[_]+k[_]}function w(B,j,k){for(let _=0;_<16;_++)B[_]=j[_]-k[_]}function O(B,j,k){let _,N,se=0,le=0,U=0,y=0,u=0,h=0,v=0,E=0,S=0,M=0,x=0,p=0,b=0,R=0,Z=0,ae=0,C=0,ee=0,L=0,V=0,G=0,D=0,H=0,ne=0,ce=0,fe=0,ye=0,we=0,Te=0,Qe=0,Ce=0,Re=k[0],Se=k[1],me=k[2],Pe=k[3],Ne=k[4],be=k[5],Oe=k[6],xe=k[7],ve=k[8],qe=k[9],Me=k[10],_e=k[11],He=k[12],Ve=k[13],Ee=k[14],Ke=k[15];_=j[0],se+=_*Re,le+=_*Se,U+=_*me,y+=_*Pe,u+=_*Ne,h+=_*be,v+=_*Oe,E+=_*xe,S+=_*ve,M+=_*qe,x+=_*Me,p+=_*_e,b+=_*He,R+=_*Ve,Z+=_*Ee,ae+=_*Ke,_=j[1],le+=_*Re,U+=_*Se,y+=_*me,u+=_*Pe,h+=_*Ne,v+=_*be,E+=_*Oe,S+=_*xe,M+=_*ve,x+=_*qe,p+=_*Me,b+=_*_e,R+=_*He,Z+=_*Ve,ae+=_*Ee,C+=_*Ke,_=j[2],U+=_*Re,y+=_*Se,u+=_*me,h+=_*Pe,v+=_*Ne,E+=_*be,S+=_*Oe,M+=_*xe,x+=_*ve,p+=_*qe,b+=_*Me,R+=_*_e,Z+=_*He,ae+=_*Ve,C+=_*Ee,ee+=_*Ke,_=j[3],y+=_*Re,u+=_*Se,h+=_*me,v+=_*Pe,E+=_*Ne,S+=_*be,M+=_*Oe,x+=_*xe,p+=_*ve,b+=_*qe,R+=_*Me,Z+=_*_e,ae+=_*He,C+=_*Ve,ee+=_*Ee,L+=_*Ke,_=j[4],u+=_*Re,h+=_*Se,v+=_*me,E+=_*Pe,S+=_*Ne,M+=_*be,x+=_*Oe,p+=_*xe,b+=_*ve,R+=_*qe,Z+=_*Me,ae+=_*_e,C+=_*He,ee+=_*Ve,L+=_*Ee,V+=_*Ke,_=j[5],h+=_*Re,v+=_*Se,E+=_*me,S+=_*Pe,M+=_*Ne,x+=_*be,p+=_*Oe,b+=_*xe,R+=_*ve,Z+=_*qe,ae+=_*Me,C+=_*_e,ee+=_*He,L+=_*Ve,V+=_*Ee,G+=_*Ke,_=j[6],v+=_*Re,E+=_*Se,S+=_*me,M+=_*Pe,x+=_*Ne,p+=_*be,b+=_*Oe,R+=_*xe,Z+=_*ve,ae+=_*qe,C+=_*Me,ee+=_*_e,L+=_*He,V+=_*Ve,G+=_*Ee,D+=_*Ke,_=j[7],E+=_*Re,S+=_*Se,M+=_*me,x+=_*Pe,p+=_*Ne,b+=_*be,R+=_*Oe,Z+=_*xe,ae+=_*ve,C+=_*qe,ee+=_*Me,L+=_*_e,V+=_*He,G+=_*Ve,D+=_*Ee,H+=_*Ke,_=j[8],S+=_*Re,M+=_*Se,x+=_*me,p+=_*Pe,b+=_*Ne,R+=_*be,Z+=_*Oe,ae+=_*xe,C+=_*ve,ee+=_*qe,L+=_*Me,V+=_*_e,G+=_*He,D+=_*Ve,H+=_*Ee,ne+=_*Ke,_=j[9],M+=_*Re,x+=_*Se,p+=_*me,b+=_*Pe,R+=_*Ne,Z+=_*be,ae+=_*Oe,C+=_*xe,ee+=_*ve,L+=_*qe,V+=_*Me,G+=_*_e,D+=_*He,H+=_*Ve,ne+=_*Ee,ce+=_*Ke,_=j[10],x+=_*Re,p+=_*Se,b+=_*me,R+=_*Pe,Z+=_*Ne,ae+=_*be,C+=_*Oe,ee+=_*xe,L+=_*ve,V+=_*qe,G+=_*Me,D+=_*_e,H+=_*He,ne+=_*Ve,ce+=_*Ee,fe+=_*Ke,_=j[11],p+=_*Re,b+=_*Se,R+=_*me,Z+=_*Pe,ae+=_*Ne,C+=_*be,ee+=_*Oe,L+=_*xe,V+=_*ve,G+=_*qe,D+=_*Me,H+=_*_e,ne+=_*He,ce+=_*Ve,fe+=_*Ee,ye+=_*Ke,_=j[12],b+=_*Re,R+=_*Se,Z+=_*me,ae+=_*Pe,C+=_*Ne,ee+=_*be,L+=_*Oe,V+=_*xe,G+=_*ve,D+=_*qe,H+=_*Me,ne+=_*_e,ce+=_*He,fe+=_*Ve,ye+=_*Ee,we+=_*Ke,_=j[13],R+=_*Re,Z+=_*Se,ae+=_*me,C+=_*Pe,ee+=_*Ne,L+=_*be,V+=_*Oe,G+=_*xe,D+=_*ve,H+=_*qe,ne+=_*Me,ce+=_*_e,fe+=_*He,ye+=_*Ve,we+=_*Ee,Te+=_*Ke,_=j[14],Z+=_*Re,ae+=_*Se,C+=_*me,ee+=_*Pe,L+=_*Ne,V+=_*be,G+=_*Oe,D+=_*xe,H+=_*ve,ne+=_*qe,ce+=_*Me,fe+=_*_e,ye+=_*He,we+=_*Ve,Te+=_*Ee,Qe+=_*Ke,_=j[15],ae+=_*Re,C+=_*Se,ee+=_*me,L+=_*Pe,V+=_*Ne,G+=_*be,D+=_*Oe,H+=_*xe,ne+=_*ve,ce+=_*qe,fe+=_*Me,ye+=_*_e,we+=_*He,Te+=_*Ve,Qe+=_*Ee,Ce+=_*Ke,se+=38*C,le+=38*ee,U+=38*L,y+=38*V,u+=38*G,h+=38*D,v+=38*H,E+=38*ne,S+=38*ce,M+=38*fe,x+=38*ye,p+=38*we,b+=38*Te,R+=38*Qe,Z+=38*Ce,N=1,_=se+N+65535,N=Math.floor(_/65536),se=_-N*65536,_=le+N+65535,N=Math.floor(_/65536),le=_-N*65536,_=U+N+65535,N=Math.floor(_/65536),U=_-N*65536,_=y+N+65535,N=Math.floor(_/65536),y=_-N*65536,_=u+N+65535,N=Math.floor(_/65536),u=_-N*65536,_=h+N+65535,N=Math.floor(_/65536),h=_-N*65536,_=v+N+65535,N=Math.floor(_/65536),v=_-N*65536,_=E+N+65535,N=Math.floor(_/65536),E=_-N*65536,_=S+N+65535,N=Math.floor(_/65536),S=_-N*65536,_=M+N+65535,N=Math.floor(_/65536),M=_-N*65536,_=x+N+65535,N=Math.floor(_/65536),x=_-N*65536,_=p+N+65535,N=Math.floor(_/65536),p=_-N*65536,_=b+N+65535,N=Math.floor(_/65536),b=_-N*65536,_=R+N+65535,N=Math.floor(_/65536),R=_-N*65536,_=Z+N+65535,N=Math.floor(_/65536),Z=_-N*65536,_=ae+N+65535,N=Math.floor(_/65536),ae=_-N*65536,se+=N-1+37*(N-1),N=1,_=se+N+65535,N=Math.floor(_/65536),se=_-N*65536,_=le+N+65535,N=Math.floor(_/65536),le=_-N*65536,_=U+N+65535,N=Math.floor(_/65536),U=_-N*65536,_=y+N+65535,N=Math.floor(_/65536),y=_-N*65536,_=u+N+65535,N=Math.floor(_/65536),u=_-N*65536,_=h+N+65535,N=Math.floor(_/65536),h=_-N*65536,_=v+N+65535,N=Math.floor(_/65536),v=_-N*65536,_=E+N+65535,N=Math.floor(_/65536),E=_-N*65536,_=S+N+65535,N=Math.floor(_/65536),S=_-N*65536,_=M+N+65535,N=Math.floor(_/65536),M=_-N*65536,_=x+N+65535,N=Math.floor(_/65536),x=_-N*65536,_=p+N+65535,N=Math.floor(_/65536),p=_-N*65536,_=b+N+65535,N=Math.floor(_/65536),b=_-N*65536,_=R+N+65535,N=Math.floor(_/65536),R=_-N*65536,_=Z+N+65535,N=Math.floor(_/65536),Z=_-N*65536,_=ae+N+65535,N=Math.floor(_/65536),ae=_-N*65536,se+=N-1+37*(N-1),B[0]=se,B[1]=le,B[2]=U,B[3]=y,B[4]=u,B[5]=h,B[6]=v,B[7]=E,B[8]=S,B[9]=M,B[10]=x,B[11]=p,B[12]=b,B[13]=R,B[14]=Z,B[15]=ae}function I(B,j){O(B,j,j)}function P(B,j){const k=i();for(let _=0;_<16;_++)k[_]=j[_];for(let _=253;_>=0;_--)I(k,k),_!==2&&_!==4&&O(k,k,j);for(let _=0;_<16;_++)B[_]=k[_]}function q(B,j){const k=new Uint8Array(32),_=new Float64Array(80),N=i(),se=i(),le=i(),U=i(),y=i(),u=i();for(let S=0;S<31;S++)k[S]=B[S];k[31]=B[31]&127|64,k[0]&=248,d(_,j);for(let S=0;S<16;S++)se[S]=_[S];N[0]=U[0]=1;for(let S=254;S>=0;--S){const M=k[S>>>3]>>>(S&7)&1;f(N,se,M),f(le,U,M),m(y,N,le),w(N,N,le),m(le,se,U),w(se,se,U),I(U,y),I(u,N),O(N,le,N),O(le,se,y),m(y,N,le),w(N,N,le),I(se,N),w(le,U,u),O(N,le,a),m(N,N,U),O(le,le,N),O(N,U,u),O(U,se,_),I(se,y),f(N,se,M),f(le,U,M)}for(let S=0;S<16;S++)_[S+16]=N[S],_[S+32]=le[S],_[S+48]=se[S],_[S+64]=U[S];const h=_.subarray(32),v=_.subarray(16);P(h,h),O(v,v,h);const E=new Uint8Array(32);return g(E,v),E}r.scalarMult=q;function K(B){return q(B,n)}r.scalarMultBase=K;function Y(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const j=new Uint8Array(B);return{publicKey:K(j),secretKey:j}}r.generateKeyPairFromSeed=Y;function z(B){const j=(0,e.randomBytes)(32,B),k=Y(j);return(0,t.wipe)(j),k}r.generateKeyPair=z;function W(B,j,k=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(j.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=q(B,j);if(k){let N=0;for(let se=0;se<_.length;se++)N|=_[se];if(N===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=W})(Gd);function yv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function wl(r,e){e||(e=r.reduce((n,a)=>n+a.length,0));const t=yv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function e7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function I(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:I}}var t7=e7,r7=t7;const i7=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},n7=r=>new TextEncoder().encode(r),s7=r=>new TextDecoder().decode(r);let a7=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},o7=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return wv(this,e)}},c7=class{constructor(e){this.decoders=e}or(e){return wv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const wv=(r,e)=>new c7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});let u7=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new a7(e,t,i),this.decoder=new o7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const qf=({name:r,prefix:e,encode:t,decode:i})=>new u7(r,e,t,i),Ic=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=r7(t,e);return qf({prefix:r,name:e,encode:i,decode:a=>i7(n(a))})},f7=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},h7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<qf({prefix:e,name:r,encode(n){return h7(n,i,t)},decode(n){return f7(n,i,t,r)}}),l7=qf({prefix:"\0",name:"identity",encode:r=>s7(r),decode:r=>n7(r)}),d7=Object.freeze(Object.defineProperty({__proto__:null,identity:l7},Symbol.toStringTag,{value:"Module"})),p7=Ir({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),g7=Object.freeze(Object.defineProperty({__proto__:null,base2:p7},Symbol.toStringTag,{value:"Module"})),b7=Ir({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),v7=Object.freeze(Object.defineProperty({__proto__:null,base8:b7},Symbol.toStringTag,{value:"Module"})),m7=Ic({prefix:"9",name:"base10",alphabet:"0123456789"}),y7=Object.freeze(Object.defineProperty({__proto__:null,base10:m7},Symbol.toStringTag,{value:"Module"})),w7=Ir({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_7=Ir({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),D7=Object.freeze(Object.defineProperty({__proto__:null,base16:w7,base16upper:_7},Symbol.toStringTag,{value:"Module"})),E7=Ir({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),A7=Ir({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),x7=Ir({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),S7=Ir({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),M7=Ir({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),I7=Ir({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),C7=Ir({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P7=Ir({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),O7=Ir({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),T7=Object.freeze(Object.defineProperty({__proto__:null,base32:E7,base32hex:M7,base32hexpad:C7,base32hexpadupper:P7,base32hexupper:I7,base32pad:x7,base32padupper:S7,base32upper:A7,base32z:O7},Symbol.toStringTag,{value:"Module"})),R7=Ic({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),N7=Ic({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),B7=Object.freeze(Object.defineProperty({__proto__:null,base36:R7,base36upper:N7},Symbol.toStringTag,{value:"Module"})),$7=Ic({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),U7=Ic({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),q7=Object.freeze(Object.defineProperty({__proto__:null,base58btc:$7,base58flickr:U7},Symbol.toStringTag,{value:"Module"})),L7=Ir({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),F7=Ir({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),z7=Ir({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),j7=Ir({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),k7=Object.freeze(Object.defineProperty({__proto__:null,base64:L7,base64pad:F7,base64url:z7,base64urlpad:j7},Symbol.toStringTag,{value:"Module"})),_v=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),H7=_v.reduce((r,e,t)=>(r[t]=e,r),[]),K7=_v.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function V7(r){return r.reduce((e,t)=>(e+=H7[t],e),"")}function G7(r){const e=[];for(const t of r){const i=K7[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const J7=qf({prefix:"🚀",name:"base256emoji",encode:V7,decode:G7}),W7=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:J7},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const $1={...d7,...g7,...v7,...y7,...D7,...T7,...B7,...q7,...k7,...W7};function Dv(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const U1=Dv("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),_l=Dv("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=yv(r.length);for(let t=0;t",s9="MIT",a9={url:"https://github.com/indutny/elliptic/issues"},o9="https://github.com/indutny/elliptic",c9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},u9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},f9={name:Y7,version:Q7,description:X7,main:Z7,files:e9,scripts:t9,repository:r9,keywords:i9,author:n9,license:s9,bugs:a9,homepage:o9,devDependencies:c9,dependencies:u9};var Si={},Jd={exports:{}};Jd.exports;(function(r){(function(e,t){function i(U,y){if(!U)throw new Error(y||"Assertion failed")}function n(U,y){U.super_=y;var u=function(){};u.prototype=y.prototype,U.prototype=new u,U.prototype.constructor=U}function a(U,y,u){if(a.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((y==="le"||y==="be")&&(u=y,y=10),this._init(U||0,y||10,u||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=jd.Buffer}catch{}a.isBN=function(y){return y instanceof a?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===a.wordSize&&Array.isArray(y.words)},a.max=function(y,u){return y.cmp(u)>0?y:u},a.min=function(y,u){return y.cmp(u)<0?y:u},a.prototype._init=function(y,u,h){if(typeof y=="number")return this._initNumber(y,u,h);if(typeof y=="object")return this._initArray(y,u,h);u==="hex"&&(u=16),i(u===(u|0)&&u>=2&&u<=36),y=y.toString().replace(/\s+/g,"");var v=0;y[0]==="-"&&(v++,this.negative=1),v=0;v-=3)S=y[v]|y[v-1]<<8|y[v-2]<<16,this.words[E]|=S<>>26-M&67108863,M+=24,M>=26&&(M-=26,E++);else if(h==="le")for(v=0,E=0;v>>26-M&67108863,M+=24,M>=26&&(M-=26,E++);return this.strip()};function f(U,y){var u=U.charCodeAt(y);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function g(U,y,u){var h=f(U,u);return u-1>=y&&(h|=f(U,u-1)<<4),h}a.prototype._parseHex=function(y,u,h){this.length=Math.ceil((y.length-u)/6),this.words=new Array(this.length);for(var v=0;v=u;v-=2)M=g(y,u,v)<=18?(E-=18,S+=1,this.words[S]|=M>>>26):E+=8;else{var x=y.length-u;for(v=x%2===0?u+1:u;v=18?(E-=18,S+=1,this.words[S]|=M>>>26):E+=8}this.strip()};function d(U,y,u,h){for(var v=0,E=Math.min(U.length,u),S=y;S=49?v+=M-49+10:M>=17?v+=M-17+10:v+=M}return v}a.prototype._parseBase=function(y,u,h){this.words=[0],this.length=1;for(var v=0,E=1;E<=67108863;E*=u)v++;v--,E=E/u|0;for(var S=y.length-h,M=S%v,x=Math.min(S,S-M)+h,p=0,b=h;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var m=["","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"],w=[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],O=[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];a.prototype.toString=function(y,u){y=y||10,u=u|0||1;var h;if(y===16||y==="hex"){h="";for(var v=0,E=0,S=0;S>>24-v&16777215,v+=2,v>=26&&(v-=26,S--),E!==0||S!==this.length-1?h=m[6-x.length]+x+h:h=x+h}for(E!==0&&(h=E.toString(16)+h);h.length%u!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(y===(y|0)&&y>=2&&y<=36){var p=w[y],b=O[y];h="";var R=this.clone();for(R.negative=0;!R.isZero();){var Z=R.modn(b).toString(y);R=R.idivn(b),R.isZero()?h=Z+h:h=m[p-Z.length]+Z+h}for(this.isZero()&&(h="0"+h);h.length%u!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(y,u){return i(typeof c<"u"),this.toArrayLike(c,y,u)},a.prototype.toArray=function(y,u){return this.toArrayLike(Array,y,u)},a.prototype.toArrayLike=function(y,u,h){var v=this.byteLength(),E=h||Math.max(1,v);i(v<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0"),this.strip();var S=u==="le",M=new y(E),x,p,b=this.clone();if(S){for(p=0;!b.isZero();p++)x=b.andln(255),b.iushrn(8),M[p]=x;for(;p=4096&&(h+=13,u>>>=13),u>=64&&(h+=7,u>>>=7),u>=8&&(h+=4,u>>>=4),u>=2&&(h+=2,u>>>=2),h+u},a.prototype._zeroBits=function(y){if(y===0)return 26;var u=y,h=0;return u&8191||(h+=13,u>>>=13),u&127||(h+=7,u>>>=7),u&15||(h+=4,u>>>=4),u&3||(h+=2,u>>>=2),u&1||h++,h},a.prototype.bitLength=function(){var y=this.words[this.length-1],u=this._countBits(y);return(this.length-1)*26+u};function I(U){for(var y=new Array(U.bitLength()),u=0;u>>v}return y}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,u=0;uy.length?this.clone().ior(y):y.clone().ior(this)},a.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},a.prototype.iuand=function(y){var u;this.length>y.length?u=y:u=this;for(var h=0;hy.length?this.clone().iand(y):y.clone().iand(this)},a.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},a.prototype.iuxor=function(y){var u,h;this.length>y.length?(u=this,h=y):(u=y,h=this);for(var v=0;vy.length?this.clone().ixor(y):y.clone().ixor(this)},a.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},a.prototype.inotn=function(y){i(typeof y=="number"&&y>=0);var u=Math.ceil(y/26)|0,h=y%26;this._expand(u),h>0&&u--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-h),this.strip()},a.prototype.notn=function(y){return this.clone().inotn(y)},a.prototype.setn=function(y,u){i(typeof y=="number"&&y>=0);var h=y/26|0,v=y%26;return this._expand(h+1),u?this.words[h]=this.words[h]|1<y.length?(h=this,v=y):(h=y,v=this);for(var E=0,S=0;S>>26;for(;E!==0&&S>>26;if(this.length=h.length,E!==0)this.words[this.length]=E,this.length++;else if(h!==this)for(;Sy.length?this.clone().iadd(y):y.clone().iadd(this)},a.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var u=this.iadd(y);return y.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var h=this.cmp(y);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,E;h>0?(v=this,E=y):(v=y,E=this);for(var S=0,M=0;M>26,this.words[M]=u&67108863;for(;S!==0&&M>26,this.words[M]=u&67108863;if(S===0&&M>>26,R=x&67108863,Z=Math.min(p,y.length-1),ae=Math.max(0,p-U.length+1);ae<=Z;ae++){var C=p-ae|0;v=U.words[C]|0,E=y.words[ae]|0,S=v*E+R,b+=S/67108864|0,R=S&67108863}u.words[p]=R|0,x=b|0}return x!==0?u.words[p]=x|0:u.length--,u.strip()}var q=function(y,u,h){var v=y.words,E=u.words,S=h.words,M=0,x,p,b,R=v[0]|0,Z=R&8191,ae=R>>>13,C=v[1]|0,ee=C&8191,L=C>>>13,V=v[2]|0,G=V&8191,D=V>>>13,H=v[3]|0,ne=H&8191,ce=H>>>13,fe=v[4]|0,ye=fe&8191,we=fe>>>13,Te=v[5]|0,Qe=Te&8191,Ce=Te>>>13,Re=v[6]|0,Se=Re&8191,me=Re>>>13,Pe=v[7]|0,Ne=Pe&8191,be=Pe>>>13,Oe=v[8]|0,xe=Oe&8191,ve=Oe>>>13,qe=v[9]|0,Me=qe&8191,_e=qe>>>13,He=E[0]|0,Ve=He&8191,Ee=He>>>13,Ke=E[1]|0,ht=Ke&8191,Ge=Ke>>>13,_t=E[2]|0,lt=_t&8191,We=_t>>>13,Et=E[3]|0,St=Et&8191,Be=Et>>>13,Xe=E[4]|0,tt=Xe&8191,$e=Xe>>>13,et=E[5]|0,Ze=et&8191,Fe=et>>>13,ut=E[6]|0,rt=ut&8191,ze=ut>>>13,it=E[7]|0,st=it&8191,Ue=it>>>13,Ye=E[8]|0,ft=Ye&8191,je=Ye>>>13,Rt=E[9]|0,Nt=Rt&8191,at=Rt>>>13;h.negative=y.negative^u.negative,h.length=19,x=Math.imul(Z,Ve),p=Math.imul(Z,Ee),p=p+Math.imul(ae,Ve)|0,b=Math.imul(ae,Ee);var vt=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(vt>>>26)|0,vt&=67108863,x=Math.imul(ee,Ve),p=Math.imul(ee,Ee),p=p+Math.imul(L,Ve)|0,b=Math.imul(L,Ee),x=x+Math.imul(Z,ht)|0,p=p+Math.imul(Z,Ge)|0,p=p+Math.imul(ae,ht)|0,b=b+Math.imul(ae,Ge)|0;var Rr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,x=Math.imul(G,Ve),p=Math.imul(G,Ee),p=p+Math.imul(D,Ve)|0,b=Math.imul(D,Ee),x=x+Math.imul(ee,ht)|0,p=p+Math.imul(ee,Ge)|0,p=p+Math.imul(L,ht)|0,b=b+Math.imul(L,Ge)|0,x=x+Math.imul(Z,lt)|0,p=p+Math.imul(Z,We)|0,p=p+Math.imul(ae,lt)|0,b=b+Math.imul(ae,We)|0;var Nr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,x=Math.imul(ne,Ve),p=Math.imul(ne,Ee),p=p+Math.imul(ce,Ve)|0,b=Math.imul(ce,Ee),x=x+Math.imul(G,ht)|0,p=p+Math.imul(G,Ge)|0,p=p+Math.imul(D,ht)|0,b=b+Math.imul(D,Ge)|0,x=x+Math.imul(ee,lt)|0,p=p+Math.imul(ee,We)|0,p=p+Math.imul(L,lt)|0,b=b+Math.imul(L,We)|0,x=x+Math.imul(Z,St)|0,p=p+Math.imul(Z,Be)|0,p=p+Math.imul(ae,St)|0,b=b+Math.imul(ae,Be)|0;var Br=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Br>>>26)|0,Br&=67108863,x=Math.imul(ye,Ve),p=Math.imul(ye,Ee),p=p+Math.imul(we,Ve)|0,b=Math.imul(we,Ee),x=x+Math.imul(ne,ht)|0,p=p+Math.imul(ne,Ge)|0,p=p+Math.imul(ce,ht)|0,b=b+Math.imul(ce,Ge)|0,x=x+Math.imul(G,lt)|0,p=p+Math.imul(G,We)|0,p=p+Math.imul(D,lt)|0,b=b+Math.imul(D,We)|0,x=x+Math.imul(ee,St)|0,p=p+Math.imul(ee,Be)|0,p=p+Math.imul(L,St)|0,b=b+Math.imul(L,Be)|0,x=x+Math.imul(Z,tt)|0,p=p+Math.imul(Z,$e)|0,p=p+Math.imul(ae,tt)|0,b=b+Math.imul(ae,$e)|0;var $r=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+($r>>>26)|0,$r&=67108863,x=Math.imul(Qe,Ve),p=Math.imul(Qe,Ee),p=p+Math.imul(Ce,Ve)|0,b=Math.imul(Ce,Ee),x=x+Math.imul(ye,ht)|0,p=p+Math.imul(ye,Ge)|0,p=p+Math.imul(we,ht)|0,b=b+Math.imul(we,Ge)|0,x=x+Math.imul(ne,lt)|0,p=p+Math.imul(ne,We)|0,p=p+Math.imul(ce,lt)|0,b=b+Math.imul(ce,We)|0,x=x+Math.imul(G,St)|0,p=p+Math.imul(G,Be)|0,p=p+Math.imul(D,St)|0,b=b+Math.imul(D,Be)|0,x=x+Math.imul(ee,tt)|0,p=p+Math.imul(ee,$e)|0,p=p+Math.imul(L,tt)|0,b=b+Math.imul(L,$e)|0,x=x+Math.imul(Z,Ze)|0,p=p+Math.imul(Z,Fe)|0,p=p+Math.imul(ae,Ze)|0,b=b+Math.imul(ae,Fe)|0;var Ur=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,x=Math.imul(Se,Ve),p=Math.imul(Se,Ee),p=p+Math.imul(me,Ve)|0,b=Math.imul(me,Ee),x=x+Math.imul(Qe,ht)|0,p=p+Math.imul(Qe,Ge)|0,p=p+Math.imul(Ce,ht)|0,b=b+Math.imul(Ce,Ge)|0,x=x+Math.imul(ye,lt)|0,p=p+Math.imul(ye,We)|0,p=p+Math.imul(we,lt)|0,b=b+Math.imul(we,We)|0,x=x+Math.imul(ne,St)|0,p=p+Math.imul(ne,Be)|0,p=p+Math.imul(ce,St)|0,b=b+Math.imul(ce,Be)|0,x=x+Math.imul(G,tt)|0,p=p+Math.imul(G,$e)|0,p=p+Math.imul(D,tt)|0,b=b+Math.imul(D,$e)|0,x=x+Math.imul(ee,Ze)|0,p=p+Math.imul(ee,Fe)|0,p=p+Math.imul(L,Ze)|0,b=b+Math.imul(L,Fe)|0,x=x+Math.imul(Z,rt)|0,p=p+Math.imul(Z,ze)|0,p=p+Math.imul(ae,rt)|0,b=b+Math.imul(ae,ze)|0;var er=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(er>>>26)|0,er&=67108863,x=Math.imul(Ne,Ve),p=Math.imul(Ne,Ee),p=p+Math.imul(be,Ve)|0,b=Math.imul(be,Ee),x=x+Math.imul(Se,ht)|0,p=p+Math.imul(Se,Ge)|0,p=p+Math.imul(me,ht)|0,b=b+Math.imul(me,Ge)|0,x=x+Math.imul(Qe,lt)|0,p=p+Math.imul(Qe,We)|0,p=p+Math.imul(Ce,lt)|0,b=b+Math.imul(Ce,We)|0,x=x+Math.imul(ye,St)|0,p=p+Math.imul(ye,Be)|0,p=p+Math.imul(we,St)|0,b=b+Math.imul(we,Be)|0,x=x+Math.imul(ne,tt)|0,p=p+Math.imul(ne,$e)|0,p=p+Math.imul(ce,tt)|0,b=b+Math.imul(ce,$e)|0,x=x+Math.imul(G,Ze)|0,p=p+Math.imul(G,Fe)|0,p=p+Math.imul(D,Ze)|0,b=b+Math.imul(D,Fe)|0,x=x+Math.imul(ee,rt)|0,p=p+Math.imul(ee,ze)|0,p=p+Math.imul(L,rt)|0,b=b+Math.imul(L,ze)|0,x=x+Math.imul(Z,st)|0,p=p+Math.imul(Z,Ue)|0,p=p+Math.imul(ae,st)|0,b=b+Math.imul(ae,Ue)|0;var Xr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,x=Math.imul(xe,Ve),p=Math.imul(xe,Ee),p=p+Math.imul(ve,Ve)|0,b=Math.imul(ve,Ee),x=x+Math.imul(Ne,ht)|0,p=p+Math.imul(Ne,Ge)|0,p=p+Math.imul(be,ht)|0,b=b+Math.imul(be,Ge)|0,x=x+Math.imul(Se,lt)|0,p=p+Math.imul(Se,We)|0,p=p+Math.imul(me,lt)|0,b=b+Math.imul(me,We)|0,x=x+Math.imul(Qe,St)|0,p=p+Math.imul(Qe,Be)|0,p=p+Math.imul(Ce,St)|0,b=b+Math.imul(Ce,Be)|0,x=x+Math.imul(ye,tt)|0,p=p+Math.imul(ye,$e)|0,p=p+Math.imul(we,tt)|0,b=b+Math.imul(we,$e)|0,x=x+Math.imul(ne,Ze)|0,p=p+Math.imul(ne,Fe)|0,p=p+Math.imul(ce,Ze)|0,b=b+Math.imul(ce,Fe)|0,x=x+Math.imul(G,rt)|0,p=p+Math.imul(G,ze)|0,p=p+Math.imul(D,rt)|0,b=b+Math.imul(D,ze)|0,x=x+Math.imul(ee,st)|0,p=p+Math.imul(ee,Ue)|0,p=p+Math.imul(L,st)|0,b=b+Math.imul(L,Ue)|0,x=x+Math.imul(Z,ft)|0,p=p+Math.imul(Z,je)|0,p=p+Math.imul(ae,ft)|0,b=b+Math.imul(ae,je)|0;var Wi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,x=Math.imul(Me,Ve),p=Math.imul(Me,Ee),p=p+Math.imul(_e,Ve)|0,b=Math.imul(_e,Ee),x=x+Math.imul(xe,ht)|0,p=p+Math.imul(xe,Ge)|0,p=p+Math.imul(ve,ht)|0,b=b+Math.imul(ve,Ge)|0,x=x+Math.imul(Ne,lt)|0,p=p+Math.imul(Ne,We)|0,p=p+Math.imul(be,lt)|0,b=b+Math.imul(be,We)|0,x=x+Math.imul(Se,St)|0,p=p+Math.imul(Se,Be)|0,p=p+Math.imul(me,St)|0,b=b+Math.imul(me,Be)|0,x=x+Math.imul(Qe,tt)|0,p=p+Math.imul(Qe,$e)|0,p=p+Math.imul(Ce,tt)|0,b=b+Math.imul(Ce,$e)|0,x=x+Math.imul(ye,Ze)|0,p=p+Math.imul(ye,Fe)|0,p=p+Math.imul(we,Ze)|0,b=b+Math.imul(we,Fe)|0,x=x+Math.imul(ne,rt)|0,p=p+Math.imul(ne,ze)|0,p=p+Math.imul(ce,rt)|0,b=b+Math.imul(ce,ze)|0,x=x+Math.imul(G,st)|0,p=p+Math.imul(G,Ue)|0,p=p+Math.imul(D,st)|0,b=b+Math.imul(D,Ue)|0,x=x+Math.imul(ee,ft)|0,p=p+Math.imul(ee,je)|0,p=p+Math.imul(L,ft)|0,b=b+Math.imul(L,je)|0,x=x+Math.imul(Z,Nt)|0,p=p+Math.imul(Z,at)|0,p=p+Math.imul(ae,Nt)|0,b=b+Math.imul(ae,at)|0;var Zr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,x=Math.imul(Me,ht),p=Math.imul(Me,Ge),p=p+Math.imul(_e,ht)|0,b=Math.imul(_e,Ge),x=x+Math.imul(xe,lt)|0,p=p+Math.imul(xe,We)|0,p=p+Math.imul(ve,lt)|0,b=b+Math.imul(ve,We)|0,x=x+Math.imul(Ne,St)|0,p=p+Math.imul(Ne,Be)|0,p=p+Math.imul(be,St)|0,b=b+Math.imul(be,Be)|0,x=x+Math.imul(Se,tt)|0,p=p+Math.imul(Se,$e)|0,p=p+Math.imul(me,tt)|0,b=b+Math.imul(me,$e)|0,x=x+Math.imul(Qe,Ze)|0,p=p+Math.imul(Qe,Fe)|0,p=p+Math.imul(Ce,Ze)|0,b=b+Math.imul(Ce,Fe)|0,x=x+Math.imul(ye,rt)|0,p=p+Math.imul(ye,ze)|0,p=p+Math.imul(we,rt)|0,b=b+Math.imul(we,ze)|0,x=x+Math.imul(ne,st)|0,p=p+Math.imul(ne,Ue)|0,p=p+Math.imul(ce,st)|0,b=b+Math.imul(ce,Ue)|0,x=x+Math.imul(G,ft)|0,p=p+Math.imul(G,je)|0,p=p+Math.imul(D,ft)|0,b=b+Math.imul(D,je)|0,x=x+Math.imul(ee,Nt)|0,p=p+Math.imul(ee,at)|0,p=p+Math.imul(L,Nt)|0,b=b+Math.imul(L,at)|0;var Yi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,x=Math.imul(Me,lt),p=Math.imul(Me,We),p=p+Math.imul(_e,lt)|0,b=Math.imul(_e,We),x=x+Math.imul(xe,St)|0,p=p+Math.imul(xe,Be)|0,p=p+Math.imul(ve,St)|0,b=b+Math.imul(ve,Be)|0,x=x+Math.imul(Ne,tt)|0,p=p+Math.imul(Ne,$e)|0,p=p+Math.imul(be,tt)|0,b=b+Math.imul(be,$e)|0,x=x+Math.imul(Se,Ze)|0,p=p+Math.imul(Se,Fe)|0,p=p+Math.imul(me,Ze)|0,b=b+Math.imul(me,Fe)|0,x=x+Math.imul(Qe,rt)|0,p=p+Math.imul(Qe,ze)|0,p=p+Math.imul(Ce,rt)|0,b=b+Math.imul(Ce,ze)|0,x=x+Math.imul(ye,st)|0,p=p+Math.imul(ye,Ue)|0,p=p+Math.imul(we,st)|0,b=b+Math.imul(we,Ue)|0,x=x+Math.imul(ne,ft)|0,p=p+Math.imul(ne,je)|0,p=p+Math.imul(ce,ft)|0,b=b+Math.imul(ce,je)|0,x=x+Math.imul(G,Nt)|0,p=p+Math.imul(G,at)|0,p=p+Math.imul(D,Nt)|0,b=b+Math.imul(D,at)|0;var Qi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,x=Math.imul(Me,St),p=Math.imul(Me,Be),p=p+Math.imul(_e,St)|0,b=Math.imul(_e,Be),x=x+Math.imul(xe,tt)|0,p=p+Math.imul(xe,$e)|0,p=p+Math.imul(ve,tt)|0,b=b+Math.imul(ve,$e)|0,x=x+Math.imul(Ne,Ze)|0,p=p+Math.imul(Ne,Fe)|0,p=p+Math.imul(be,Ze)|0,b=b+Math.imul(be,Fe)|0,x=x+Math.imul(Se,rt)|0,p=p+Math.imul(Se,ze)|0,p=p+Math.imul(me,rt)|0,b=b+Math.imul(me,ze)|0,x=x+Math.imul(Qe,st)|0,p=p+Math.imul(Qe,Ue)|0,p=p+Math.imul(Ce,st)|0,b=b+Math.imul(Ce,Ue)|0,x=x+Math.imul(ye,ft)|0,p=p+Math.imul(ye,je)|0,p=p+Math.imul(we,ft)|0,b=b+Math.imul(we,je)|0,x=x+Math.imul(ne,Nt)|0,p=p+Math.imul(ne,at)|0,p=p+Math.imul(ce,Nt)|0,b=b+Math.imul(ce,at)|0;var ei=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(ei>>>26)|0,ei&=67108863,x=Math.imul(Me,tt),p=Math.imul(Me,$e),p=p+Math.imul(_e,tt)|0,b=Math.imul(_e,$e),x=x+Math.imul(xe,Ze)|0,p=p+Math.imul(xe,Fe)|0,p=p+Math.imul(ve,Ze)|0,b=b+Math.imul(ve,Fe)|0,x=x+Math.imul(Ne,rt)|0,p=p+Math.imul(Ne,ze)|0,p=p+Math.imul(be,rt)|0,b=b+Math.imul(be,ze)|0,x=x+Math.imul(Se,st)|0,p=p+Math.imul(Se,Ue)|0,p=p+Math.imul(me,st)|0,b=b+Math.imul(me,Ue)|0,x=x+Math.imul(Qe,ft)|0,p=p+Math.imul(Qe,je)|0,p=p+Math.imul(Ce,ft)|0,b=b+Math.imul(Ce,je)|0,x=x+Math.imul(ye,Nt)|0,p=p+Math.imul(ye,at)|0,p=p+Math.imul(we,Nt)|0,b=b+Math.imul(we,at)|0;var Mi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,x=Math.imul(Me,Ze),p=Math.imul(Me,Fe),p=p+Math.imul(_e,Ze)|0,b=Math.imul(_e,Fe),x=x+Math.imul(xe,rt)|0,p=p+Math.imul(xe,ze)|0,p=p+Math.imul(ve,rt)|0,b=b+Math.imul(ve,ze)|0,x=x+Math.imul(Ne,st)|0,p=p+Math.imul(Ne,Ue)|0,p=p+Math.imul(be,st)|0,b=b+Math.imul(be,Ue)|0,x=x+Math.imul(Se,ft)|0,p=p+Math.imul(Se,je)|0,p=p+Math.imul(me,ft)|0,b=b+Math.imul(me,je)|0,x=x+Math.imul(Qe,Nt)|0,p=p+Math.imul(Qe,at)|0,p=p+Math.imul(Ce,Nt)|0,b=b+Math.imul(Ce,at)|0;var Ii=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,x=Math.imul(Me,rt),p=Math.imul(Me,ze),p=p+Math.imul(_e,rt)|0,b=Math.imul(_e,ze),x=x+Math.imul(xe,st)|0,p=p+Math.imul(xe,Ue)|0,p=p+Math.imul(ve,st)|0,b=b+Math.imul(ve,Ue)|0,x=x+Math.imul(Ne,ft)|0,p=p+Math.imul(Ne,je)|0,p=p+Math.imul(be,ft)|0,b=b+Math.imul(be,je)|0,x=x+Math.imul(Se,Nt)|0,p=p+Math.imul(Se,at)|0,p=p+Math.imul(me,Nt)|0,b=b+Math.imul(me,at)|0;var lr=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(lr>>>26)|0,lr&=67108863,x=Math.imul(Me,st),p=Math.imul(Me,Ue),p=p+Math.imul(_e,st)|0,b=Math.imul(_e,Ue),x=x+Math.imul(xe,ft)|0,p=p+Math.imul(xe,je)|0,p=p+Math.imul(ve,ft)|0,b=b+Math.imul(ve,je)|0,x=x+Math.imul(Ne,Nt)|0,p=p+Math.imul(Ne,at)|0,p=p+Math.imul(be,Nt)|0,b=b+Math.imul(be,at)|0;var Xi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,x=Math.imul(Me,ft),p=Math.imul(Me,je),p=p+Math.imul(_e,ft)|0,b=Math.imul(_e,je),x=x+Math.imul(xe,Nt)|0,p=p+Math.imul(xe,at)|0,p=p+Math.imul(ve,Nt)|0,b=b+Math.imul(ve,at)|0;var Zi=(M+x|0)+((p&8191)<<13)|0;M=(b+(p>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,x=Math.imul(Me,Nt),p=Math.imul(Me,at),p=p+Math.imul(_e,Nt)|0,b=Math.imul(_e,at);var en=(M+x|0)+((p&8191)<<13)|0;return M=(b+(p>>>13)|0)+(en>>>26)|0,en&=67108863,S[0]=vt,S[1]=Rr,S[2]=Nr,S[3]=Br,S[4]=$r,S[5]=Ur,S[6]=er,S[7]=Xr,S[8]=Wi,S[9]=Zr,S[10]=Yi,S[11]=Qi,S[12]=ei,S[13]=Mi,S[14]=Ii,S[15]=lr,S[16]=Xi,S[17]=Zi,S[18]=en,M!==0&&(S[19]=M,h.length++),h};Math.imul||(q=P);function K(U,y,u){u.negative=y.negative^U.negative,u.length=U.length+y.length;for(var h=0,v=0,E=0;E>>26)|0,v+=S>>>26,S&=67108863}u.words[E]=M,h=S,S=v}return h!==0?u.words[E]=h:u.length--,u.strip()}function Y(U,y,u){var h=new z;return h.mulp(U,y,u)}a.prototype.mulTo=function(y,u){var h,v=this.length+y.length;return this.length===10&&y.length===10?h=q(this,y,u):v<63?h=P(this,y,u):v<1024?h=K(this,y,u):h=Y(this,y,u),h};function z(U,y){this.x=U,this.y=y}z.prototype.makeRBT=function(y){for(var u=new Array(y),h=a.prototype._countBits(y)-1,v=0;v>=1;return v},z.prototype.permute=function(y,u,h,v,E,S){for(var M=0;M>>1)E++;return 1<>>13,h[2*S+1]=E&8191,E=E>>>13;for(S=2*u;S>=26,u+=v/67108864|0,u+=E>>>26,this.words[h]=E&67108863}return u!==0&&(this.words[h]=u,this.length++),this},a.prototype.muln=function(y){return this.clone().imuln(y)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(y){var u=I(y);if(u.length===0)return new a(1);for(var h=this,v=0;v=0);var u=y%26,h=(y-u)/26,v=67108863>>>26-u<<26-u,E;if(u!==0){var S=0;for(E=0;E>>26-u}S&&(this.words[E]=S,this.length++)}if(h!==0){for(E=this.length-1;E>=0;E--)this.words[E+h]=this.words[E];for(E=0;E=0);var v;u?v=(u-u%26)/26:v=0;var E=y%26,S=Math.min((y-E)/26,this.length),M=67108863^67108863>>>E<S)for(this.length-=S,p=0;p=0&&(b!==0||p>=v);p--){var R=this.words[p]|0;this.words[p]=b<<26-E|R>>>E,b=R&M}return x&&b!==0&&(x.words[x.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(y,u,h){return i(this.negative===0),this.iushrn(y,u,h)},a.prototype.shln=function(y){return this.clone().ishln(y)},a.prototype.ushln=function(y){return this.clone().iushln(y)},a.prototype.shrn=function(y){return this.clone().ishrn(y)},a.prototype.ushrn=function(y){return this.clone().iushrn(y)},a.prototype.testn=function(y){i(typeof y=="number"&&y>=0);var u=y%26,h=(y-u)/26,v=1<=0);var u=y%26,h=(y-u)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(u!==0&&h++,this.length=Math.min(h,this.length),u!==0){var v=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},a.prototype.isubn=function(y){if(i(typeof y=="number"),i(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(x/67108864|0),this.words[E+h]=S&67108863}for(;E>26,this.words[E+h]=S&67108863;if(M===0)return this.strip();for(i(M===-1),M=0,E=0;E>26,this.words[E]=S&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(y,u){var h=this.length-y.length,v=this.clone(),E=y,S=E.words[E.length-1]|0,M=this._countBits(S);h=26-M,h!==0&&(E=E.ushln(h),v.iushln(h),S=E.words[E.length-1]|0);var x=v.length-E.length,p;if(u!=="mod"){p=new a(null),p.length=x+1,p.words=new Array(p.length);for(var b=0;b=0;Z--){var ae=(v.words[E.length+Z]|0)*67108864+(v.words[E.length+Z-1]|0);for(ae=Math.min(ae/S|0,67108863),v._ishlnsubmul(E,ae,Z);v.negative!==0;)ae--,v.negative=0,v._ishlnsubmul(E,1,Z),v.isZero()||(v.negative^=1);p&&(p.words[Z]=ae)}return p&&p.strip(),v.strip(),u!=="div"&&h!==0&&v.iushrn(h),{div:p||null,mod:v}},a.prototype.divmod=function(y,u,h){if(i(!y.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var v,E,S;return this.negative!==0&&y.negative===0?(S=this.neg().divmod(y,u),u!=="mod"&&(v=S.div.neg()),u!=="div"&&(E=S.mod.neg(),h&&E.negative!==0&&E.iadd(y)),{div:v,mod:E}):this.negative===0&&y.negative!==0?(S=this.divmod(y.neg(),u),u!=="mod"&&(v=S.div.neg()),{div:v,mod:S.mod}):this.negative&y.negative?(S=this.neg().divmod(y.neg(),u),u!=="div"&&(E=S.mod.neg(),h&&E.negative!==0&&E.isub(y)),{div:S.div,mod:E}):y.length>this.length||this.cmp(y)<0?{div:new a(0),mod:this}:y.length===1?u==="div"?{div:this.divn(y.words[0]),mod:null}:u==="mod"?{div:null,mod:new a(this.modn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new a(this.modn(y.words[0]))}:this._wordDiv(y,u)},a.prototype.div=function(y){return this.divmod(y,"div",!1).div},a.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},a.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},a.prototype.divRound=function(y){var u=this.divmod(y);if(u.mod.isZero())return u.div;var h=u.div.negative!==0?u.mod.isub(y):u.mod,v=y.ushrn(1),E=y.andln(1),S=h.cmp(v);return S<0||E===1&&S===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},a.prototype.modn=function(y){i(y<=67108863);for(var u=(1<<26)%y,h=0,v=this.length-1;v>=0;v--)h=(u*h+(this.words[v]|0))%y;return h},a.prototype.idivn=function(y){i(y<=67108863);for(var u=0,h=this.length-1;h>=0;h--){var v=(this.words[h]|0)+u*67108864;this.words[h]=v/y|0,u=v%y}return this.strip()},a.prototype.divn=function(y){return this.clone().idivn(y)},a.prototype.egcd=function(y){i(y.negative===0),i(!y.isZero());var u=this,h=y.clone();u.negative!==0?u=u.umod(y):u=u.clone();for(var v=new a(1),E=new a(0),S=new a(0),M=new a(1),x=0;u.isEven()&&h.isEven();)u.iushrn(1),h.iushrn(1),++x;for(var p=h.clone(),b=u.clone();!u.isZero();){for(var R=0,Z=1;!(u.words[0]&Z)&&R<26;++R,Z<<=1);if(R>0)for(u.iushrn(R);R-- >0;)(v.isOdd()||E.isOdd())&&(v.iadd(p),E.isub(b)),v.iushrn(1),E.iushrn(1);for(var ae=0,C=1;!(h.words[0]&C)&&ae<26;++ae,C<<=1);if(ae>0)for(h.iushrn(ae);ae-- >0;)(S.isOdd()||M.isOdd())&&(S.iadd(p),M.isub(b)),S.iushrn(1),M.iushrn(1);u.cmp(h)>=0?(u.isub(h),v.isub(S),E.isub(M)):(h.isub(u),S.isub(v),M.isub(E))}return{a:S,b:M,gcd:h.iushln(x)}},a.prototype._invmp=function(y){i(y.negative===0),i(!y.isZero());var u=this,h=y.clone();u.negative!==0?u=u.umod(y):u=u.clone();for(var v=new a(1),E=new a(0),S=h.clone();u.cmpn(1)>0&&h.cmpn(1)>0;){for(var M=0,x=1;!(u.words[0]&x)&&M<26;++M,x<<=1);if(M>0)for(u.iushrn(M);M-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);for(var p=0,b=1;!(h.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(h.iushrn(p);p-- >0;)E.isOdd()&&E.iadd(S),E.iushrn(1);u.cmp(h)>=0?(u.isub(h),v.isub(E)):(h.isub(u),E.isub(v))}var R;return u.cmpn(1)===0?R=v:R=E,R.cmpn(0)<0&&R.iadd(y),R},a.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var u=this.clone(),h=y.clone();u.negative=0,h.negative=0;for(var v=0;u.isEven()&&h.isEven();v++)u.iushrn(1),h.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;h.isEven();)h.iushrn(1);var E=u.cmp(h);if(E<0){var S=u;u=h,h=S}else if(E===0||h.cmpn(1)===0)break;u.isub(h)}while(!0);return h.iushln(v)},a.prototype.invm=function(y){return this.egcd(y).a.umod(y)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(y){return this.words[0]&y},a.prototype.bincn=function(y){i(typeof y=="number");var u=y%26,h=(y-u)/26,v=1<>>26,M&=67108863,this.words[S]=M}return E!==0&&(this.words[S]=E,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(y){var u=y<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var h;if(this.length>1)h=1;else{u&&(y=-y),i(y<=67108863,"Number is too big");var v=this.words[0]|0;h=v===y?0:vy.length)return 1;if(this.length=0;h--){var v=this.words[h]|0,E=y.words[h]|0;if(v!==E){vE&&(u=1);break}}return u},a.prototype.gtn=function(y){return this.cmpn(y)===1},a.prototype.gt=function(y){return this.cmp(y)===1},a.prototype.gten=function(y){return this.cmpn(y)>=0},a.prototype.gte=function(y){return this.cmp(y)>=0},a.prototype.ltn=function(y){return this.cmpn(y)===-1},a.prototype.lt=function(y){return this.cmp(y)===-1},a.prototype.lten=function(y){return this.cmpn(y)<=0},a.prototype.lte=function(y){return this.cmp(y)<=0},a.prototype.eqn=function(y){return this.cmpn(y)===0},a.prototype.eq=function(y){return this.cmp(y)===0},a.red=function(y){return new se(y)},a.prototype.toRed=function(y){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(y){return this.red=y,this},a.prototype.forceRed=function(y){return i(!this.red,"Already a number in reduction context"),this._forceRed(y)},a.prototype.redAdd=function(y){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},a.prototype.redIAdd=function(y){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},a.prototype.redSub=function(y){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},a.prototype.redISub=function(y){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},a.prototype.redShl=function(y){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},a.prototype.redMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},a.prototype.redIMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(y){return i(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var W={k256:null,p224:null,p192:null,p25519:null};function B(U,y){this.name=U,this.p=new a(y,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var y=new a(null);return y.words=new Array(Math.ceil(this.n/13)),y},B.prototype.ireduce=function(y){var u=y,h;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),h=u.bitLength();while(h>this.n);var v=h0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},B.prototype.split=function(y,u){y.iushrn(this.n,0,u)},B.prototype.imulK=function(y){return y.imul(this.k)};function j(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(j,B),j.prototype.split=function(y,u){for(var h=4194303,v=Math.min(y.length,9),E=0;E>>22,S=M}S>>>=22,y.words[E-10]=S,S===0&&y.length>10?y.length-=10:y.length-=9},j.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var u=0,h=0;h>>=26,y.words[h]=E,u=v}return u!==0&&(y.words[y.length++]=u),y},a._prime=function(y){if(W[y])return W[y];var u;if(y==="k256")u=new j;else if(y==="p224")u=new k;else if(y==="p192")u=new _;else if(y==="p25519")u=new N;else throw new Error("Unknown prime "+y);return W[y]=u,u};function se(U){if(typeof U=="string"){var y=a._prime(U);this.m=y.p,this.prime=y}else i(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}se.prototype._verify1=function(y){i(y.negative===0,"red works only with positives"),i(y.red,"red works only with red numbers")},se.prototype._verify2=function(y,u){i((y.negative|u.negative)===0,"red works only with positives"),i(y.red&&y.red===u.red,"red works only with red numbers")},se.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):y.umod(this.m)._forceRed(this)},se.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},se.prototype.add=function(y,u){this._verify2(y,u);var h=y.add(u);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},se.prototype.iadd=function(y,u){this._verify2(y,u);var h=y.iadd(u);return h.cmp(this.m)>=0&&h.isub(this.m),h},se.prototype.sub=function(y,u){this._verify2(y,u);var h=y.sub(u);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},se.prototype.isub=function(y,u){this._verify2(y,u);var h=y.isub(u);return h.cmpn(0)<0&&h.iadd(this.m),h},se.prototype.shl=function(y,u){return this._verify1(y),this.imod(y.ushln(u))},se.prototype.imul=function(y,u){return this._verify2(y,u),this.imod(y.imul(u))},se.prototype.mul=function(y,u){return this._verify2(y,u),this.imod(y.mul(u))},se.prototype.isqr=function(y){return this.imul(y,y.clone())},se.prototype.sqr=function(y){return this.mul(y,y)},se.prototype.sqrt=function(y){if(y.isZero())return y.clone();var u=this.m.andln(3);if(i(u%2===1),u===3){var h=this.m.add(new a(1)).iushrn(2);return this.pow(y,h)}for(var v=this.m.subn(1),E=0;!v.isZero()&&v.andln(1)===0;)E++,v.iushrn(1);i(!v.isZero());var S=new a(1).toRed(this),M=S.redNeg(),x=this.m.subn(1).iushrn(1),p=this.m.bitLength();for(p=new a(2*p*p).toRed(this);this.pow(p,x).cmp(M)!==0;)p.redIAdd(M);for(var b=this.pow(p,v),R=this.pow(y,v.addn(1).iushrn(1)),Z=this.pow(y,v),ae=E;Z.cmp(S)!==0;){for(var C=Z,ee=0;C.cmp(S)!==0;ee++)C=C.redSqr();i(ee=0;E--){for(var b=u.words[E],R=p-1;R>=0;R--){var Z=b>>R&1;if(S!==v[0]&&(S=this.sqr(S)),Z===0&&M===0){x=0;continue}M<<=1,M|=Z,x++,!(x!==h&&(E!==0||R!==0))&&(S=this.mul(S,v[M]),x=0,M=0)}p=26}return S},se.prototype.convertTo=function(y){var u=y.umod(this.m);return u===y?u.clone():u},se.prototype.convertFrom=function(y){var u=y.clone();return u.red=null,u},a.mont=function(y){return new le(y)};function le(U){se.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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)}n(le,se),le.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},le.prototype.convertFrom=function(y){var u=this.imod(y.mul(this.rinv));return u.red=null,u},le.prototype.imul=function(y,u){if(y.isZero()||u.isZero())return y.words[0]=0,y.length=1,y;var h=y.imul(u),v=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(v).iushrn(this.shift),S=E;return E.cmp(this.m)>=0?S=E.isub(this.m):E.cmpn(0)<0&&(S=E.iadd(this.m)),S._forceRed(this)},le.prototype.mul=function(y,u){if(y.isZero()||u.isZero())return new a(0)._forceRed(this);var h=y.mul(u),v=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(v).iushrn(this.shift),S=E;return E.cmp(this.m)>=0?S=E.isub(this.m):E.cmpn(0)<0&&(S=E.iadd(this.m)),S._forceRed(this)},le.prototype.invm=function(y){var u=this.imod(y._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(r,rv)})(Jd);var ws=Jd.exports,Ea=xv;function xv(r,e){if(!r)throw new Error(e||"Assertion failed")}xv.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var Wd={};(function(r){var e=r;function t(a,c){if(Array.isArray(a))return a.slice();if(!a)return[];var f=[];if(typeof a!="string"){for(var g=0;g>8,w=d&255;m?f.push(m,w):f.push(w)}return f}e.toArray=t;function i(a){return a.length===1?"0"+a:a}e.zero2=i;function n(a){for(var c="",f=0;f(q>>1)-1?Y=(q>>1)-z:Y=z,K.isubn(Y)):Y=0,I[P]=Y,K.iushrn(1)}return I}e.getNAF=a;function c(m,w){var O=[[],[]];m=m.clone(),w=w.clone();for(var I=0,P=0,q;m.cmpn(-I)>0||w.cmpn(-P)>0;){var K=m.andln(3)+I&3,Y=w.andln(3)+P&3;K===3&&(K=-1),Y===3&&(Y=-1);var z;K&1?(q=m.andln(7)+I&7,(q===3||q===5)&&Y===2?z=-K:z=K):z=0,O[0].push(z);var W;Y&1?(q=w.andln(7)+P&7,(q===3||q===5)&&K===2?W=-Y:W=Y):W=0,O[1].push(W),2*I===z+1&&(I=1-I),2*P===W+1&&(P=1-P),m.iushrn(1),w.iushrn(1)}return O}e.getJSF=c;function f(m,w,O){var I="_"+w;m.prototype[w]=function(){return this[I]!==void 0?this[I]:this[I]=O.call(this)}}e.cachedProperty=f;function g(m){return typeof m=="string"?e.toArray(m,"hex"):m}e.parseBytes=g;function d(m){return new t(m,"hex","le")}e.intFromLE=d})(Si);var Yd={exports:{}},Dl;Yd.exports=function(e){return Dl||(Dl=new qs(null)),Dl.generate(e)};function qs(r){this.rand=r}Yd.exports.Rand=qs;qs.prototype.generate=function(e){return this._rand(e)};qs.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Lf=Hs;Hs.prototype.point=function(){throw new Error("Not implemented")};Hs.prototype.validate=function(){throw new Error("Not implemented")};Hs.prototype._fixedNafMul=function(e,t){bf(e.precomputed);var i=e._getDoubles(),n=gf(t,1,this._bitLength),a=(1<=f;d--)g=(g<<1)+n[d];c.push(g)}for(var m=this.jpoint(null,null,null),w=this.jpoint(null,null,null),O=a;O>0;O--){for(f=0;f=0;g--){for(var d=0;g>=0&&c[g]===0;g--)d++;if(g>=0&&d++,f=f.dblp(d),g<0)break;var m=c[g];bf(m!==0),e.type==="affine"?m>0?f=f.mixedAdd(a[m-1>>1]):f=f.mixedAdd(a[-m-1>>1].neg()):m>0?f=f.add(a[m-1>>1]):f=f.add(a[-m-1>>1].neg())}return e.type==="affine"?f.toP():f};Hs.prototype._wnafMulAdd=function(e,t,i,n,a){var c=this._wnafT1,f=this._wnafT2,g=this._wnafT3,d=0,m,w,O;for(m=0;m=1;m-=2){var P=m-1,q=m;if(c[P]!==1||c[q]!==1){g[P]=gf(i[P],c[P],this._bitLength),g[q]=gf(i[q],c[q],this._bitLength),d=Math.max(g[P].length,d),d=Math.max(g[q].length,d);continue}var K=[t[P],null,null,t[q]];t[P].y.cmp(t[q].y)===0?(K[1]=t[P].add(t[q]),K[2]=t[P].toJ().mixedAdd(t[q].neg())):t[P].y.cmp(t[q].y.redNeg())===0?(K[1]=t[P].toJ().mixedAdd(t[q]),K[2]=t[P].add(t[q].neg())):(K[1]=t[P].toJ().mixedAdd(t[q]),K[2]=t[P].toJ().mixedAdd(t[q].neg()));var Y=[-3,-1,-5,-7,0,7,5,1,3],z=h9(i[P],i[q]);for(d=Math.max(z[0].length,d),g[P]=new Array(d),g[q]=new Array(d),w=0;w=0;m--){for(var _=0;m>=0;){var N=!0;for(w=0;w=0&&_++,j=j.dblp(_),m<0)break;for(w=0;w0?O=f[w][se-1>>1]:se<0&&(O=f[w][-se-1>>1].neg()),O.type==="affine"?j=j.mixedAdd(O):j=j.add(O))}}for(m=0;m=Math.ceil((e.bitLength()+1)/t.step):!1};Gi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,a=0;a=0&&(I=d,P=m),w.negative&&(w=w.neg(),O=O.neg()),I.negative&&(I=I.neg(),P=P.neg()),[{a:w,b:O},{a:I,b:P}]};Ji.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),c=i.b.neg().mul(e).divRound(this.n),f=a.mul(i.a),g=c.mul(n.a),d=a.mul(i.b),m=c.mul(n.b),w=e.sub(f).sub(g),O=d.add(m).neg();return{k1:w,k2:O}};Ji.prototype.pointFromX=function(e,t){e=new nr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)};Ji.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(a).cmpn(0)===0};Ji.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,a=this._endoWnafT2,c=0;c":""};Ar.prototype.isInfinity=function(){return this.inf};Ar.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};Ar.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),a=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),c=a.redSqr().redISub(this.x.redAdd(this.x)),f=a.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,f)};Ar.prototype.getX=function(){return this.x.fromRed()};Ar.prototype.getY=function(){return this.y.fromRed()};Ar.prototype.mul=function(e){return e=new nr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ar.prototype.mulAdd=function(e,t,i){var n=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)};Ar.prototype.jmulAdd=function(e,t,i){var n=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)};Ar.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ar.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(a){return a.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t};Ar.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Cr(r,e,t,i){po.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new nr(0)):(this.x=new nr(e,16),this.y=new nr(t,16),this.z=new nr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Xd(Cr,po.BasePoint);Ji.prototype.jpoint=function(e,t,i){return new Cr(this,e,t,i)};Cr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)};Cr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Cr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),a=e.x.redMul(i),c=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),g=n.redSub(a),d=c.redSub(f);if(g.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=g.redSqr(),w=m.redMul(g),O=n.redMul(m),I=d.redSqr().redIAdd(w).redISub(O).redISub(O),P=d.redMul(O.redISub(I)).redISub(c.redMul(w)),q=this.z.redMul(e.z).redMul(g);return this.curve.jpoint(I,P,q)};Cr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),a=this.y,c=e.y.redMul(t).redMul(this.z),f=i.redSub(n),g=a.redSub(c);if(f.cmpn(0)===0)return g.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=f.redSqr(),m=d.redMul(f),w=i.redMul(d),O=g.redSqr().redIAdd(m).redISub(w).redISub(w),I=g.redMul(w.redISub(O)).redISub(a.redMul(m)),P=this.z.redMul(f);return this.curve.jpoint(O,I,P)};Cr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t=0)return!1;if(i.redIAdd(a),this.x.cmp(i)===0)return!0}};Cr.prototype.inspect=function(){return this.isInfinity()?"":""};Cr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ro=ws,Mv=Of,Ff=Lf,g9=Si;function go(r){Ff.call(this,"mont",r),this.a=new ro(r.a,16).toRed(this.red),this.b=new ro(r.b,16).toRed(this.red),this.i4=new ro(4).toRed(this.red).redInvm(),this.two=new ro(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Mv(go,Ff);var b9=go;go.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),a=n.redSqrt();return a.redSqr().cmp(n)===0};function Er(r,e,t){Ff.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ro(e,16),this.z=new ro(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Mv(Er,Ff.BasePoint);go.prototype.decodePoint=function(e,t){return this.point(g9.toArray(e,t),1)};go.prototype.point=function(e,t){return new Er(this,e,t)};go.prototype.pointFromJSON=function(e){return Er.fromJSON(this,e)};Er.prototype.precompute=function(){};Er.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Er.fromJSON=function(e,t){return new Er(e,t[0],t[1]||e.one)};Er.prototype.inspect=function(){return this.isInfinity()?"":""};Er.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Er.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),a=t.redSub(n),c=t.redMul(n),f=a.redMul(n.redAdd(this.curve.a24.redMul(a)));return this.curve.point(c,f)};Er.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),c=e.x.redSub(e.z),f=c.redMul(i),g=a.redMul(n),d=t.z.redMul(f.redAdd(g).redSqr()),m=t.x.redMul(f.redISub(g).redSqr());return this.curve.point(d,m)};Er.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),a=this,c=[];t.cmpn(0)!==0;t.iushrn(1))c.push(t.andln(1));for(var f=c.length-1;f>=0;f--)c[f]===0?(i=i.diffAdd(n,a),n=n.dbl()):(n=i.diffAdd(n,a),i=i.dbl());return n};Er.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Er.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Er.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var v9=Si,gs=ws,Iv=Of,zf=Lf,m9=v9.assert;function Gn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,zf.call(this,"edwards",r),this.a=new gs(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new gs(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new gs(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),m9(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}Iv(Gn,zf);var y9=Gn;Gn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Gn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Gn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)};Gn.prototype.pointFromX=function(e,t){e=new gs(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),c=n.redMul(a.redInvm()),f=c.redSqrt();if(f.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");var g=f.fromRed().isOdd();return(t&&!g||!t&&g)&&(f=f.redNeg()),this.point(e,f)};Gn.prototype.pointFromY=function(e,t){e=new gs(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),a=i.redMul(this.d).redMul(this.c2).redSub(this.a),c=n.redMul(a.redInvm());if(c.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=c.redSqrt();if(f.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)};Gn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(a)===0};function Jt(r,e,t,i,n){zf.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new gs(e,16),this.y=new gs(t,16),this.z=i?new gs(i,16):this.curve.one,this.t=n&&new gs(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}Iv(Jt,zf.BasePoint);Gn.prototype.pointFromJSON=function(e){return Jt.fromJSON(this,e)};Gn.prototype.point=function(e,t,i,n){return new Jt(this,e,t,i,n)};Jt.fromJSON=function(e,t){return new Jt(e,t[0],t[1],t[2])};Jt.prototype.inspect=function(){return this.isInfinity()?"":""};Jt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Jt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),c=n.redAdd(t),f=c.redSub(i),g=n.redSub(t),d=a.redMul(f),m=c.redMul(g),w=a.redMul(g),O=f.redMul(c);return this.curve.point(d,m,O,w)};Jt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,a,c,f,g,d;if(this.curve.twisted){f=this.curve._mulA(t);var m=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(m.redSub(this.curve.two)),a=m.redMul(f.redSub(i)),c=m.redSqr().redSub(m).redSub(m)):(g=this.z.redSqr(),d=m.redSub(g).redISub(g),n=e.redSub(t).redISub(i).redMul(d),a=m.redMul(f.redSub(i)),c=m.redMul(d))}else f=t.redAdd(i),g=this.curve._mulC(this.z).redSqr(),d=f.redSub(g).redSub(g),n=this.curve._mulC(e.redISub(f)).redMul(d),a=this.curve._mulC(f).redMul(t.redISub(i)),c=f.redMul(d);return this.curve.point(n,a,c)};Jt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Jt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),c=i.redSub(t),f=a.redSub(n),g=a.redAdd(n),d=i.redAdd(t),m=c.redMul(f),w=g.redMul(d),O=c.redMul(d),I=f.redMul(g);return this.curve.point(m,w,I,O)};Jt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),a=this.y.redMul(e.y),c=this.curve.d.redMul(n).redMul(a),f=i.redSub(c),g=i.redAdd(c),d=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(a),m=t.redMul(f).redMul(d),w,O;return this.curve.twisted?(w=t.redMul(g).redMul(a.redSub(this.curve._mulA(n))),O=f.redMul(g)):(w=t.redMul(g).redMul(a.redSub(n)),O=this.curve._mulC(f).redMul(g)),this.curve.point(m,w,O)};Jt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Jt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Jt.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)};Jt.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)};Jt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Jt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Jt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Jt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Jt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Jt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}};Jt.prototype.toP=Jt.prototype.normalize;Jt.prototype.mixedAdd=Jt.prototype.add;(function(r){var e=r;e.base=Lf,e.short=p9,e.mont=b9,e.edwards=y9})(Qd);var jf={},kf={},Ct={},w9=Ea,_9=Of;Ct.inherits=_9;function D9(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function E9(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n>6|192,t[i++]=a&63|128):D9(r,n)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=a>>18|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128,t[i++]=a&63|128):(t[i++]=a>>12|224,t[i++]=a>>6&63|128,t[i++]=a&63|128)}else for(n=0;n>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Ct.htonl=Cv;function x9(r,e){for(var t="",i=0;i>>0}return a}Ct.join32=S9;function M9(r,e){for(var t=new Array(r.length*4),i=0,n=0;i>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}Ct.split32=M9;function I9(r,e){return r>>>e|r<<32-e}Ct.rotr32=I9;function C9(r,e){return r<>>32-e}Ct.rotl32=C9;function P9(r,e){return r+e>>>0}Ct.sum32=P9;function O9(r,e,t){return r+e+t>>>0}Ct.sum32_3=O9;function T9(r,e,t,i){return r+e+t+i>>>0}Ct.sum32_4=T9;function R9(r,e,t,i,n){return r+e+t+i+n>>>0}Ct.sum32_5=R9;function N9(r,e,t,i){var n=r[e],a=r[e+1],c=i+a>>>0,f=(c>>0,r[e+1]=c}Ct.sum64=N9;function B9(r,e,t,i){var n=e+i>>>0,a=(n>>0}Ct.sum64_hi=B9;function $9(r,e,t,i){var n=e+i;return n>>>0}Ct.sum64_lo=$9;function U9(r,e,t,i,n,a,c,f){var g=0,d=e;d=d+i>>>0,g+=d>>0,g+=d>>0,g+=d>>0}Ct.sum64_4_hi=U9;function q9(r,e,t,i,n,a,c,f){var g=e+i+a+f;return g>>>0}Ct.sum64_4_lo=q9;function L9(r,e,t,i,n,a,c,f,g,d){var m=0,w=e;w=w+i>>>0,m+=w>>0,m+=w>>0,m+=w>>0,m+=w>>0}Ct.sum64_5_hi=L9;function F9(r,e,t,i,n,a,c,f,g,d){var m=e+i+a+f+d;return m>>>0}Ct.sum64_5_lo=F9;function z9(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Ct.rotr64_hi=z9;function j9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ct.rotr64_lo=j9;function k9(r,e,t){return r>>>t}Ct.shr64_hi=k9;function H9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ct.shr64_lo=H9;var bo={},L1=Ct,K9=Ea;function Hf(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}bo.BlockHash=Hf;Hf.prototype.update=function(e,t){if(e=L1.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=L1.join32(e,0,e.length-i,this.endian);for(var n=0;n>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,c=8;c>>3}Jn.g0_256=Y9;function Q9(r){return Nn(r,17)^Nn(r,19)^r>>>10}Jn.g1_256=Q9;var ao=Ct,X9=bo,Z9=Jn,El=ao.rotl32,Yo=ao.sum32,eD=ao.sum32_5,tD=Z9.ft_1,Bv=X9.BlockHash,rD=[1518500249,1859775393,2400959708,3395469782];function jn(){if(!(this instanceof jn))return new jn;Bv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ao.inherits(jn,Bv);var iD=jn;jn.blockSize=512;jn.outSize=160;jn.hmacStrength=80;jn.padLength=64;jn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;nthis.blockSize&&(e=new this.Hash().update(e).digest()),HD(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var JD=zs;zs.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};zs.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=ga.toArray(i,n||"hex"),this._update(i));for(var a=[];a.length"};var vf=ws,Zd=Si,XD=Zd.assert;function Kf(r,e){if(r instanceof Kf)return r;this._importDER(r,e)||(XD(r.r&&r.s,"Signature without r or s"),this.r=new vf(r.r,16),this.s=new vf(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var ZD=Kf;function eE(){this.place=0}function Ml(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,a=0,c=e.place;a>>=0;return n<=127?!1:(e.place=c,n)}function H1(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Kf.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=H1(t),i=H1(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];Il(n,t.length),n=n.concat(t),n.push(2),Il(n,i.length);var a=n.concat(i),c=[48];return Il(c,a.length),c=c.concat(a),Zd.encode(c,e)};var pn=ws,Gv=JD,tE=Si,Cl=jf,rE=Sv,ha=tE.assert,e0=QD,Vf=ZD;function Ki(r){if(!(this instanceof Ki))return new Ki(r);typeof r=="string"&&(ha(Object.prototype.hasOwnProperty.call(Cl,r),"Unknown curve "+r),r=Cl[r]),r instanceof Cl.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var iE=Ki;Ki.prototype.keyPair=function(e){return new e0(this,e)};Ki.prototype.keyFromPrivate=function(e,t){return e0.fromPrivate(this,e,t)};Ki.prototype.keyFromPublic=function(e,t){return e0.fromPublic(this,e,t)};Ki.prototype.genKeyPair=function(e){e||(e={});for(var t=new Gv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rE(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new pn(2));;){var a=new pn(t.generate(i));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}};Ki.prototype._truncateToN=function(e,t,i){var n;if(pn.isBN(e)||typeof e=="number")e=new pn(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new pn(e,16);else{var a=e.toString();n=a.length+1>>>1,e=new pn(a,16)}typeof i!="number"&&(i=n*8);var c=i-this.n.bitLength();return c>0&&(e=e.ushrn(c)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};Ki.prototype.sign=function(e,t,i,n){if(typeof i=="object"&&(n=i,i=null),n||(n={}),typeof e!="string"&&typeof e!="number"&&!pn.isBN(e)){ha(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),ha(e.length>>>0===e.length);for(var a=0;a=0)){var I=this.g.mul(O);if(!I.isInfinity()){var P=I.getX(),q=P.umod(this.n);if(q.cmpn(0)!==0){var K=O.invm(this.n).mul(q.mul(t.getPrivate()).iadd(e));if(K=K.umod(this.n),K.cmpn(0)!==0){var Y=(I.getY().isOdd()?1:0)|(P.cmp(q)!==0?2:0);return n.canonical&&K.cmp(this.nh)>0&&(K=this.n.sub(K),Y^=1),new Vf({r:q,s:K,recoveryParam:Y})}}}}}};Ki.prototype.verify=function(e,t,i,n,a){a||(a={}),e=this._truncateToN(e,!1,a.msgBitLength),i=this.keyFromPublic(i,n),t=new Vf(t,"hex");var c=t.r,f=t.s;if(c.cmpn(1)<0||c.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var g=f.invm(this.n),d=g.mul(e).umod(this.n),m=g.mul(c).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(d,i.getPublic(),m),w.isInfinity()?!1:w.eqXToP(c)):(w=this.g.mulAdd(d,i.getPublic(),m),w.isInfinity()?!1:w.getX().umod(this.n).cmp(c)===0)};Ki.prototype.recoverPubKey=function(r,e,t,i){ha((3&t)===t,"The recovery param is more than two bits"),e=new Vf(e,i);var n=this.n,a=new pn(r),c=e.r,f=e.s,g=t&1,d=t>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?c=this.curve.pointFromX(c.add(this.curve.n),g):c=this.curve.pointFromX(c,g);var m=e.r.invm(n),w=n.sub(a).mul(m).umod(n),O=f.mul(m).umod(n);return this.g.mulAdd(w,c,O)};Ki.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Vf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(r,e,n)}catch{continue}if(a.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var Pc=Si,Jv=Pc.assert,K1=Pc.parseBytes,yo=Pc.cachedProperty;function Dr(r,e){this.eddsa=r,this._secret=K1(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=K1(e.pub)}Dr.fromPublic=function(e,t){return t instanceof Dr?t:new Dr(e,{pub:t})};Dr.fromSecret=function(e,t){return t instanceof Dr?t:new Dr(e,{secret:t})};Dr.prototype.secret=function(){return this._secret};yo(Dr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});yo(Dr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});yo(Dr,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n});yo(Dr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});yo(Dr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});yo(Dr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Dr.prototype.sign=function(e){return Jv(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Dr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};Dr.prototype.getSecret=function(e){return Jv(this._secret,"KeyPair is public only"),Pc.encode(this.secret(),e)};Dr.prototype.getPublic=function(e){return Pc.encode(this.pubBytes(),e)};var nE=Dr,sE=ws,Gf=Si,V1=Gf.assert,Jf=Gf.cachedProperty,aE=Gf.parseBytes;function Aa(r,e){this.eddsa=r,typeof e!="object"&&(e=aE(e)),Array.isArray(e)&&(V1(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),V1(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof sE&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Jf(Aa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Jf(Aa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Jf(Aa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Jf(Aa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Aa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Aa.prototype.toHex=function(){return Gf.encode(this.toBytes(),"hex").toUpperCase()};var oE=Aa,cE=kf,uE=jf,uo=Si,fE=uo.assert,Wv=uo.parseBytes,Yv=nE,G1=oE;function li(r){if(fE(r==="ed25519","only tested with ed25519 so far"),!(this instanceof li))return new li(r);r=uE[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=cE.sha512}var hE=li;li.prototype.sign=function(e,t){e=Wv(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),a=this.g.mul(n),c=this.encodePoint(a),f=this.hashInt(c,i.pubBytes(),e).mul(i.priv()),g=n.add(f).umod(this.curve.n);return this.makeSignature({R:a,S:g,Rencoded:c})};li.prototype.verify=function(e,t,i){if(e=Wv(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),c=this.g.mul(t.S()),f=t.R().add(n.pub().mul(a));return f.eq(c)};li.prototype.hashInt=function(){for(var e=this.hash(),t=0;t0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=g[m++],d--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(m=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,m,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=g[m++],d--;return this},f.prototype.finish=function(g){if(!this._finished){var d=this._bytesHashed,m=this._bufferLength,w=d/536870912|0,O=d<<3,I=d%128<112?128:256;this._buffer[m]=128;for(var P=m+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(g){t.wipe(g.stateHi),t.wipe(g.stateLo),g.buffer&&t.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},f}();r.SHA512=i;var n=new Int32Array([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]);function a(f,g,d,m,w,O,I){for(var P=d[0],q=d[1],K=d[2],Y=d[3],z=d[4],W=d[5],B=d[6],j=d[7],k=m[0],_=m[1],N=m[2],se=m[3],le=m[4],U=m[5],y=m[6],u=m[7],h,v,E,S,M,x,p,b;I>=128;){for(var R=0;R<16;R++){var Z=8*R+O;f[R]=e.readUint32BE(w,Z),g[R]=e.readUint32BE(w,Z+4)}for(var R=0;R<80;R++){var ae=P,C=q,ee=K,L=Y,V=z,G=W,D=B,H=j,ne=k,ce=_,fe=N,ye=se,we=le,Te=U,Qe=y,Ce=u;if(h=j,v=u,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=(z>>>14|le<<18)^(z>>>18|le<<14)^(le>>>9|z<<23),v=(le>>>14|z<<18)^(le>>>18|z<<14)^(z>>>9|le<<23),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=z&W^~z&B,v=le&U^~le&y,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=n[R*2],v=n[R*2+1],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=f[R%16],v=g[R%16],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,E=p&65535|b<<16,S=M&65535|x<<16,h=E,v=S,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=(P>>>28|k<<4)^(k>>>2|P<<30)^(k>>>7|P<<25),v=(k>>>28|P<<4)^(P>>>2|k<<30)^(P>>>7|k<<25),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,h=P&q^P&K^q&K,v=k&_^k&N^_&N,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,H=p&65535|b<<16,Ce=M&65535|x<<16,h=L,v=ye,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=E,v=S,M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,L=p&65535|b<<16,ye=M&65535|x<<16,q=ae,K=C,Y=ee,z=L,W=V,B=G,j=D,P=H,_=ne,N=ce,se=fe,le=ye,U=we,y=Te,u=Qe,k=Ce,R%16===15)for(var Z=0;Z<16;Z++)h=f[Z],v=g[Z],M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=f[(Z+9)%16],v=g[(Z+9)%16],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,E=f[(Z+1)%16],S=g[(Z+1)%16],h=(E>>>1|S<<31)^(E>>>8|S<<24)^E>>>7,v=(S>>>1|E<<31)^(S>>>8|E<<24)^(S>>>7|E<<25),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,E=f[(Z+14)%16],S=g[(Z+14)%16],h=(E>>>19|S<<13)^(S>>>29|E<<3)^E>>>6,v=(S>>>19|E<<13)^(E>>>29|S<<3)^(S>>>6|E<<26),M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,f[Z]=p&65535|b<<16,g[Z]=M&65535|x<<16}h=P,v=k,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[0],v=m[0],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[0]=P=p&65535|b<<16,m[0]=k=M&65535|x<<16,h=q,v=_,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[1],v=m[1],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[1]=q=p&65535|b<<16,m[1]=_=M&65535|x<<16,h=K,v=N,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[2],v=m[2],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[2]=K=p&65535|b<<16,m[2]=N=M&65535|x<<16,h=Y,v=se,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[3],v=m[3],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[3]=Y=p&65535|b<<16,m[3]=se=M&65535|x<<16,h=z,v=le,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[4],v=m[4],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[4]=z=p&65535|b<<16,m[4]=le=M&65535|x<<16,h=W,v=U,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[5],v=m[5],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[5]=W=p&65535|b<<16,m[5]=U=M&65535|x<<16,h=B,v=y,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[6],v=m[6],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[6]=B=p&65535|b<<16,m[6]=y=M&65535|x<<16,h=j,v=u,M=v&65535,x=v>>>16,p=h&65535,b=h>>>16,h=d[7],v=m[7],M+=v&65535,x+=v>>>16,p+=h&65535,b+=h>>>16,x+=M>>>16,p+=x>>>16,b+=p>>>16,d[7]=j=p&65535|b<<16,m[7]=u=M&65535|x<<16,O+=128,I-=128}return O}function c(f){var g=new i;g.update(f);var d=g.digest();return g.clean(),d}r.hash=c})(Qv);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=ks,t=Qv,i=xi;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(L){const V=new Float64Array(16);if(L)for(let G=0;G>16&1),G[ce-1]&=65535;G[15]=D[15]-32767-(G[14]>>16&1);const ne=G[15]>>16&1;G[14]&=65535,q(D,G,1-ne)}for(let H=0;H<16;H++)L[2*H]=D[H]&255,L[2*H+1]=D[H]>>8}function Y(L,V){let G=0;for(let D=0;D<32;D++)G|=L[D]^V[D];return(1&G-1>>>8)-1}function z(L,V){const G=new Uint8Array(32),D=new Uint8Array(32);return K(G,L),K(D,V),Y(G,D)}function W(L){const V=new Uint8Array(32);return K(V,L),V[0]&1}function B(L,V){for(let G=0;G<16;G++)L[G]=V[2*G]+(V[2*G+1]<<8);L[15]&=32767}function j(L,V,G){for(let D=0;D<16;D++)L[D]=V[D]+G[D]}function k(L,V,G){for(let D=0;D<16;D++)L[D]=V[D]-G[D]}function _(L,V,G){let D,H,ne=0,ce=0,fe=0,ye=0,we=0,Te=0,Qe=0,Ce=0,Re=0,Se=0,me=0,Pe=0,Ne=0,be=0,Oe=0,xe=0,ve=0,qe=0,Me=0,_e=0,He=0,Ve=0,Ee=0,Ke=0,ht=0,Ge=0,_t=0,lt=0,We=0,Et=0,St=0,Be=G[0],Xe=G[1],tt=G[2],$e=G[3],et=G[4],Ze=G[5],Fe=G[6],ut=G[7],rt=G[8],ze=G[9],it=G[10],st=G[11],Ue=G[12],Ye=G[13],ft=G[14],je=G[15];D=V[0],ne+=D*Be,ce+=D*Xe,fe+=D*tt,ye+=D*$e,we+=D*et,Te+=D*Ze,Qe+=D*Fe,Ce+=D*ut,Re+=D*rt,Se+=D*ze,me+=D*it,Pe+=D*st,Ne+=D*Ue,be+=D*Ye,Oe+=D*ft,xe+=D*je,D=V[1],ce+=D*Be,fe+=D*Xe,ye+=D*tt,we+=D*$e,Te+=D*et,Qe+=D*Ze,Ce+=D*Fe,Re+=D*ut,Se+=D*rt,me+=D*ze,Pe+=D*it,Ne+=D*st,be+=D*Ue,Oe+=D*Ye,xe+=D*ft,ve+=D*je,D=V[2],fe+=D*Be,ye+=D*Xe,we+=D*tt,Te+=D*$e,Qe+=D*et,Ce+=D*Ze,Re+=D*Fe,Se+=D*ut,me+=D*rt,Pe+=D*ze,Ne+=D*it,be+=D*st,Oe+=D*Ue,xe+=D*Ye,ve+=D*ft,qe+=D*je,D=V[3],ye+=D*Be,we+=D*Xe,Te+=D*tt,Qe+=D*$e,Ce+=D*et,Re+=D*Ze,Se+=D*Fe,me+=D*ut,Pe+=D*rt,Ne+=D*ze,be+=D*it,Oe+=D*st,xe+=D*Ue,ve+=D*Ye,qe+=D*ft,Me+=D*je,D=V[4],we+=D*Be,Te+=D*Xe,Qe+=D*tt,Ce+=D*$e,Re+=D*et,Se+=D*Ze,me+=D*Fe,Pe+=D*ut,Ne+=D*rt,be+=D*ze,Oe+=D*it,xe+=D*st,ve+=D*Ue,qe+=D*Ye,Me+=D*ft,_e+=D*je,D=V[5],Te+=D*Be,Qe+=D*Xe,Ce+=D*tt,Re+=D*$e,Se+=D*et,me+=D*Ze,Pe+=D*Fe,Ne+=D*ut,be+=D*rt,Oe+=D*ze,xe+=D*it,ve+=D*st,qe+=D*Ue,Me+=D*Ye,_e+=D*ft,He+=D*je,D=V[6],Qe+=D*Be,Ce+=D*Xe,Re+=D*tt,Se+=D*$e,me+=D*et,Pe+=D*Ze,Ne+=D*Fe,be+=D*ut,Oe+=D*rt,xe+=D*ze,ve+=D*it,qe+=D*st,Me+=D*Ue,_e+=D*Ye,He+=D*ft,Ve+=D*je,D=V[7],Ce+=D*Be,Re+=D*Xe,Se+=D*tt,me+=D*$e,Pe+=D*et,Ne+=D*Ze,be+=D*Fe,Oe+=D*ut,xe+=D*rt,ve+=D*ze,qe+=D*it,Me+=D*st,_e+=D*Ue,He+=D*Ye,Ve+=D*ft,Ee+=D*je,D=V[8],Re+=D*Be,Se+=D*Xe,me+=D*tt,Pe+=D*$e,Ne+=D*et,be+=D*Ze,Oe+=D*Fe,xe+=D*ut,ve+=D*rt,qe+=D*ze,Me+=D*it,_e+=D*st,He+=D*Ue,Ve+=D*Ye,Ee+=D*ft,Ke+=D*je,D=V[9],Se+=D*Be,me+=D*Xe,Pe+=D*tt,Ne+=D*$e,be+=D*et,Oe+=D*Ze,xe+=D*Fe,ve+=D*ut,qe+=D*rt,Me+=D*ze,_e+=D*it,He+=D*st,Ve+=D*Ue,Ee+=D*Ye,Ke+=D*ft,ht+=D*je,D=V[10],me+=D*Be,Pe+=D*Xe,Ne+=D*tt,be+=D*$e,Oe+=D*et,xe+=D*Ze,ve+=D*Fe,qe+=D*ut,Me+=D*rt,_e+=D*ze,He+=D*it,Ve+=D*st,Ee+=D*Ue,Ke+=D*Ye,ht+=D*ft,Ge+=D*je,D=V[11],Pe+=D*Be,Ne+=D*Xe,be+=D*tt,Oe+=D*$e,xe+=D*et,ve+=D*Ze,qe+=D*Fe,Me+=D*ut,_e+=D*rt,He+=D*ze,Ve+=D*it,Ee+=D*st,Ke+=D*Ue,ht+=D*Ye,Ge+=D*ft,_t+=D*je,D=V[12],Ne+=D*Be,be+=D*Xe,Oe+=D*tt,xe+=D*$e,ve+=D*et,qe+=D*Ze,Me+=D*Fe,_e+=D*ut,He+=D*rt,Ve+=D*ze,Ee+=D*it,Ke+=D*st,ht+=D*Ue,Ge+=D*Ye,_t+=D*ft,lt+=D*je,D=V[13],be+=D*Be,Oe+=D*Xe,xe+=D*tt,ve+=D*$e,qe+=D*et,Me+=D*Ze,_e+=D*Fe,He+=D*ut,Ve+=D*rt,Ee+=D*ze,Ke+=D*it,ht+=D*st,Ge+=D*Ue,_t+=D*Ye,lt+=D*ft,We+=D*je,D=V[14],Oe+=D*Be,xe+=D*Xe,ve+=D*tt,qe+=D*$e,Me+=D*et,_e+=D*Ze,He+=D*Fe,Ve+=D*ut,Ee+=D*rt,Ke+=D*ze,ht+=D*it,Ge+=D*st,_t+=D*Ue,lt+=D*Ye,We+=D*ft,Et+=D*je,D=V[15],xe+=D*Be,ve+=D*Xe,qe+=D*tt,Me+=D*$e,_e+=D*et,He+=D*Ze,Ve+=D*Fe,Ee+=D*ut,Ke+=D*rt,ht+=D*ze,Ge+=D*it,_t+=D*st,lt+=D*Ue,We+=D*Ye,Et+=D*ft,St+=D*je,ne+=38*ve,ce+=38*qe,fe+=38*Me,ye+=38*_e,we+=38*He,Te+=38*Ve,Qe+=38*Ee,Ce+=38*Ke,Re+=38*ht,Se+=38*Ge,me+=38*_t,Pe+=38*lt,Ne+=38*We,be+=38*Et,Oe+=38*St,H=1,D=ne+H+65535,H=Math.floor(D/65536),ne=D-H*65536,D=ce+H+65535,H=Math.floor(D/65536),ce=D-H*65536,D=fe+H+65535,H=Math.floor(D/65536),fe=D-H*65536,D=ye+H+65535,H=Math.floor(D/65536),ye=D-H*65536,D=we+H+65535,H=Math.floor(D/65536),we=D-H*65536,D=Te+H+65535,H=Math.floor(D/65536),Te=D-H*65536,D=Qe+H+65535,H=Math.floor(D/65536),Qe=D-H*65536,D=Ce+H+65535,H=Math.floor(D/65536),Ce=D-H*65536,D=Re+H+65535,H=Math.floor(D/65536),Re=D-H*65536,D=Se+H+65535,H=Math.floor(D/65536),Se=D-H*65536,D=me+H+65535,H=Math.floor(D/65536),me=D-H*65536,D=Pe+H+65535,H=Math.floor(D/65536),Pe=D-H*65536,D=Ne+H+65535,H=Math.floor(D/65536),Ne=D-H*65536,D=be+H+65535,H=Math.floor(D/65536),be=D-H*65536,D=Oe+H+65535,H=Math.floor(D/65536),Oe=D-H*65536,D=xe+H+65535,H=Math.floor(D/65536),xe=D-H*65536,ne+=H-1+37*(H-1),H=1,D=ne+H+65535,H=Math.floor(D/65536),ne=D-H*65536,D=ce+H+65535,H=Math.floor(D/65536),ce=D-H*65536,D=fe+H+65535,H=Math.floor(D/65536),fe=D-H*65536,D=ye+H+65535,H=Math.floor(D/65536),ye=D-H*65536,D=we+H+65535,H=Math.floor(D/65536),we=D-H*65536,D=Te+H+65535,H=Math.floor(D/65536),Te=D-H*65536,D=Qe+H+65535,H=Math.floor(D/65536),Qe=D-H*65536,D=Ce+H+65535,H=Math.floor(D/65536),Ce=D-H*65536,D=Re+H+65535,H=Math.floor(D/65536),Re=D-H*65536,D=Se+H+65535,H=Math.floor(D/65536),Se=D-H*65536,D=me+H+65535,H=Math.floor(D/65536),me=D-H*65536,D=Pe+H+65535,H=Math.floor(D/65536),Pe=D-H*65536,D=Ne+H+65535,H=Math.floor(D/65536),Ne=D-H*65536,D=be+H+65535,H=Math.floor(D/65536),be=D-H*65536,D=Oe+H+65535,H=Math.floor(D/65536),Oe=D-H*65536,D=xe+H+65535,H=Math.floor(D/65536),xe=D-H*65536,ne+=H-1+37*(H-1),L[0]=ne,L[1]=ce,L[2]=fe,L[3]=ye,L[4]=we,L[5]=Te,L[6]=Qe,L[7]=Ce,L[8]=Re,L[9]=Se,L[10]=me,L[11]=Pe,L[12]=Ne,L[13]=be,L[14]=Oe,L[15]=xe}function N(L,V){_(L,V,V)}function se(L,V){const G=n();let D;for(D=0;D<16;D++)G[D]=V[D];for(D=253;D>=0;D--)N(G,G),D!==2&&D!==4&&_(G,G,V);for(D=0;D<16;D++)L[D]=G[D]}function le(L,V){const G=n();let D;for(D=0;D<16;D++)G[D]=V[D];for(D=250;D>=0;D--)N(G,G),D!==1&&_(G,G,V);for(D=0;D<16;D++)L[D]=G[D]}function U(L,V){const G=n(),D=n(),H=n(),ne=n(),ce=n(),fe=n(),ye=n(),we=n(),Te=n();k(G,L[1],L[0]),k(Te,V[1],V[0]),_(G,G,Te),j(D,L[0],L[1]),j(Te,V[0],V[1]),_(D,D,Te),_(H,L[3],V[3]),_(H,H,d),_(ne,L[2],V[2]),j(ne,ne,ne),k(ce,D,G),k(fe,ne,H),j(ye,ne,H),j(we,D,G),_(L[0],ce,fe),_(L[1],we,ye),_(L[2],ye,fe),_(L[3],ce,we)}function y(L,V,G){for(let D=0;D<4;D++)q(L[D],V[D],G)}function u(L,V){const G=n(),D=n(),H=n();se(H,V[2]),_(G,V[0],H),_(D,V[1],H),K(L,D),L[31]^=W(G)<<7}function h(L,V,G){I(L[0],c),I(L[1],f),I(L[2],f),I(L[3],c);for(let D=255;D>=0;--D){const H=G[D/8|0]>>(D&7)&1;y(L,V,H),U(V,L),U(L,L),y(L,V,H)}}function v(L,V){const G=[n(),n(),n(),n()];I(G[0],m),I(G[1],w),I(G[2],f),_(G[3],m,w),h(L,G,V)}function E(L){if(L.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const V=(0,t.hash)(L);V[0]&=248,V[31]&=127,V[31]|=64;const G=new Uint8Array(32),D=[n(),n(),n(),n()];v(D,V),u(G,D);const H=new Uint8Array(64);return H.set(L),H.set(G,32),{publicKey:G,secretKey:H}}r.generateKeyPairFromSeed=E;function S(L){const V=(0,e.randomBytes)(32,L),G=E(V);return(0,i.wipe)(V),G}r.generateKeyPair=S;function M(L){if(L.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(L.subarray(32))}r.extractPublicKeyFromSecretKey=M;const x=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function p(L,V){let G,D,H,ne;for(D=63;D>=32;--D){for(G=0,H=D-32,ne=D-12;H>4)*x[H],G=V[H]>>8,V[H]&=255;for(H=0;H<32;H++)V[H]-=G*x[H];for(D=0;D<32;D++)V[D+1]+=V[D]>>8,L[D]=V[D]&255}function b(L){const V=new Float64Array(64);for(let G=0;G<64;G++)V[G]=L[G];for(let G=0;G<64;G++)L[G]=0;p(L,V)}function R(L,V){const G=new Float64Array(64),D=[n(),n(),n(),n()],H=(0,t.hash)(L.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const ne=new Uint8Array(64);ne.set(H.subarray(32),32);const ce=new t.SHA512;ce.update(ne.subarray(32)),ce.update(V);const fe=ce.digest();ce.clean(),b(fe),v(D,fe),u(ne,D),ce.reset(),ce.update(ne.subarray(0,32)),ce.update(L.subarray(32)),ce.update(V);const ye=ce.digest();b(ye);for(let we=0;we<32;we++)G[we]=fe[we];for(let we=0;we<32;we++)for(let Te=0;Te<32;Te++)G[we+Te]+=ye[we]*H[Te];return p(ne.subarray(32),G),ne}r.sign=R;function Z(L,V){const G=n(),D=n(),H=n(),ne=n(),ce=n(),fe=n(),ye=n();return I(L[2],f),B(L[1],V),N(H,L[1]),_(ne,H,g),k(H,H,L[2]),j(ne,L[2],ne),N(ce,ne),N(fe,ce),_(ye,fe,ce),_(G,ye,H),_(G,G,ne),le(G,G),_(G,G,H),_(G,G,ne),_(G,G,ne),_(L[0],G,ne),N(D,L[0]),_(D,D,ne),z(D,H)&&_(L[0],L[0],O),N(D,L[0]),_(D,D,ne),z(D,H)?-1:(W(L[0])===V[31]>>7&&k(L[0],c,L[0]),_(L[3],L[0],L[1]),0)}function ae(L,V,G){const D=new Uint8Array(32),H=[n(),n(),n(),n()],ne=[n(),n(),n(),n()];if(G.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(Z(ne,L))return!1;const ce=new t.SHA512;ce.update(G.subarray(0,32)),ce.update(L),ce.update(V);const fe=ce.digest();return b(fe),h(H,ne,fe),v(ne,G.subarray(32)),U(H,ne),u(D,H),!Y(G,D)}r.verify=ae;function C(L){let V=[n(),n(),n(),n()];if(Z(V,L))throw new Error("Ed25519: invalid public key");let G=n(),D=n(),H=V[1];j(G,f,H),k(D,f,H),se(D,D),_(G,G,D);let ne=new Uint8Array(32);return K(ne,G),ne}r.convertPublicKeyToX25519=C;function ee(L){const V=(0,t.hash)(L.subarray(0,32));V[0]&=248,V[31]&=127,V[31]|=64;const G=new Uint8Array(V.subarray(0,32));return(0,i.wipe)(V),G}r.convertSecretKeyToX25519=ee})(t0);const lE="EdDSA",dE="JWT",mf=".",Wf="base64url",Xv="utf8",Zv="utf8",pE=":",gE="did",bE="key",J1="base58btc",vE="z",mE="K36",yE=32;function r0(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function e3(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?r0(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function wE(r,e){e||(e=r.reduce((n,a)=>n+a.length,0));const t=e3(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return r0(t)}function _E(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function I(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:I}}var DE=_E,EE=DE;const AE=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},xE=r=>new TextEncoder().encode(r),SE=r=>new TextDecoder().decode(r);let ME=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},IE=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return t3(this,e)}},CE=class{constructor(e){this.decoders=e}or(e){return t3(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const t3=(r,e)=>new CE({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});let PE=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ME(e,t,i),this.decoder=new IE(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Yf=({name:r,prefix:e,encode:t,decode:i})=>new PE(r,e,t,i),Oc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=EE(t,e);return Yf({prefix:r,name:e,encode:i,decode:a=>AE(n(a))})},OE=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},TE=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<Yf({prefix:e,name:r,encode(n){return TE(n,i,t)},decode(n){return OE(n,i,t,r)}}),RE=Yf({prefix:"\0",name:"identity",encode:r=>SE(r),decode:r=>xE(r)}),NE=Object.freeze(Object.defineProperty({__proto__:null,identity:RE},Symbol.toStringTag,{value:"Module"})),BE=Pr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),$E=Object.freeze(Object.defineProperty({__proto__:null,base2:BE},Symbol.toStringTag,{value:"Module"})),UE=Pr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),qE=Object.freeze(Object.defineProperty({__proto__:null,base8:UE},Symbol.toStringTag,{value:"Module"})),LE=Oc({prefix:"9",name:"base10",alphabet:"0123456789"}),FE=Object.freeze(Object.defineProperty({__proto__:null,base10:LE},Symbol.toStringTag,{value:"Module"})),zE=Pr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jE=Pr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),kE=Object.freeze(Object.defineProperty({__proto__:null,base16:zE,base16upper:jE},Symbol.toStringTag,{value:"Module"})),HE=Pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KE=Pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),VE=Pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),GE=Pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),JE=Pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),WE=Pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YE=Pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QE=Pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XE=Pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ZE=Object.freeze(Object.defineProperty({__proto__:null,base32:HE,base32hex:JE,base32hexpad:YE,base32hexpadupper:QE,base32hexupper:WE,base32pad:VE,base32padupper:GE,base32upper:KE,base32z:XE},Symbol.toStringTag,{value:"Module"})),eA=Oc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tA=Oc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),rA=Object.freeze(Object.defineProperty({__proto__:null,base36:eA,base36upper:tA},Symbol.toStringTag,{value:"Module"})),iA=Oc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nA=Oc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),sA=Object.freeze(Object.defineProperty({__proto__:null,base58btc:iA,base58flickr:nA},Symbol.toStringTag,{value:"Module"})),aA=Pr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oA=Pr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cA=Pr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uA=Pr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),fA=Object.freeze(Object.defineProperty({__proto__:null,base64:aA,base64pad:oA,base64url:cA,base64urlpad:uA},Symbol.toStringTag,{value:"Module"})),r3=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),hA=r3.reduce((r,e,t)=>(r[t]=e,r),[]),lA=r3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function dA(r){return r.reduce((e,t)=>(e+=hA[t],e),"")}function pA(r){const e=[];for(const t of r){const i=lA[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const gA=Yf({prefix:"🚀",name:"base256emoji",encode:dA,decode:pA}),bA=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:gA},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const W1={...NE,...$E,...qE,...FE,...kE,...ZE,...rA,...sA,...fA,...bA};function i3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Y1=i3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pl=i3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=e3(r.length);for(let t=0;tJSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),mA=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function ya(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return mA(r)}catch{return r}}function ys(r){return typeof r=="string"?r:vA(r)||""}function Q1(r){return ya(Qf(wo(r,Wf),Xv))}function yf(r){return Qf(wo(ys(r),Xv),Wf)}function s3(r){const e=wo(mE,J1),t=vE+Qf(wE([e,r]),J1);return[gE,bE,t].join(pE)}function yA(r){return Qf(r,Wf)}function wA(r){return wo(r,Wf)}function _A(r){return wo([yf(r.header),yf(r.payload)].join(mf),Zv)}function DA(r){return[yf(r.header),yf(r.payload),yA(r.signature)].join(mf)}function yd(r){const e=r.split(mf),t=Q1(e[0]),i=Q1(e[1]),n=wA(e[2]),a=wo(e.slice(0,2).join(mf),Zv);return{header:t,payload:i,signature:n,data:a}}function X1(r=ks.randomBytes(yE)){return t0.generateKeyPairFromSeed(r)}async function EA(r,e,t,i,n=Ae.fromMiliseconds(Date.now())){const a={alg:lE,typ:dE},c=s3(i.publicKey),f=n+t,g={iss:c,sub:r,aud:e,iat:n,exp:f},d=_A({header:a,payload:g}),m=t0.sign(i.secretKey,d);return DA({header:a,payload:g,signature:m})}const AA={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var ba={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},xA={};const SA=":";function hc(r){const[e,t]=r.split(SA);return{namespace:e,reference:t}}function Z1(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function a3(r,e){return r.includes(":")?[r]:e.chains||[]}var MA=Object.defineProperty,eg=Object.getOwnPropertySymbols,IA=Object.prototype.hasOwnProperty,CA=Object.prototype.propertyIsEnumerable,tg=(r,e,t)=>e in r?MA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rg=(r,e)=>{for(var t in e||(e={}))IA.call(e,t)&&tg(r,t,e[t]);if(eg)for(var t of eg(e))CA.call(e,t)&&tg(r,t,e[t]);return r};const PA="ReactNative",_i={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},OA="js";function wf(){return typeof ba<"u"&&typeof ba.versions<"u"&&typeof ba.versions.node<"u"}function _o(){return!Rf()&&!!kd()&&navigator.product===PA}function Tc(){return!wf()&&!!kd()&&!!Rf()}function Rc(){return _o()?_i.reactNative:wf()?_i.node:Tc()?_i.browser:_i.unknown}function TA(){var r;try{return _o()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(r=globalThis.Application)==null?void 0:r.applicationId:void 0}catch{return}}function RA(r,e){let t=mc.parse(r);return t=rg(rg({},t),e),r=mc.stringify(t),r}function o3(){return av()||{name:"",description:"",url:"",icons:[""]}}function NA(){if(Rc()===_i.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:t,Version:i}=globalThis.Platform;return[t,i].join("-")}const r=w4();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function BA(){var r;const e=Rc();return e===_i.browser?[e,((r=sv())==null?void 0:r.host)||"unknown"].join(":"):e}function c3(r,e,t){const i=NA(),n=BA();return[[r,e].join("-"),[OA,t].join("-"),i,n].join("/")}function $A({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:a,useOnCloseEvent:c,bundleId:f}){const g=t.split("?"),d=c3(r,e,i),m={auth:n,ua:d,projectId:a,useOnCloseEvent:c||void 0,origin:f||void 0},w=RA(g[1]||"",m);return g[0]+"?"+w}function da(r,e){return r.filter(t=>e.includes(t)).length===r.length}function u3(r){return Object.fromEntries(r.entries())}function f3(r){return new Map(Object.entries(r))}function fa(r=Ae.FIVE_MINUTES,e){const t=Ae.toMiliseconds(r||Ae.FIVE_MINUTES);let i,n,a;return{resolve:c=>{a&&i&&(clearTimeout(a),i(c))},reject:c=>{a&&n&&(clearTimeout(a),n(c))},done:()=>new Promise((c,f)=>{a=setTimeout(()=>{f(new Error(e))},t),i=c,n=f})}}function io(r,e,t){return new Promise(async(i,n)=>{const a=setTimeout(()=>n(new Error(t)),e);try{const c=await r;i(c)}catch(c){n(c)}clearTimeout(a)})}function h3(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function UA(r){return h3("topic",r)}function qA(r){return h3("id",r)}function l3(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function br(r,e){return Ae.fromMiliseconds(Date.now()+Ae.toMiliseconds(r))}function Rs(r){return Date.now()>=Ae.toMiliseconds(r)}function xt(r,e){return`${r}${e?`:${e}`:""}`}function nf(r=[],e=[]){return[...new Set([...r,...e])]}async function LA({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,a=n==null?void 0:n.href;if(typeof a!="string")return;const c=FA(a,r,e),f=Rc();if(f===_i.browser){if(!((i=Rf())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}c.startsWith("https://")||c.startsWith("http://")?window.open(c,"_blank","noreferrer noopener"):window.open(c,jA()?"_blank":"_self","noreferrer noopener")}else f===_i.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(c)}catch(n){console.error(n)}}function FA(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const a=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${a}${kA(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function zA(r,e){let t="";try{if(Tc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function ig(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function ng(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function i0(){return typeof ba<"u"&&xA.IS_VITEST==="true"}function jA(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function kA(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function d3(r){return Buffer.from(r,"base64").toString("utf-8")}var p3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function HA(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var g3={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT -*/(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&typeof self=="object",c=!n.JS_SHA3_NO_NODE_JS&&typeof ga=="object"&&ga.versions&&ga.versions.node;c?n=p3:a&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,g=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),m=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],O=[1,256,65536,16777216],C=[6,1536,393216,100663296],P=[0,8,16,24],q=[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],K=[224,256,384,512],Y=[128,256],z=["hex","buffer","arrayBuffer","array","digest"],W={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),g&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(I){return typeof I=="object"&&I.buffer&&I.buffer.constructor===ArrayBuffer});for(var B=function(I,ee,L){return function(V){return new R(I,ee,I).update(V)[L]()}},j=function(I,ee,L){return function(V,G){return new R(I,ee,G).update(V)[L]()}},k=function(I,ee,L){return function(V,G,D,H){return h["cshake"+I].update(V,G,D,H)[L]()}},_=function(I,ee,L){return function(V,G,D,H){return h["kmac"+I].update(V,G,D,H)[L]()}},N=function(I,ee,L,V){for(var G=0;G>5,this.byteCount=this.blockCount<<2,this.outputBlocks=L>>5,this.extraBytes=(L&31)>>3;for(var V=0;V<50;++V)this.s[V]=0}R.prototype.update=function(I){if(this.finalized)throw new Error(t);var ee,L=typeof I;if(L!=="string"){if(L==="object"){if(I===null)throw new Error(e);if(g&&I.constructor===ArrayBuffer)I=new Uint8Array(I);else if(!Array.isArray(I)&&(!g||!ArrayBuffer.isView(I)))throw new Error(e)}else throw new Error(e);ee=!0}for(var V=this.blocks,G=this.byteCount,D=I.length,H=this.blockCount,ne=0,ce=this.s,fe,ye;ne>2]|=I[ne]<>2]|=ye<>2]|=(192|ye>>6)<>2]|=(128|ye&63)<=57344?(V[fe>>2]|=(224|ye>>12)<>2]|=(128|ye>>6&63)<>2]|=(128|ye&63)<>2]|=(240|ye>>18)<>2]|=(128|ye>>12&63)<>2]|=(128|ye>>6&63)<>2]|=(128|ye&63)<=G){for(this.start=fe-G,this.block=V[H],fe=0;fe>8,L=I&255;L>0;)G.unshift(L),I=I>>8,L=I&255,++V;return ee?G.push(V):G.unshift(V),this.update(G),G.length},R.prototype.encodeString=function(I){var ee,L=typeof I;if(L!=="string"){if(L==="object"){if(I===null)throw new Error(e);if(g&&I.constructor===ArrayBuffer)I=new Uint8Array(I);else if(!Array.isArray(I)&&(!g||!ArrayBuffer.isView(I)))throw new Error(e)}else throw new Error(e);ee=!0}var V=0,G=I.length;if(ee)V=G;else for(var D=0;D=57344?V+=3:(H=65536+((H&1023)<<10|I.charCodeAt(++D)&1023),V+=4)}return V+=this.encode(V*8),this.update(I),V},R.prototype.bytepad=function(I,ee){for(var L=this.encode(ee),V=0;V>2]|=this.padding[ee&3],this.lastByteIndex===this.byteCount)for(I[0]=I[L],ee=1;ee>4&15]+d[ne&15]+d[ne>>12&15]+d[ne>>8&15]+d[ne>>20&15]+d[ne>>16&15]+d[ne>>28&15]+d[ne>>24&15];D%I===0&&(ae(ee),G=0)}return V&&(ne=ee[G],H+=d[ne>>4&15]+d[ne&15],V>1&&(H+=d[ne>>12&15]+d[ne>>8&15]),V>2&&(H+=d[ne>>20&15]+d[ne>>16&15])),H},R.prototype.arrayBuffer=function(){this.finalize();var I=this.blockCount,ee=this.s,L=this.outputBlocks,V=this.extraBytes,G=0,D=0,H=this.outputBits>>3,ne;V?ne=new ArrayBuffer(L+1<<2):ne=new ArrayBuffer(H);for(var ce=new Uint32Array(ne);D>8&255,H[ne+2]=ce>>16&255,H[ne+3]=ce>>24&255;D%I===0&&ae(ee)}return V&&(ne=D<<2,ce=ee[G],H[ne]=ce&255,V>1&&(H[ne+1]=ce>>8&255),V>2&&(H[ne+2]=ce>>16&255)),H};function Z(I,ee,L){R.call(this,I,ee,L)}Z.prototype=new R,Z.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var ae=function(I){var ee,L,V,G,D,H,ne,ce,fe,ye,we,Te,Qe,Ce,Re,Se,me,Pe,Ne,be,Oe,xe,ve,qe,Me,_e,He,Ve,Ee,Ke,ht,Ge,_t,lt,We,Et,St,Be,Xe,tt,$e,et,Ze,Fe,ut,rt,ze,it,st,Ue,Ye,ft,je,Rt,Nt,at,vt,Rr,Nr,Br,$r,Ur,er;for(V=0;V<48;V+=2)G=I[0]^I[10]^I[20]^I[30]^I[40],D=I[1]^I[11]^I[21]^I[31]^I[41],H=I[2]^I[12]^I[22]^I[32]^I[42],ne=I[3]^I[13]^I[23]^I[33]^I[43],ce=I[4]^I[14]^I[24]^I[34]^I[44],fe=I[5]^I[15]^I[25]^I[35]^I[45],ye=I[6]^I[16]^I[26]^I[36]^I[46],we=I[7]^I[17]^I[27]^I[37]^I[47],Te=I[8]^I[18]^I[28]^I[38]^I[48],Qe=I[9]^I[19]^I[29]^I[39]^I[49],ee=Te^(H<<1|ne>>>31),L=Qe^(ne<<1|H>>>31),I[0]^=ee,I[1]^=L,I[10]^=ee,I[11]^=L,I[20]^=ee,I[21]^=L,I[30]^=ee,I[31]^=L,I[40]^=ee,I[41]^=L,ee=G^(ce<<1|fe>>>31),L=D^(fe<<1|ce>>>31),I[2]^=ee,I[3]^=L,I[12]^=ee,I[13]^=L,I[22]^=ee,I[23]^=L,I[32]^=ee,I[33]^=L,I[42]^=ee,I[43]^=L,ee=H^(ye<<1|we>>>31),L=ne^(we<<1|ye>>>31),I[4]^=ee,I[5]^=L,I[14]^=ee,I[15]^=L,I[24]^=ee,I[25]^=L,I[34]^=ee,I[35]^=L,I[44]^=ee,I[45]^=L,ee=ce^(Te<<1|Qe>>>31),L=fe^(Qe<<1|Te>>>31),I[6]^=ee,I[7]^=L,I[16]^=ee,I[17]^=L,I[26]^=ee,I[27]^=L,I[36]^=ee,I[37]^=L,I[46]^=ee,I[47]^=L,ee=ye^(G<<1|D>>>31),L=we^(D<<1|G>>>31),I[8]^=ee,I[9]^=L,I[18]^=ee,I[19]^=L,I[28]^=ee,I[29]^=L,I[38]^=ee,I[39]^=L,I[48]^=ee,I[49]^=L,Ce=I[0],Re=I[1],rt=I[11]<<4|I[10]>>>28,ze=I[10]<<4|I[11]>>>28,Ve=I[20]<<3|I[21]>>>29,Ee=I[21]<<3|I[20]>>>29,Br=I[31]<<9|I[30]>>>23,$r=I[30]<<9|I[31]>>>23,et=I[40]<<18|I[41]>>>14,Ze=I[41]<<18|I[40]>>>14,lt=I[2]<<1|I[3]>>>31,We=I[3]<<1|I[2]>>>31,Se=I[13]<<12|I[12]>>>20,me=I[12]<<12|I[13]>>>20,it=I[22]<<10|I[23]>>>22,st=I[23]<<10|I[22]>>>22,Ke=I[33]<<13|I[32]>>>19,ht=I[32]<<13|I[33]>>>19,Ur=I[42]<<2|I[43]>>>30,er=I[43]<<2|I[42]>>>30,Rt=I[5]<<30|I[4]>>>2,Nt=I[4]<<30|I[5]>>>2,Et=I[14]<<6|I[15]>>>26,St=I[15]<<6|I[14]>>>26,Pe=I[25]<<11|I[24]>>>21,Ne=I[24]<<11|I[25]>>>21,Ue=I[34]<<15|I[35]>>>17,Ye=I[35]<<15|I[34]>>>17,Ge=I[45]<<29|I[44]>>>3,_t=I[44]<<29|I[45]>>>3,qe=I[6]<<28|I[7]>>>4,Me=I[7]<<28|I[6]>>>4,at=I[17]<<23|I[16]>>>9,vt=I[16]<<23|I[17]>>>9,Be=I[26]<<25|I[27]>>>7,Xe=I[27]<<25|I[26]>>>7,be=I[36]<<21|I[37]>>>11,Oe=I[37]<<21|I[36]>>>11,ft=I[47]<<24|I[46]>>>8,je=I[46]<<24|I[47]>>>8,Fe=I[8]<<27|I[9]>>>5,ut=I[9]<<27|I[8]>>>5,_e=I[18]<<20|I[19]>>>12,He=I[19]<<20|I[18]>>>12,Rr=I[29]<<7|I[28]>>>25,Nr=I[28]<<7|I[29]>>>25,tt=I[38]<<8|I[39]>>>24,$e=I[39]<<8|I[38]>>>24,xe=I[48]<<14|I[49]>>>18,ve=I[49]<<14|I[48]>>>18,I[0]=Ce^~Se&Pe,I[1]=Re^~me&Ne,I[10]=qe^~_e&Ve,I[11]=Me^~He&Ee,I[20]=lt^~Et&Be,I[21]=We^~St&Xe,I[30]=Fe^~rt&it,I[31]=ut^~ze&st,I[40]=Rt^~at&Rr,I[41]=Nt^~vt&Nr,I[2]=Se^~Pe&be,I[3]=me^~Ne&Oe,I[12]=_e^~Ve&Ke,I[13]=He^~Ee&ht,I[22]=Et^~Be&tt,I[23]=St^~Xe&$e,I[32]=rt^~it&Ue,I[33]=ze^~st&Ye,I[42]=at^~Rr&Br,I[43]=vt^~Nr&$r,I[4]=Pe^~be&xe,I[5]=Ne^~Oe&ve,I[14]=Ve^~Ke&Ge,I[15]=Ee^~ht&_t,I[24]=Be^~tt&et,I[25]=Xe^~$e&Ze,I[34]=it^~Ue&ft,I[35]=st^~Ye&je,I[44]=Rr^~Br&Ur,I[45]=Nr^~$r&er,I[6]=be^~xe&Ce,I[7]=Oe^~ve&Re,I[16]=Ke^~Ge&qe,I[17]=ht^~_t&Me,I[26]=tt^~et<,I[27]=$e^~Ze&We,I[36]=Ue^~ft&Fe,I[37]=Ye^~je&ut,I[46]=Br^~Ur&Rt,I[47]=$r^~er&Nt,I[8]=xe^~Ce&Se,I[9]=ve^~Re&me,I[18]=Ge^~qe&_e,I[19]=_t^~Me&He,I[28]=et^~lt&Et,I[29]=Ze^~We&St,I[38]=ft^~Fe&rt,I[39]=je^~ut&ze,I[48]=Ur^~Rt&at,I[49]=er^~Nt&vt,I[0]^=q[V],I[1]^=q[V+1]};if(f)r.exports=h;else for(E=0;E{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(r){return r.message}return null}const og=GA();var yd;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(yd||(yd={}));var ln;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ln||(ln={}));const cg="0123456789abcdef";let Mr=class gr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();nf[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(ag>nf[i])&&console.log.apply(console,t)}debug(...e){this._log(gr.levels.DEBUG,e)}info(...e){this._log(gr.levels.INFO,e)}warn(...e){this._log(gr.levels.WARNING,e)}makeError(e,t,i){if(sg)return this.makeError("censored error",t,{});t||(t=gr.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(g=>{const d=i[g];try{if(d instanceof Uint8Array){let m="";for(let w=0;w>4],m+=cg[d[w]&15];n.push(g+"=Uint8Array(0x"+m+")")}else n.push(g+"="+JSON.stringify(d))}catch{n.push(g+"="+JSON.stringify(i[g].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;let c="";switch(t){case ln.NUMERIC_FAULT:{c="NUMERIC_FAULT";const g=e;switch(g){case"overflow":case"underflow":case"division-by-zero":c+="-"+g;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case ln.CALL_EXCEPTION:case ln.INSUFFICIENT_FUNDS:case ln.MISSING_NEW:case ln.NONCE_EXPIRED:case ln.REPLACEMENT_UNDERPRICED:case ln.TRANSACTION_REPLACED:case ln.UNPREDICTABLE_GAS_LIMIT:c=t;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=a,f.code=t,Object.keys(i).forEach(function(g){f[g]=i[g]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,gr.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){og&&this.throwError("platform missing String.prototype.normalize",gr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:og})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,gr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,gr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",et&&this.throwError("too many arguments"+i,gr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",gr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",gr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",gr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Pl||(Pl=new gr(VA)),Pl}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",gr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ng){if(!e)return;this.globalLogger().throwError("error censorship permanent",gr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sg=!!e,ng=!!t}static setLogLevel(e){const t=nf[e.toLowerCase()];if(t==null){gr.globalLogger().warn("invalid log level - "+e);return}ag=t}static from(e){return new gr(e)}};Mr.errors=ln,Mr.levels=yd;const JA="bytes/5.7.0",cr=new Mr(JA);function b3(r){return!!r.toHexString}function io(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return io(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function WA(r){return Ei(r)&&!(r.length%2)||_o(r)}function ug(r){return typeof r=="number"&&r==r&&r%1===0}function _o(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!ug(r.length)||r.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ir(r,e){if(e||(e={}),typeof r=="number"){cr.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),io(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),b3(r)&&(r=r.toHexString()),Ei(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":cr.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;nir(n)),t=e.reduce((n,a)=>n+a.length,0),i=new Uint8Array(t);return e.reduce((n,a)=>(i.set(a,n),n+a.length),0),io(i)}function QA(r,e){r=ir(r),r.length>e&&cr.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),io(t)}function Ei(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const Ol="0123456789abcdef";function ui(r,e){if(e||(e={}),typeof r=="number"){cr.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=Ol[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),b3(r))return r.toHexString();if(Ei(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":cr.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(_o(r)){let t="0x";for(let i=0;i>4]+Ol[n&15]}return t}return cr.throwArgumentError("invalid hexlify value","value",r)}function XA(r){if(typeof r!="string")r=ui(r);else if(!Ei(r)||r.length%2)return null;return(r.length-2)/2}function fg(r,e,t){return typeof r!="string"?r=ui(r):(!Ei(r)||r.length%2)&&cr.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function $n(r,e){for(typeof r!="string"?r=ui(r):Ei(r)||cr.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&cr.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function v3(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(WA(r)){let t=ir(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ui(t.slice(0,32)),e.s=ui(t.slice(32,64))):t.length===65?(e.r=ui(t.slice(0,32)),e.s=ui(t.slice(32,64)),e.v=t[64]):cr.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:cr.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ui(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=QA(ir(e._vs),32);e._vs=ui(n);const a=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=a:e.recoveryParam!==a&&cr.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const c=ui(n);e.s==null?e.s=c:e.s!==c&&cr.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?cr.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&cr.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Ei(e.r)?cr.throwArgumentError("signature missing or invalid r","signature",r):e.r=$n(e.r,32),e.s==null||!Ei(e.s)?cr.throwArgumentError("signature missing or invalid s","signature",r):e.s=$n(e.s,32);const t=ir(e.s);t[0]>=128&&cr.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ui(t);e._vs&&(Ei(e._vs)||cr.throwArgumentError("signature invalid _vs","signature",r),e._vs=$n(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&cr.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function i0(r){return"0x"+KA.keccak_256(ir(r))}var m3={exports:{}},ZA={},ex=Object.freeze({__proto__:null,default:ZA}),tx=HA(ex);(function(r){(function(e,t){function i(u,h){if(!u)throw new Error(h||"Assertion failed")}function n(u,h){u.super_=h;var v=function(){};v.prototype=h.prototype,u.prototype=new v,u.prototype.constructor=u}function a(u,h,v){if(a.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((h==="le"||h==="be")&&(v=h,h=10),this._init(u||0,h||10,v||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=tx.Buffer}catch{}a.isBN=function(u){return u instanceof a?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===a.wordSize&&Array.isArray(u.words)},a.max=function(u,h){return u.cmp(h)>0?u:h},a.min=function(u,h){return u.cmp(h)<0?u:h},a.prototype._init=function(u,h,v){if(typeof u=="number")return this._initNumber(u,h,v);if(typeof u=="object")return this._initArray(u,h,v);h==="hex"&&(h=16),i(h===(h|0)&&h>=2&&h<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E=0;E-=3)M=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[S]|=M<>>26-x&67108863,x+=24,x>=26&&(x-=26,S++);else if(v==="le")for(E=0,S=0;E>>26-x&67108863,x+=24,x>=26&&(x-=26,S++);return this._strip()};function f(u,h){var v=u.charCodeAt(h);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;i(!1,"Invalid character in "+u)}function g(u,h,v){var E=f(u,v);return v-1>=h&&(E|=f(u,v-1)<<4),E}a.prototype._parseHex=function(u,h,v){this.length=Math.ceil((u.length-h)/6),this.words=new Array(this.length);for(var E=0;E=h;E-=2)x=g(u,h,E)<=18?(S-=18,M+=1,this.words[M]|=x>>>26):S+=8;else{var p=u.length-h;for(E=p%2===0?h+1:h;E=18?(S-=18,M+=1,this.words[M]|=x>>>26):S+=8}this._strip()};function d(u,h,v,E){for(var S=0,M=0,x=Math.min(u.length,v),p=h;p=49?M=b-49+10:b>=17?M=b-17+10:M=b,i(b>=0&&M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{a.prototype.inspect=w}else a.prototype.inspect=w;function w(){return(this.red?""}var O=["","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"],C=[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],P=[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];a.prototype.toString=function(u,h){u=u||10,h=h|0||1;var v;if(u===16||u==="hex"){v="";for(var E=0,S=0,M=0;M>>24-E&16777215,E+=2,E>=26&&(E-=26,M--),S!==0||M!==this.length-1?v=O[6-p.length]+p+v:v=p+v}for(S!==0&&(v=S.toString(16)+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(u===(u|0)&&u>=2&&u<=36){var b=C[u],R=P[u];v="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ae=Z.modrn(R).toString(u);Z=Z.idivn(R),Z.isZero()?v=ae+v:v=O[b-ae.length]+ae+v}for(this.isZero()&&(v="0"+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},a.prototype.toJSON=function(){return this.toString(16,2)},c&&(a.prototype.toBuffer=function(u,h){return this.toArrayLike(c,u,h)}),a.prototype.toArray=function(u,h){return this.toArrayLike(Array,u,h)};var q=function(u,h){return u.allocUnsafe?u.allocUnsafe(h):new u(h)};a.prototype.toArrayLike=function(u,h,v){this._strip();var E=this.byteLength(),S=v||Math.max(1,E);i(E<=S,"byte array longer than desired length"),i(S>0,"Requested array length <= 0");var M=q(u,S),x=h==="le"?"LE":"BE";return this["_toArrayLike"+x](M,E),M},a.prototype._toArrayLikeLE=function(u,h){for(var v=0,E=0,S=0,M=0;S>8&255),v>16&255),M===6?(v>24&255),E=0,M=0):(E=x>>>24,M+=2)}if(v=0&&(u[v--]=x>>8&255),v>=0&&(u[v--]=x>>16&255),M===6?(v>=0&&(u[v--]=x>>24&255),E=0,M=0):(E=x>>>24,M+=2)}if(v>=0)for(u[v--]=E;v>=0;)u[v--]=0},Math.clz32?a.prototype._countBits=function(u){return 32-Math.clz32(u)}:a.prototype._countBits=function(u){var h=u,v=0;return h>=4096&&(v+=13,h>>>=13),h>=64&&(v+=7,h>>>=7),h>=8&&(v+=4,h>>>=4),h>=2&&(v+=2,h>>>=2),v+h},a.prototype._zeroBits=function(u){if(u===0)return 26;var h=u,v=0;return h&8191||(v+=13,h>>>=13),h&127||(v+=7,h>>>=7),h&15||(v+=4,h>>>=4),h&3||(v+=2,h>>>=2),h&1||v++,v},a.prototype.bitLength=function(){var u=this.words[this.length-1],h=this._countBits(u);return(this.length-1)*26+h};function K(u){for(var h=new Array(u.bitLength()),v=0;v>>S&1}return h}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,h=0;hu.length?this.clone().ior(u):u.clone().ior(this)},a.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},a.prototype.iuand=function(u){var h;this.length>u.length?h=u:h=this;for(var v=0;vu.length?this.clone().iand(u):u.clone().iand(this)},a.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},a.prototype.iuxor=function(u){var h,v;this.length>u.length?(h=this,v=u):(h=u,v=this);for(var E=0;Eu.length?this.clone().ixor(u):u.clone().ixor(this)},a.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},a.prototype.inotn=function(u){i(typeof u=="number"&&u>=0);var h=Math.ceil(u/26)|0,v=u%26;this._expand(h),v>0&&h--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-v),this._strip()},a.prototype.notn=function(u){return this.clone().inotn(u)},a.prototype.setn=function(u,h){i(typeof u=="number"&&u>=0);var v=u/26|0,E=u%26;return this._expand(v+1),h?this.words[v]=this.words[v]|1<u.length?(v=this,E=u):(v=u,E=this);for(var S=0,M=0;M>>26;for(;S!==0&&M>>26;if(this.length=v.length,S!==0)this.words[this.length]=S,this.length++;else if(v!==this)for(;Mu.length?this.clone().iadd(u):u.clone().iadd(this)},a.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var h=this.iadd(u);return u.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var v=this.cmp(u);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,S;v>0?(E=this,S=u):(E=u,S=this);for(var M=0,x=0;x>26,this.words[x]=h&67108863;for(;M!==0&&x>26,this.words[x]=h&67108863;if(M===0&&x>>26,ae=b&67108863,I=Math.min(R,h.length-1),ee=Math.max(0,R-u.length+1);ee<=I;ee++){var L=R-ee|0;S=u.words[L]|0,M=h.words[ee]|0,x=S*M+ae,Z+=x/67108864|0,ae=x&67108863}v.words[R]=ae|0,b=Z|0}return b!==0?v.words[R]=b|0:v.length--,v._strip()}var z=function(u,h,v){var E=u.words,S=h.words,M=v.words,x=0,p,b,R,Z=E[0]|0,ae=Z&8191,I=Z>>>13,ee=E[1]|0,L=ee&8191,V=ee>>>13,G=E[2]|0,D=G&8191,H=G>>>13,ne=E[3]|0,ce=ne&8191,fe=ne>>>13,ye=E[4]|0,we=ye&8191,Te=ye>>>13,Qe=E[5]|0,Ce=Qe&8191,Re=Qe>>>13,Se=E[6]|0,me=Se&8191,Pe=Se>>>13,Ne=E[7]|0,be=Ne&8191,Oe=Ne>>>13,xe=E[8]|0,ve=xe&8191,qe=xe>>>13,Me=E[9]|0,_e=Me&8191,He=Me>>>13,Ve=S[0]|0,Ee=Ve&8191,Ke=Ve>>>13,ht=S[1]|0,Ge=ht&8191,_t=ht>>>13,lt=S[2]|0,We=lt&8191,Et=lt>>>13,St=S[3]|0,Be=St&8191,Xe=St>>>13,tt=S[4]|0,$e=tt&8191,et=tt>>>13,Ze=S[5]|0,Fe=Ze&8191,ut=Ze>>>13,rt=S[6]|0,ze=rt&8191,it=rt>>>13,st=S[7]|0,Ue=st&8191,Ye=st>>>13,ft=S[8]|0,je=ft&8191,Rt=ft>>>13,Nt=S[9]|0,at=Nt&8191,vt=Nt>>>13;v.negative=u.negative^h.negative,v.length=19,p=Math.imul(ae,Ee),b=Math.imul(ae,Ke),b=b+Math.imul(I,Ee)|0,R=Math.imul(I,Ke);var Rr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,p=Math.imul(L,Ee),b=Math.imul(L,Ke),b=b+Math.imul(V,Ee)|0,R=Math.imul(V,Ke),p=p+Math.imul(ae,Ge)|0,b=b+Math.imul(ae,_t)|0,b=b+Math.imul(I,Ge)|0,R=R+Math.imul(I,_t)|0;var Nr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,p=Math.imul(D,Ee),b=Math.imul(D,Ke),b=b+Math.imul(H,Ee)|0,R=Math.imul(H,Ke),p=p+Math.imul(L,Ge)|0,b=b+Math.imul(L,_t)|0,b=b+Math.imul(V,Ge)|0,R=R+Math.imul(V,_t)|0,p=p+Math.imul(ae,We)|0,b=b+Math.imul(ae,Et)|0,b=b+Math.imul(I,We)|0,R=R+Math.imul(I,Et)|0;var Br=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Br>>>26)|0,Br&=67108863,p=Math.imul(ce,Ee),b=Math.imul(ce,Ke),b=b+Math.imul(fe,Ee)|0,R=Math.imul(fe,Ke),p=p+Math.imul(D,Ge)|0,b=b+Math.imul(D,_t)|0,b=b+Math.imul(H,Ge)|0,R=R+Math.imul(H,_t)|0,p=p+Math.imul(L,We)|0,b=b+Math.imul(L,Et)|0,b=b+Math.imul(V,We)|0,R=R+Math.imul(V,Et)|0,p=p+Math.imul(ae,Be)|0,b=b+Math.imul(ae,Xe)|0,b=b+Math.imul(I,Be)|0,R=R+Math.imul(I,Xe)|0;var $r=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+($r>>>26)|0,$r&=67108863,p=Math.imul(we,Ee),b=Math.imul(we,Ke),b=b+Math.imul(Te,Ee)|0,R=Math.imul(Te,Ke),p=p+Math.imul(ce,Ge)|0,b=b+Math.imul(ce,_t)|0,b=b+Math.imul(fe,Ge)|0,R=R+Math.imul(fe,_t)|0,p=p+Math.imul(D,We)|0,b=b+Math.imul(D,Et)|0,b=b+Math.imul(H,We)|0,R=R+Math.imul(H,Et)|0,p=p+Math.imul(L,Be)|0,b=b+Math.imul(L,Xe)|0,b=b+Math.imul(V,Be)|0,R=R+Math.imul(V,Xe)|0,p=p+Math.imul(ae,$e)|0,b=b+Math.imul(ae,et)|0,b=b+Math.imul(I,$e)|0,R=R+Math.imul(I,et)|0;var Ur=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,p=Math.imul(Ce,Ee),b=Math.imul(Ce,Ke),b=b+Math.imul(Re,Ee)|0,R=Math.imul(Re,Ke),p=p+Math.imul(we,Ge)|0,b=b+Math.imul(we,_t)|0,b=b+Math.imul(Te,Ge)|0,R=R+Math.imul(Te,_t)|0,p=p+Math.imul(ce,We)|0,b=b+Math.imul(ce,Et)|0,b=b+Math.imul(fe,We)|0,R=R+Math.imul(fe,Et)|0,p=p+Math.imul(D,Be)|0,b=b+Math.imul(D,Xe)|0,b=b+Math.imul(H,Be)|0,R=R+Math.imul(H,Xe)|0,p=p+Math.imul(L,$e)|0,b=b+Math.imul(L,et)|0,b=b+Math.imul(V,$e)|0,R=R+Math.imul(V,et)|0,p=p+Math.imul(ae,Fe)|0,b=b+Math.imul(ae,ut)|0,b=b+Math.imul(I,Fe)|0,R=R+Math.imul(I,ut)|0;var er=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(er>>>26)|0,er&=67108863,p=Math.imul(me,Ee),b=Math.imul(me,Ke),b=b+Math.imul(Pe,Ee)|0,R=Math.imul(Pe,Ke),p=p+Math.imul(Ce,Ge)|0,b=b+Math.imul(Ce,_t)|0,b=b+Math.imul(Re,Ge)|0,R=R+Math.imul(Re,_t)|0,p=p+Math.imul(we,We)|0,b=b+Math.imul(we,Et)|0,b=b+Math.imul(Te,We)|0,R=R+Math.imul(Te,Et)|0,p=p+Math.imul(ce,Be)|0,b=b+Math.imul(ce,Xe)|0,b=b+Math.imul(fe,Be)|0,R=R+Math.imul(fe,Xe)|0,p=p+Math.imul(D,$e)|0,b=b+Math.imul(D,et)|0,b=b+Math.imul(H,$e)|0,R=R+Math.imul(H,et)|0,p=p+Math.imul(L,Fe)|0,b=b+Math.imul(L,ut)|0,b=b+Math.imul(V,Fe)|0,R=R+Math.imul(V,ut)|0,p=p+Math.imul(ae,ze)|0,b=b+Math.imul(ae,it)|0,b=b+Math.imul(I,ze)|0,R=R+Math.imul(I,it)|0;var Xr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,p=Math.imul(be,Ee),b=Math.imul(be,Ke),b=b+Math.imul(Oe,Ee)|0,R=Math.imul(Oe,Ke),p=p+Math.imul(me,Ge)|0,b=b+Math.imul(me,_t)|0,b=b+Math.imul(Pe,Ge)|0,R=R+Math.imul(Pe,_t)|0,p=p+Math.imul(Ce,We)|0,b=b+Math.imul(Ce,Et)|0,b=b+Math.imul(Re,We)|0,R=R+Math.imul(Re,Et)|0,p=p+Math.imul(we,Be)|0,b=b+Math.imul(we,Xe)|0,b=b+Math.imul(Te,Be)|0,R=R+Math.imul(Te,Xe)|0,p=p+Math.imul(ce,$e)|0,b=b+Math.imul(ce,et)|0,b=b+Math.imul(fe,$e)|0,R=R+Math.imul(fe,et)|0,p=p+Math.imul(D,Fe)|0,b=b+Math.imul(D,ut)|0,b=b+Math.imul(H,Fe)|0,R=R+Math.imul(H,ut)|0,p=p+Math.imul(L,ze)|0,b=b+Math.imul(L,it)|0,b=b+Math.imul(V,ze)|0,R=R+Math.imul(V,it)|0,p=p+Math.imul(ae,Ue)|0,b=b+Math.imul(ae,Ye)|0,b=b+Math.imul(I,Ue)|0,R=R+Math.imul(I,Ye)|0;var Wi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,p=Math.imul(ve,Ee),b=Math.imul(ve,Ke),b=b+Math.imul(qe,Ee)|0,R=Math.imul(qe,Ke),p=p+Math.imul(be,Ge)|0,b=b+Math.imul(be,_t)|0,b=b+Math.imul(Oe,Ge)|0,R=R+Math.imul(Oe,_t)|0,p=p+Math.imul(me,We)|0,b=b+Math.imul(me,Et)|0,b=b+Math.imul(Pe,We)|0,R=R+Math.imul(Pe,Et)|0,p=p+Math.imul(Ce,Be)|0,b=b+Math.imul(Ce,Xe)|0,b=b+Math.imul(Re,Be)|0,R=R+Math.imul(Re,Xe)|0,p=p+Math.imul(we,$e)|0,b=b+Math.imul(we,et)|0,b=b+Math.imul(Te,$e)|0,R=R+Math.imul(Te,et)|0,p=p+Math.imul(ce,Fe)|0,b=b+Math.imul(ce,ut)|0,b=b+Math.imul(fe,Fe)|0,R=R+Math.imul(fe,ut)|0,p=p+Math.imul(D,ze)|0,b=b+Math.imul(D,it)|0,b=b+Math.imul(H,ze)|0,R=R+Math.imul(H,it)|0,p=p+Math.imul(L,Ue)|0,b=b+Math.imul(L,Ye)|0,b=b+Math.imul(V,Ue)|0,R=R+Math.imul(V,Ye)|0,p=p+Math.imul(ae,je)|0,b=b+Math.imul(ae,Rt)|0,b=b+Math.imul(I,je)|0,R=R+Math.imul(I,Rt)|0;var Zr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,p=Math.imul(_e,Ee),b=Math.imul(_e,Ke),b=b+Math.imul(He,Ee)|0,R=Math.imul(He,Ke),p=p+Math.imul(ve,Ge)|0,b=b+Math.imul(ve,_t)|0,b=b+Math.imul(qe,Ge)|0,R=R+Math.imul(qe,_t)|0,p=p+Math.imul(be,We)|0,b=b+Math.imul(be,Et)|0,b=b+Math.imul(Oe,We)|0,R=R+Math.imul(Oe,Et)|0,p=p+Math.imul(me,Be)|0,b=b+Math.imul(me,Xe)|0,b=b+Math.imul(Pe,Be)|0,R=R+Math.imul(Pe,Xe)|0,p=p+Math.imul(Ce,$e)|0,b=b+Math.imul(Ce,et)|0,b=b+Math.imul(Re,$e)|0,R=R+Math.imul(Re,et)|0,p=p+Math.imul(we,Fe)|0,b=b+Math.imul(we,ut)|0,b=b+Math.imul(Te,Fe)|0,R=R+Math.imul(Te,ut)|0,p=p+Math.imul(ce,ze)|0,b=b+Math.imul(ce,it)|0,b=b+Math.imul(fe,ze)|0,R=R+Math.imul(fe,it)|0,p=p+Math.imul(D,Ue)|0,b=b+Math.imul(D,Ye)|0,b=b+Math.imul(H,Ue)|0,R=R+Math.imul(H,Ye)|0,p=p+Math.imul(L,je)|0,b=b+Math.imul(L,Rt)|0,b=b+Math.imul(V,je)|0,R=R+Math.imul(V,Rt)|0,p=p+Math.imul(ae,at)|0,b=b+Math.imul(ae,vt)|0,b=b+Math.imul(I,at)|0,R=R+Math.imul(I,vt)|0;var Yi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,p=Math.imul(_e,Ge),b=Math.imul(_e,_t),b=b+Math.imul(He,Ge)|0,R=Math.imul(He,_t),p=p+Math.imul(ve,We)|0,b=b+Math.imul(ve,Et)|0,b=b+Math.imul(qe,We)|0,R=R+Math.imul(qe,Et)|0,p=p+Math.imul(be,Be)|0,b=b+Math.imul(be,Xe)|0,b=b+Math.imul(Oe,Be)|0,R=R+Math.imul(Oe,Xe)|0,p=p+Math.imul(me,$e)|0,b=b+Math.imul(me,et)|0,b=b+Math.imul(Pe,$e)|0,R=R+Math.imul(Pe,et)|0,p=p+Math.imul(Ce,Fe)|0,b=b+Math.imul(Ce,ut)|0,b=b+Math.imul(Re,Fe)|0,R=R+Math.imul(Re,ut)|0,p=p+Math.imul(we,ze)|0,b=b+Math.imul(we,it)|0,b=b+Math.imul(Te,ze)|0,R=R+Math.imul(Te,it)|0,p=p+Math.imul(ce,Ue)|0,b=b+Math.imul(ce,Ye)|0,b=b+Math.imul(fe,Ue)|0,R=R+Math.imul(fe,Ye)|0,p=p+Math.imul(D,je)|0,b=b+Math.imul(D,Rt)|0,b=b+Math.imul(H,je)|0,R=R+Math.imul(H,Rt)|0,p=p+Math.imul(L,at)|0,b=b+Math.imul(L,vt)|0,b=b+Math.imul(V,at)|0,R=R+Math.imul(V,vt)|0;var Qi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,p=Math.imul(_e,We),b=Math.imul(_e,Et),b=b+Math.imul(He,We)|0,R=Math.imul(He,Et),p=p+Math.imul(ve,Be)|0,b=b+Math.imul(ve,Xe)|0,b=b+Math.imul(qe,Be)|0,R=R+Math.imul(qe,Xe)|0,p=p+Math.imul(be,$e)|0,b=b+Math.imul(be,et)|0,b=b+Math.imul(Oe,$e)|0,R=R+Math.imul(Oe,et)|0,p=p+Math.imul(me,Fe)|0,b=b+Math.imul(me,ut)|0,b=b+Math.imul(Pe,Fe)|0,R=R+Math.imul(Pe,ut)|0,p=p+Math.imul(Ce,ze)|0,b=b+Math.imul(Ce,it)|0,b=b+Math.imul(Re,ze)|0,R=R+Math.imul(Re,it)|0,p=p+Math.imul(we,Ue)|0,b=b+Math.imul(we,Ye)|0,b=b+Math.imul(Te,Ue)|0,R=R+Math.imul(Te,Ye)|0,p=p+Math.imul(ce,je)|0,b=b+Math.imul(ce,Rt)|0,b=b+Math.imul(fe,je)|0,R=R+Math.imul(fe,Rt)|0,p=p+Math.imul(D,at)|0,b=b+Math.imul(D,vt)|0,b=b+Math.imul(H,at)|0,R=R+Math.imul(H,vt)|0;var ei=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(ei>>>26)|0,ei&=67108863,p=Math.imul(_e,Be),b=Math.imul(_e,Xe),b=b+Math.imul(He,Be)|0,R=Math.imul(He,Xe),p=p+Math.imul(ve,$e)|0,b=b+Math.imul(ve,et)|0,b=b+Math.imul(qe,$e)|0,R=R+Math.imul(qe,et)|0,p=p+Math.imul(be,Fe)|0,b=b+Math.imul(be,ut)|0,b=b+Math.imul(Oe,Fe)|0,R=R+Math.imul(Oe,ut)|0,p=p+Math.imul(me,ze)|0,b=b+Math.imul(me,it)|0,b=b+Math.imul(Pe,ze)|0,R=R+Math.imul(Pe,it)|0,p=p+Math.imul(Ce,Ue)|0,b=b+Math.imul(Ce,Ye)|0,b=b+Math.imul(Re,Ue)|0,R=R+Math.imul(Re,Ye)|0,p=p+Math.imul(we,je)|0,b=b+Math.imul(we,Rt)|0,b=b+Math.imul(Te,je)|0,R=R+Math.imul(Te,Rt)|0,p=p+Math.imul(ce,at)|0,b=b+Math.imul(ce,vt)|0,b=b+Math.imul(fe,at)|0,R=R+Math.imul(fe,vt)|0;var Mi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,p=Math.imul(_e,$e),b=Math.imul(_e,et),b=b+Math.imul(He,$e)|0,R=Math.imul(He,et),p=p+Math.imul(ve,Fe)|0,b=b+Math.imul(ve,ut)|0,b=b+Math.imul(qe,Fe)|0,R=R+Math.imul(qe,ut)|0,p=p+Math.imul(be,ze)|0,b=b+Math.imul(be,it)|0,b=b+Math.imul(Oe,ze)|0,R=R+Math.imul(Oe,it)|0,p=p+Math.imul(me,Ue)|0,b=b+Math.imul(me,Ye)|0,b=b+Math.imul(Pe,Ue)|0,R=R+Math.imul(Pe,Ye)|0,p=p+Math.imul(Ce,je)|0,b=b+Math.imul(Ce,Rt)|0,b=b+Math.imul(Re,je)|0,R=R+Math.imul(Re,Rt)|0,p=p+Math.imul(we,at)|0,b=b+Math.imul(we,vt)|0,b=b+Math.imul(Te,at)|0,R=R+Math.imul(Te,vt)|0;var Ii=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,p=Math.imul(_e,Fe),b=Math.imul(_e,ut),b=b+Math.imul(He,Fe)|0,R=Math.imul(He,ut),p=p+Math.imul(ve,ze)|0,b=b+Math.imul(ve,it)|0,b=b+Math.imul(qe,ze)|0,R=R+Math.imul(qe,it)|0,p=p+Math.imul(be,Ue)|0,b=b+Math.imul(be,Ye)|0,b=b+Math.imul(Oe,Ue)|0,R=R+Math.imul(Oe,Ye)|0,p=p+Math.imul(me,je)|0,b=b+Math.imul(me,Rt)|0,b=b+Math.imul(Pe,je)|0,R=R+Math.imul(Pe,Rt)|0,p=p+Math.imul(Ce,at)|0,b=b+Math.imul(Ce,vt)|0,b=b+Math.imul(Re,at)|0,R=R+Math.imul(Re,vt)|0;var lr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(lr>>>26)|0,lr&=67108863,p=Math.imul(_e,ze),b=Math.imul(_e,it),b=b+Math.imul(He,ze)|0,R=Math.imul(He,it),p=p+Math.imul(ve,Ue)|0,b=b+Math.imul(ve,Ye)|0,b=b+Math.imul(qe,Ue)|0,R=R+Math.imul(qe,Ye)|0,p=p+Math.imul(be,je)|0,b=b+Math.imul(be,Rt)|0,b=b+Math.imul(Oe,je)|0,R=R+Math.imul(Oe,Rt)|0,p=p+Math.imul(me,at)|0,b=b+Math.imul(me,vt)|0,b=b+Math.imul(Pe,at)|0,R=R+Math.imul(Pe,vt)|0;var Xi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,p=Math.imul(_e,Ue),b=Math.imul(_e,Ye),b=b+Math.imul(He,Ue)|0,R=Math.imul(He,Ye),p=p+Math.imul(ve,je)|0,b=b+Math.imul(ve,Rt)|0,b=b+Math.imul(qe,je)|0,R=R+Math.imul(qe,Rt)|0,p=p+Math.imul(be,at)|0,b=b+Math.imul(be,vt)|0,b=b+Math.imul(Oe,at)|0,R=R+Math.imul(Oe,vt)|0;var Zi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,p=Math.imul(_e,je),b=Math.imul(_e,Rt),b=b+Math.imul(He,je)|0,R=Math.imul(He,Rt),p=p+Math.imul(ve,at)|0,b=b+Math.imul(ve,vt)|0,b=b+Math.imul(qe,at)|0,R=R+Math.imul(qe,vt)|0;var en=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(en>>>26)|0,en&=67108863,p=Math.imul(_e,at),b=Math.imul(_e,vt),b=b+Math.imul(He,at)|0,R=Math.imul(He,vt);var Ks=(x+p|0)+((b&8191)<<13)|0;return x=(R+(b>>>13)|0)+(Ks>>>26)|0,Ks&=67108863,M[0]=Rr,M[1]=Nr,M[2]=Br,M[3]=$r,M[4]=Ur,M[5]=er,M[6]=Xr,M[7]=Wi,M[8]=Zr,M[9]=Yi,M[10]=Qi,M[11]=ei,M[12]=Mi,M[13]=Ii,M[14]=lr,M[15]=Xi,M[16]=Zi,M[17]=en,M[18]=Ks,x!==0&&(M[19]=x,v.length++),v};Math.imul||(z=Y);function W(u,h,v){v.negative=h.negative^u.negative,v.length=u.length+h.length;for(var E=0,S=0,M=0;M>>26)|0,S+=x>>>26,x&=67108863}v.words[M]=p,E=x,x=S}return E!==0?v.words[M]=E:v.length--,v._strip()}function B(u,h,v){return W(u,h,v)}a.prototype.mulTo=function(u,h){var v,E=this.length+u.length;return this.length===10&&u.length===10?v=z(this,u,h):E<63?v=Y(this,u,h):E<1024?v=W(this,u,h):v=B(this,u,h),v},a.prototype.mul=function(u){var h=new a(null);return h.words=new Array(this.length+u.length),this.mulTo(u,h)},a.prototype.mulf=function(u){var h=new a(null);return h.words=new Array(this.length+u.length),B(this,u,h)},a.prototype.imul=function(u){return this.clone().mulTo(u,this)},a.prototype.imuln=function(u){var h=u<0;h&&(u=-u),i(typeof u=="number"),i(u<67108864);for(var v=0,E=0;E>=26,v+=S/67108864|0,v+=M>>>26,this.words[E]=M&67108863}return v!==0&&(this.words[E]=v,this.length++),h?this.ineg():this},a.prototype.muln=function(u){return this.clone().imuln(u)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(u){var h=K(u);if(h.length===0)return new a(1);for(var v=this,E=0;E=0);var h=u%26,v=(u-h)/26,E=67108863>>>26-h<<26-h,S;if(h!==0){var M=0;for(S=0;S>>26-h}M&&(this.words[S]=M,this.length++)}if(v!==0){for(S=this.length-1;S>=0;S--)this.words[S+v]=this.words[S];for(S=0;S=0);var E;h?E=(h-h%26)/26:E=0;var S=u%26,M=Math.min((u-S)/26,this.length),x=67108863^67108863>>>S<M)for(this.length-=M,b=0;b=0&&(R!==0||b>=E);b--){var Z=this.words[b]|0;this.words[b]=R<<26-S|Z>>>S,R=Z&x}return p&&R!==0&&(p.words[p.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(u,h,v){return i(this.negative===0),this.iushrn(u,h,v)},a.prototype.shln=function(u){return this.clone().ishln(u)},a.prototype.ushln=function(u){return this.clone().iushln(u)},a.prototype.shrn=function(u){return this.clone().ishrn(u)},a.prototype.ushrn=function(u){return this.clone().iushrn(u)},a.prototype.testn=function(u){i(typeof u=="number"&&u>=0);var h=u%26,v=(u-h)/26,E=1<=0);var h=u%26,v=(u-h)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(h!==0&&v++,this.length=Math.min(v,this.length),h!==0){var E=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},a.prototype.isubn=function(u){if(i(typeof u=="number"),i(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(p/67108864|0),this.words[S+v]=M&67108863}for(;S>26,this.words[S+v]=M&67108863;if(x===0)return this._strip();for(i(x===-1),x=0,S=0;S>26,this.words[S]=M&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(u,h){var v=this.length-u.length,E=this.clone(),S=u,M=S.words[S.length-1]|0,x=this._countBits(M);v=26-x,v!==0&&(S=S.ushln(v),E.iushln(v),M=S.words[S.length-1]|0);var p=E.length-S.length,b;if(h!=="mod"){b=new a(null),b.length=p+1,b.words=new Array(b.length);for(var R=0;R=0;ae--){var I=(E.words[S.length+ae]|0)*67108864+(E.words[S.length+ae-1]|0);for(I=Math.min(I/M|0,67108863),E._ishlnsubmul(S,I,ae);E.negative!==0;)I--,E.negative=0,E._ishlnsubmul(S,1,ae),E.isZero()||(E.negative^=1);b&&(b.words[ae]=I)}return b&&b._strip(),E._strip(),h!=="div"&&v!==0&&E.iushrn(v),{div:b||null,mod:E}},a.prototype.divmod=function(u,h,v){if(i(!u.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var E,S,M;return this.negative!==0&&u.negative===0?(M=this.neg().divmod(u,h),h!=="mod"&&(E=M.div.neg()),h!=="div"&&(S=M.mod.neg(),v&&S.negative!==0&&S.iadd(u)),{div:E,mod:S}):this.negative===0&&u.negative!==0?(M=this.divmod(u.neg(),h),h!=="mod"&&(E=M.div.neg()),{div:E,mod:M.mod}):this.negative&u.negative?(M=this.neg().divmod(u.neg(),h),h!=="div"&&(S=M.mod.neg(),v&&S.negative!==0&&S.isub(u)),{div:M.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new a(0),mod:this}:u.length===1?h==="div"?{div:this.divn(u.words[0]),mod:null}:h==="mod"?{div:null,mod:new a(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new a(this.modrn(u.words[0]))}:this._wordDiv(u,h)},a.prototype.div=function(u){return this.divmod(u,"div",!1).div},a.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},a.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},a.prototype.divRound=function(u){var h=this.divmod(u);if(h.mod.isZero())return h.div;var v=h.div.negative!==0?h.mod.isub(u):h.mod,E=u.ushrn(1),S=u.andln(1),M=v.cmp(E);return M<0||S===1&&M===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},a.prototype.modrn=function(u){var h=u<0;h&&(u=-u),i(u<=67108863);for(var v=(1<<26)%u,E=0,S=this.length-1;S>=0;S--)E=(v*E+(this.words[S]|0))%u;return h?-E:E},a.prototype.modn=function(u){return this.modrn(u)},a.prototype.idivn=function(u){var h=u<0;h&&(u=-u),i(u<=67108863);for(var v=0,E=this.length-1;E>=0;E--){var S=(this.words[E]|0)+v*67108864;this.words[E]=S/u|0,v=S%u}return this._strip(),h?this.ineg():this},a.prototype.divn=function(u){return this.clone().idivn(u)},a.prototype.egcd=function(u){i(u.negative===0),i(!u.isZero());var h=this,v=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var E=new a(1),S=new a(0),M=new a(0),x=new a(1),p=0;h.isEven()&&v.isEven();)h.iushrn(1),v.iushrn(1),++p;for(var b=v.clone(),R=h.clone();!h.isZero();){for(var Z=0,ae=1;!(h.words[0]&ae)&&Z<26;++Z,ae<<=1);if(Z>0)for(h.iushrn(Z);Z-- >0;)(E.isOdd()||S.isOdd())&&(E.iadd(b),S.isub(R)),E.iushrn(1),S.iushrn(1);for(var I=0,ee=1;!(v.words[0]&ee)&&I<26;++I,ee<<=1);if(I>0)for(v.iushrn(I);I-- >0;)(M.isOdd()||x.isOdd())&&(M.iadd(b),x.isub(R)),M.iushrn(1),x.iushrn(1);h.cmp(v)>=0?(h.isub(v),E.isub(M),S.isub(x)):(v.isub(h),M.isub(E),x.isub(S))}return{a:M,b:x,gcd:v.iushln(p)}},a.prototype._invmp=function(u){i(u.negative===0),i(!u.isZero());var h=this,v=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var E=new a(1),S=new a(0),M=v.clone();h.cmpn(1)>0&&v.cmpn(1)>0;){for(var x=0,p=1;!(h.words[0]&p)&&x<26;++x,p<<=1);if(x>0)for(h.iushrn(x);x-- >0;)E.isOdd()&&E.iadd(M),E.iushrn(1);for(var b=0,R=1;!(v.words[0]&R)&&b<26;++b,R<<=1);if(b>0)for(v.iushrn(b);b-- >0;)S.isOdd()&&S.iadd(M),S.iushrn(1);h.cmp(v)>=0?(h.isub(v),E.isub(S)):(v.isub(h),S.isub(E))}var Z;return h.cmpn(1)===0?Z=E:Z=S,Z.cmpn(0)<0&&Z.iadd(u),Z},a.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var h=this.clone(),v=u.clone();h.negative=0,v.negative=0;for(var E=0;h.isEven()&&v.isEven();E++)h.iushrn(1),v.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;v.isEven();)v.iushrn(1);var S=h.cmp(v);if(S<0){var M=h;h=v,v=M}else if(S===0||v.cmpn(1)===0)break;h.isub(v)}while(!0);return v.iushln(E)},a.prototype.invm=function(u){return this.egcd(u).a.umod(u)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(u){return this.words[0]&u},a.prototype.bincn=function(u){i(typeof u=="number");var h=u%26,v=(u-h)/26,E=1<>>26,x&=67108863,this.words[M]=x}return S!==0&&(this.words[M]=S,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(u){var h=u<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var v;if(this.length>1)v=1;else{h&&(u=-u),i(u<=67108863,"Number is too big");var E=this.words[0]|0;v=E===u?0:Eu.length)return 1;if(this.length=0;v--){var E=this.words[v]|0,S=u.words[v]|0;if(E!==S){ES&&(h=1);break}}return h},a.prototype.gtn=function(u){return this.cmpn(u)===1},a.prototype.gt=function(u){return this.cmp(u)===1},a.prototype.gten=function(u){return this.cmpn(u)>=0},a.prototype.gte=function(u){return this.cmp(u)>=0},a.prototype.ltn=function(u){return this.cmpn(u)===-1},a.prototype.lt=function(u){return this.cmp(u)===-1},a.prototype.lten=function(u){return this.cmpn(u)<=0},a.prototype.lte=function(u){return this.cmp(u)<=0},a.prototype.eqn=function(u){return this.cmpn(u)===0},a.prototype.eq=function(u){return this.cmp(u)===0},a.red=function(u){return new U(u)},a.prototype.toRed=function(u){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(u){return this.red=u,this},a.prototype.forceRed=function(u){return i(!this.red,"Already a number in reduction context"),this._forceRed(u)},a.prototype.redAdd=function(u){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},a.prototype.redIAdd=function(u){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},a.prototype.redSub=function(u){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},a.prototype.redISub=function(u){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},a.prototype.redShl=function(u){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},a.prototype.redMul=function(u){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},a.prototype.redIMul=function(u){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(u){return i(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var j={k256:null,p224:null,p192:null,p25519:null};function k(u,h){this.name=u,this.p=new a(h,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var u=new a(null);return u.words=new Array(Math.ceil(this.n/13)),u},k.prototype.ireduce=function(u){var h=u,v;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),v=h.bitLength();while(v>this.n);var E=v0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},k.prototype.split=function(u,h){u.iushrn(this.n,0,h)},k.prototype.imulK=function(u){return u.imul(this.k)};function _(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,k),_.prototype.split=function(u,h){for(var v=4194303,E=Math.min(u.length,9),S=0;S>>22,M=x}M>>>=22,u.words[S-10]=M,M===0&&u.length>10?u.length-=10:u.length-=9},_.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var h=0,v=0;v>>=26,u.words[v]=S,h=E}return h!==0&&(u.words[u.length++]=h),u},a._prime=function(u){if(j[u])return j[u];var h;if(u==="k256")h=new _;else if(u==="p224")h=new N;else if(u==="p192")h=new se;else if(u==="p25519")h=new le;else throw new Error("Unknown prime "+u);return j[u]=h,h};function U(u){if(typeof u=="string"){var h=a._prime(u);this.m=h.p,this.prime=h}else i(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}U.prototype._verify1=function(u){i(u.negative===0,"red works only with positives"),i(u.red,"red works only with red numbers")},U.prototype._verify2=function(u,h){i((u.negative|h.negative)===0,"red works only with positives"),i(u.red&&u.red===h.red,"red works only with red numbers")},U.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(m(u,u.umod(this.m)._forceRed(this)),u)},U.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},U.prototype.add=function(u,h){this._verify2(u,h);var v=u.add(h);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},U.prototype.iadd=function(u,h){this._verify2(u,h);var v=u.iadd(h);return v.cmp(this.m)>=0&&v.isub(this.m),v},U.prototype.sub=function(u,h){this._verify2(u,h);var v=u.sub(h);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},U.prototype.isub=function(u,h){this._verify2(u,h);var v=u.isub(h);return v.cmpn(0)<0&&v.iadd(this.m),v},U.prototype.shl=function(u,h){return this._verify1(u),this.imod(u.ushln(h))},U.prototype.imul=function(u,h){return this._verify2(u,h),this.imod(u.imul(h))},U.prototype.mul=function(u,h){return this._verify2(u,h),this.imod(u.mul(h))},U.prototype.isqr=function(u){return this.imul(u,u.clone())},U.prototype.sqr=function(u){return this.mul(u,u)},U.prototype.sqrt=function(u){if(u.isZero())return u.clone();var h=this.m.andln(3);if(i(h%2===1),h===3){var v=this.m.add(new a(1)).iushrn(2);return this.pow(u,v)}for(var E=this.m.subn(1),S=0;!E.isZero()&&E.andln(1)===0;)S++,E.iushrn(1);i(!E.isZero());var M=new a(1).toRed(this),x=M.redNeg(),p=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new a(2*b*b).toRed(this);this.pow(b,p).cmp(x)!==0;)b.redIAdd(x);for(var R=this.pow(b,E),Z=this.pow(u,E.addn(1).iushrn(1)),ae=this.pow(u,E),I=S;ae.cmp(M)!==0;){for(var ee=ae,L=0;ee.cmp(M)!==0;L++)ee=ee.redSqr();i(L=0;S--){for(var R=h.words[S],Z=b-1;Z>=0;Z--){var ae=R>>Z&1;if(M!==E[0]&&(M=this.sqr(M)),ae===0&&x===0){p=0;continue}x<<=1,x|=ae,p++,!(p!==v&&(S!==0||Z!==0))&&(M=this.mul(M,E[x]),p=0,x=0)}b=26}return M},U.prototype.convertTo=function(u){var h=u.umod(this.m);return h===u?h.clone():h},U.prototype.convertFrom=function(u){var h=u.clone();return h.red=null,h},a.mont=function(u){return new y(u)};function y(u){U.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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)}n(y,U),y.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},y.prototype.convertFrom=function(u){var h=this.imod(u.mul(this.rinv));return h.red=null,h},y.prototype.imul=function(u,h){if(u.isZero()||h.isZero())return u.words[0]=0,u.length=1,u;var v=u.imul(h),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(E).iushrn(this.shift),M=S;return S.cmp(this.m)>=0?M=S.isub(this.m):S.cmpn(0)<0&&(M=S.iadd(this.m)),M._forceRed(this)},y.prototype.mul=function(u,h){if(u.isZero()||h.isZero())return new a(0)._forceRed(this);var v=u.mul(h),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(E).iushrn(this.shift),M=S;return S.cmp(this.m)>=0?M=S.isub(this.m):S.cmpn(0)<0&&(M=S.iadd(this.m)),M._forceRed(this)},y.prototype.invm=function(u){var h=this.imod(u._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(r,p3)})(m3);var bt=m3.exports;const y3="bignumber/5.7.0";var wf=bt.BN;const fs=new Mr(y3),Tl={},hg=9007199254740991;function rx(r){return r!=null&&(Gt.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Ei(r)||typeof r=="bigint"||_o(r))}let lg=!1;class Gt{constructor(e,t){e!==Tl&&fs.throwError("cannot call constructor directly; use BigNumber.from",Mr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ai(It(this).fromTwos(e))}toTwos(e){return ai(It(this).toTwos(e))}abs(){return this._hex[0]==="-"?Gt.from(this._hex.substring(1)):this}add(e){return ai(It(this).add(It(e)))}sub(e){return ai(It(this).sub(It(e)))}div(e){return Gt.from(e).isZero()&&Ui("division-by-zero","div"),ai(It(this).div(It(e)))}mul(e){return ai(It(this).mul(It(e)))}mod(e){const t=It(e);return t.isNeg()&&Ui("division-by-zero","mod"),ai(It(this).umod(t))}pow(e){const t=It(e);return t.isNeg()&&Ui("negative-power","pow"),ai(It(this).pow(t))}and(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","and"),ai(It(this).and(t))}or(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","or"),ai(It(this).or(t))}xor(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","xor"),ai(It(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ui("negative-width","mask"),ai(It(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ui("negative-width","shl"),ai(It(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ui("negative-width","shr"),ai(It(this).shrn(e))}eq(e){return It(this).eq(It(e))}lt(e){return It(this).lt(It(e))}lte(e){return It(this).lte(It(e))}gt(e){return It(this).gt(It(e))}gte(e){return It(this).gte(It(e))}isNegative(){return this._hex[0]==="-"}isZero(){return It(this).isZero()}toNumber(){try{return It(this).toNumber()}catch{Ui("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return fs.throwError("this platform does not support BigInt",Mr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?lg||(lg=!0,fs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?fs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Mr.errors.UNEXPECTED_ARGUMENT,{}):fs.throwError("BigNumber.toString does not accept parameters",Mr.errors.UNEXPECTED_ARGUMENT,{})),It(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Gt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Gt(Tl,mc(e)):e.match(/^-?[0-9]+$/)?new Gt(Tl,mc(new wf(e))):fs.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ui("underflow","BigNumber.from",e),(e>=hg||e<=-hg)&&Ui("overflow","BigNumber.from",e),Gt.from(String(e));const t=e;if(typeof t=="bigint")return Gt.from(t.toString());if(_o(t))return Gt.from(ui(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return Gt.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Ei(i)||i[0]==="-"&&Ei(i.substring(1))))return Gt.from(i)}return fs.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function mc(r){if(typeof r!="string")return mc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&fs.throwArgumentError("invalid hex","value",r),r=mc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function ai(r){return Gt.from(mc(r))}function It(r){const e=Gt.from(r).toHexString();return e[0]==="-"?new wf("-"+e.substring(3),16):new wf(e.substring(2),16)}function Ui(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),fs.throwError(r,Mr.errors.NUMERIC_FAULT,i)}function ix(r){return new wf(r,36).toString(16)}const Wr=new Mr(y3),hc={},w3=Gt.from(0),_3=Gt.from(-1);function D3(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),Wr.throwError(r,Mr.errors.NUMERIC_FAULT,n)}let lc="0";for(;lc.length<256;)lc+=lc;function n0(r){if(typeof r!="number")try{r=Gt.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+lc.substring(0,r):Wr.throwArgumentError("invalid decimal size","decimals",r)}function Rl(r,e){e==null&&(e=0);const t=n0(e);r=Gt.from(r);const i=r.lt(w3);i&&(r=r.mul(_3));let n=r.mod(t).toString();for(;n.length2&&Wr.throwArgumentError("too many decimal points","value",r);let a=n[0],c=n[1];for(a||(a="0"),c||(c="0");c[c.length-1]==="0";)c=c.substring(0,c.length-1);for(c.length>t.length-1&&D3("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.lengthe[c]==null?g:(typeof e[c]!==f&&Wr.throwArgumentError("invalid fixed format ("+c+" not "+f+")","format."+c,e[c]),e[c]);t=a("signed","boolean",t),i=a("width","number",i),n=a("decimals","number",n)}return i%8&&Wr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Wr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new wd(hc,t,i,n)}},E3=class Gr{constructor(e,t,i,n){e!==hc&&Wr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Mr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Wr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=as(this._value,this.format.decimals),i=as(e._value,e.format.decimals);return Gr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=as(this._value,this.format.decimals),i=as(e._value,e.format.decimals);return Gr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=as(this._value,this.format.decimals),i=as(e._value,e.format.decimals);return Gr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=as(this._value,this.format.decimals),i=as(e._value,e.format.decimals);return Gr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Gr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(dg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Gr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(dg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&Wr.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=Gr.from("1"+lc.substring(0,e),this.format),n=nx.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Wr.throwArgumentError("invalid byte width","width",e);const t=Gt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return $n(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Gr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!rx(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),Gr.fromString(Rl(e,t),Nl.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=Nl.from(t),n=as(e,i.decimals);!i.signed&&n.lt(w3)&&D3("unsigned value cannot be negative","overflow","value",e);let a=null;i.signed?a=n.toTwos(i.width).toHexString():(a=n.toHexString(),a=$n(a,i.width/8));const c=Rl(n,i.decimals);return new Gr(hc,a,c,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=Nl.from(t);if(ir(e).length>i.width/8)throw new Error("overflow");let n=Gt.from(e);i.signed&&(n=n.fromTwos(i.width));const a=n.toTwos((i.signed?0:1)+i.width).toHexString(),c=Rl(n,i.decimals);return new Gr(hc,a,c,i)}static from(e,t){if(typeof e=="string")return Gr.fromString(e,t);if(_o(e))return Gr.fromBytes(e,t);try{return Gr.fromValue(e,0,t)}catch(i){if(i.code!==Mr.errors.INVALID_ARGUMENT)throw i}return Wr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}};const dg=E3.from(1),nx=E3.from("0.5"),sx="strings/5.7.0",ax=new Mr(sx);var _f;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(_f||(_f={}));var pg;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(pg||(pg={}));function Bl(r,e=_f.current){e!=_f.current&&(ax.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const a=r.charCodeAt(i);if(i>=r.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const c=65536+((n&1023)<<10)+(a&1023);t.push(c>>18|240),t.push(c>>12&63|128),t.push(c>>6&63|128),t.push(c&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ir(t)}function ox(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t{let a=n.split(":");t+=parseInt(a[0],16),i[t]=e(a[1])}),i}function gg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}gg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),$l("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),$l("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),$l("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",ox),gg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function cx(r){r=atob(r);const e=[];for(let t=0;t0&&Array.isArray(f)?n(f,c-1):t.push(f)})};return n(r,e),t}function ux(r){const e={};for(let t=0;t>--g&1}const w=31,O=Math.pow(2,w),C=O>>>1,P=C>>1,q=O-1;let K=0;for(let j=0;j1;){let le=k+_>>>1;j>>1|m(),N=N<<1^C,se=(se^C)<<1|C|1;z=N,W=1+se-N}let B=i-4;return Y.map(j=>{switch(j-B){case 3:return B+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return B+256+(r[f++]<<8|r[f++]);case 1:return B+r[f++];default:return j-1}})}function hx(r){let e=0;return()=>r[e++]}function lx(r){return hx(fx(r))}function dx(r){return r&1?~r>>1:r>>1}function px(r,e){let t=Array(r);for(let i=0;ie[c]):t}function bx(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(mx(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(yx(t,r))}return ux(A3(e))}function vx(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function x3(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;ni[c].push(a));return i}function mx(r,e){let t=1+e(),i=e(),n=vx(e),a=x3(n.length,1+r,e);return A3(a.map((c,f)=>{const g=c[0],d=c.slice(1);return Array(n[f]).fill(void 0).map((m,w)=>{let O=w*i;return[g+w*t,d.map(C=>C+O)]})}))}function yx(r,e){let t=1+e();return x3(t,1+r,e).map(i=>[i[0],i.slice(1)])}function wx(r){let e=Df(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let d=Df(r,e);if(d.length==0)break;i.push({set:new Set(d),node:t()})}i.sort((d,m)=>m.set.size-d.set.size);let n=r(),a=n%3;n=n/3|0;let c=!!(n&1);n>>=1;let f=n==1,g=n==2;return{branches:i,valid:a,fe0f:c,save:f,check:g}}}function _x(){return lx(cx("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Hu=_x();new Set(Df(Hu)),new Set(Df(Hu)),bx(Hu),wx(Hu);const Dx=new Uint8Array(32);Dx.fill(0);const Ex=`Ethereum Signed Message: -`;function S3(r){return typeof r=="string"&&(r=Bl(r)),i0(YA([Bl(Ex),Bl(String(r.length)),r]))}const Ax="address/5.7.0",oc=new Mr(Ax);function vg(r){Ei(r,20)||oc.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ir(i0(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const xx=9007199254740991;function Sx(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const s0={};for(let r=0;r<10;r++)s0[String(r)]=String(r);for(let r=0;r<26;r++)s0[String.fromCharCode(65+r)]=String(10+r);const mg=Math.floor(Sx(xx));function Mx(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>s0[i]).join("");for(;e.length>=mg;){let i=e.substring(0,mg);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function Ix(r){let e=null;if(typeof r!="string"&&oc.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=vg(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&oc.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==Mx(r)&&oc.throwArgumentError("bad icap checksum","address",r),e=ix(r.substring(4));e.length<40;)e="0"+e;e=vg("0x"+e)}else oc.throwArgumentError("invalid address","address",r);return e}function Qo(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}const Cx=new Uint8Array(32);Cx.fill(0),Gt.from(-1);const Px=Gt.from(0),Ox=Gt.from(1);Gt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),$n(Ox.toHexString(),32),$n(Px.toHexString(),32);var Mn={},Pt={},Rc=M3;function M3(r,e){if(!r)throw new Error(e||"Assertion failed")}M3.equal=function(r,e,t){if(r!=e)throw new Error(t||"Assertion failed: "+r+" != "+e)};var _d={exports:{}};typeof Object.create=="function"?_d.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:_d.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}};var Tx=Rc,Rx=_d.exports;Pt.inherits=Rx;function Nx(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function Bx(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n>6|192,t[i++]=a&63|128):Nx(r,n)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=a>>18|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128,t[i++]=a&63|128):(t[i++]=a>>12|224,t[i++]=a>>6&63|128,t[i++]=a&63|128)}else for(n=0;n>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Pt.htonl=I3;function Ux(r,e){for(var t="",i=0;i>>0}return a}Pt.join32=qx;function Lx(r,e){for(var t=new Array(r.length*4),i=0,n=0;i>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}Pt.split32=Lx;function Fx(r,e){return r>>>e|r<<32-e}Pt.rotr32=Fx;function zx(r,e){return r<>>32-e}Pt.rotl32=zx;function jx(r,e){return r+e>>>0}Pt.sum32=jx;function kx(r,e,t){return r+e+t>>>0}Pt.sum32_3=kx;function Hx(r,e,t,i){return r+e+t+i>>>0}Pt.sum32_4=Hx;function Kx(r,e,t,i,n){return r+e+t+i+n>>>0}Pt.sum32_5=Kx;function Vx(r,e,t,i){var n=r[e],a=r[e+1],c=i+a>>>0,f=(c>>0,r[e+1]=c}Pt.sum64=Vx;function Gx(r,e,t,i){var n=e+i>>>0,a=(n>>0}Pt.sum64_hi=Gx;function Jx(r,e,t,i){var n=e+i;return n>>>0}Pt.sum64_lo=Jx;function Wx(r,e,t,i,n,a,c,f){var g=0,d=e;d=d+i>>>0,g+=d>>0,g+=d>>0,g+=d>>0}Pt.sum64_4_hi=Wx;function Yx(r,e,t,i,n,a,c,f){var g=e+i+a+f;return g>>>0}Pt.sum64_4_lo=Yx;function Qx(r,e,t,i,n,a,c,f,g,d){var m=0,w=e;w=w+i>>>0,m+=w>>0,m+=w>>0,m+=w>>0,m+=w>>0}Pt.sum64_5_hi=Qx;function Xx(r,e,t,i,n,a,c,f,g,d){var m=e+i+a+f+d;return m>>>0}Pt.sum64_5_lo=Xx;function Zx(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Pt.rotr64_hi=Zx;function eS(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Pt.rotr64_lo=eS;function tS(r,e,t){return r>>>t}Pt.shr64_hi=tS;function rS(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Pt.shr64_lo=rS;var Do={},yg=Pt,iS=Rc;function Ku(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Do.BlockHash=Ku,Ku.prototype.update=function(r,e){if(r=yg.toArray(r,e),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){r=this.pending;var t=r.length%this._delta8;this.pending=r.slice(r.length-t,r.length),this.pending.length===0&&(this.pending=null),r=yg.join32(r,0,r.length-t,this.endian);for(var i=0;i>>24&255,i[n++]=r>>>16&255,i[n++]=r>>>8&255,i[n++]=r&255}else for(i[n++]=r&255,i[n++]=r>>>8&255,i[n++]=r>>>16&255,i[n++]=r>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a>>3}Jn.g0_256=cS;function uS(r){return Un(r,17)^Un(r,19)^r>>>10}Jn.g1_256=uS;var uo=Pt,fS=Do,hS=Jn,Ul=uo.rotl32,Xo=uo.sum32,lS=uo.sum32_5,dS=hS.ft_1,N3=fS.BlockHash,pS=[1518500249,1859775393,2400959708,3395469782];function On(){if(!(this instanceof On))return new On;N3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}uo.inherits(On,N3);var gS=On;On.blockSize=512,On.outSize=160,On.hmacStrength=80,On.padLength=64,On.prototype._update=function(r,e){for(var t=this.W,i=0;i<16;i++)t[i]=r[e+i];for(;ithis.blockSize&&(r=new this.Hash().update(r).digest()),rM(r.length<=this.blockSize);for(var e=r.length;e>8,O=m&255;w?g.push(w,O):g.push(O)}return g}t.toArray=i;function n(c){return c.length===1?"0"+c:c}t.zero2=n;function a(c){for(var f="",g=0;g(O>>1)-1?q=(O>>1)-K:q=K,C.isubn(q)):q=0,w[P]=q,C.iushrn(1)}return w}t.getNAF=i;function n(g,d){var m=[[],[]];g=g.clone(),d=d.clone();for(var w=0,O=0,C;g.cmpn(-w)>0||d.cmpn(-O)>0;){var P=g.andln(3)+w&3,q=d.andln(3)+O&3;P===3&&(P=-1),q===3&&(q=-1);var K;P&1?(C=g.andln(7)+w&7,(C===3||C===5)&&q===2?K=-P:K=P):K=0,m[0].push(K);var Y;q&1?(C=d.andln(7)+O&7,(C===3||C===5)&&P===2?Y=-q:Y=q):Y=0,m[1].push(Y),2*w===K+1&&(w=1-w),2*O===Y+1&&(O=1-O),g.iushrn(1),d.iushrn(1)}return m}t.getJSF=n;function a(g,d,m){var w="_"+d;g.prototype[d]=function(){return this[w]!==void 0?this[w]:this[w]=m.call(this)}}t.cachedProperty=a;function c(g){return typeof g=="string"?t.toArray(g,"hex"):g}t.parseBytes=c;function f(g){return new bt(g,"hex","le")}t.intFromLE=f}),Gu=Ai.getNAF,sM=Ai.getJSF,Ef=Ai.assert;function $s(r,e){this.type=r,this.p=new bt(e.p,16),this.red=e.prime?bt.red(e.prime):bt.mont(this.p),this.zero=new bt(0).toRed(this.red),this.one=new bt(1).toRed(this.red),this.two=new bt(2).toRed(this.red),this.n=e.n&&new bt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Aa=$s;$s.prototype.point=function(){throw new Error("Not implemented")},$s.prototype.validate=function(){throw new Error("Not implemented")},$s.prototype._fixedNafMul=function(r,e){Ef(r.precomputed);var t=r._getDoubles(),i=Gu(e,1,this._bitLength),n=(1<=c;g--)f=(f<<1)+i[g];a.push(f)}for(var d=this.jpoint(null,null,null),m=this.jpoint(null,null,null),w=n;w>0;w--){for(c=0;c=0;f--){for(var g=0;f>=0&&a[f]===0;f--)g++;if(f>=0&&g++,c=c.dblp(g),f<0)break;var d=a[f];Ef(d!==0),r.type==="affine"?d>0?c=c.mixedAdd(n[d-1>>1]):c=c.mixedAdd(n[-d-1>>1].neg()):d>0?c=c.add(n[d-1>>1]):c=c.add(n[-d-1>>1].neg())}return r.type==="affine"?c.toP():c},$s.prototype._wnafMulAdd=function(r,e,t,i,n){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,g=0,d,m,w;for(d=0;d=1;d-=2){var C=d-1,P=d;if(a[C]!==1||a[P]!==1){f[C]=Gu(t[C],a[C],this._bitLength),f[P]=Gu(t[P],a[P],this._bitLength),g=Math.max(f[C].length,g),g=Math.max(f[P].length,g);continue}var q=[e[C],null,null,e[P]];e[C].y.cmp(e[P].y)===0?(q[1]=e[C].add(e[P]),q[2]=e[C].toJ().mixedAdd(e[P].neg())):e[C].y.cmp(e[P].y.redNeg())===0?(q[1]=e[C].toJ().mixedAdd(e[P]),q[2]=e[C].add(e[P].neg())):(q[1]=e[C].toJ().mixedAdd(e[P]),q[2]=e[C].toJ().mixedAdd(e[P].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],Y=sM(t[C],t[P]);for(g=Math.max(Y[0].length,g),f[C]=new Array(g),f[P]=new Array(g),m=0;m=0;d--){for(var k=0;d>=0;){var _=!0;for(m=0;m=0&&k++,B=B.dblp(k),d<0)break;for(m=0;m0?w=c[m][N-1>>1]:N<0&&(w=c[m][-N-1>>1].neg()),w.type==="affine"?B=B.mixedAdd(w):B=B.add(w))}}for(d=0;d=Math.ceil((r.bitLength()+1)/e.step):!1},qi.prototype._getDoubles=function(r,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var t=[this],i=this,n=0;n=0&&(O=g,C=d),m.negative&&(m=m.neg(),w=w.neg()),O.negative&&(O=O.neg(),C=C.neg()),[{a:m,b:w},{a:O,b:C}]},ki.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],i=e[1],n=i.b.mul(r).divRound(this.n),a=t.b.neg().mul(r).divRound(this.n),c=n.mul(t.a),f=a.mul(i.a),g=n.mul(t.b),d=a.mul(i.b),m=r.sub(c).sub(f),w=g.add(d).neg();return{k1:m,k2:w}},ki.prototype.pointFromX=function(r,e){r=new bt(r,16),r.red||(r=r.toRed(this.red));var t=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=t.redSqrt();if(i.redSqr().redSub(t).cmp(this.zero)!==0)throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(r,i)},ki.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return t.redSqr().redISub(n).cmpn(0)===0},ki.prototype._endoWnafMulAdd=function(r,e,t){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},yr.prototype.isInfinity=function(){return this.inf},yr.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(this.x.cmp(r.x)===0)return this.curve.point(null,null);var e=this.y.redSub(r.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),i=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,i)},yr.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(r.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),i=r.redInvm(),n=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),c=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},yr.prototype.getX=function(){return this.x.fromRed()},yr.prototype.getY=function(){return this.y.fromRed()},yr.prototype.mul=function(r){return r=new bt(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},yr.prototype.mulAdd=function(r,e,t){var i=[this,e],n=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},yr.prototype.jmulAdd=function(r,e,t){var i=[this,e],n=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},yr.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||this.x.cmp(r.x)===0&&this.y.cmp(r.y)===0)},yr.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,i=function(n){return n.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e},yr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var r=this.curve.jpoint(this.x,this.y,this.curve.one);return r};function Sr(r,e,t,i){Aa.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bt(0)):(this.x=new bt(e,16),this.y=new bt(t,16),this.z=new bt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o0(Sr,Aa.BasePoint),ki.prototype.jpoint=function(r,e,t){return new Sr(this,r,e,t)},Sr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),i=this.y.redMul(e).redMul(r);return this.curve.point(t,i)},Sr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Sr.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),i=this.x.redMul(e),n=r.x.redMul(t),a=this.y.redMul(e.redMul(r.z)),c=r.y.redMul(t.redMul(this.z)),f=i.redSub(n),g=a.redSub(c);if(f.cmpn(0)===0)return g.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=f.redSqr(),m=d.redMul(f),w=i.redMul(d),O=g.redSqr().redIAdd(m).redISub(w).redISub(w),C=g.redMul(w.redISub(O)).redISub(a.redMul(m)),P=this.z.redMul(r.z).redMul(f);return this.curve.jpoint(O,C,P)},Sr.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,i=r.x.redMul(e),n=this.y,a=r.y.redMul(e).redMul(this.z),c=t.redSub(i),f=n.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=c.redSqr(),d=g.redMul(c),m=t.redMul(g),w=f.redSqr().redIAdd(d).redISub(m).redISub(m),O=f.redMul(m.redISub(w)).redISub(n.redMul(d)),C=this.z.redMul(c);return this.curve.jpoint(w,O,C)},Sr.prototype.dblp=function(r){if(r===0)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var t=this;for(e=0;e=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},Sr.prototype.inspect=function(){return this.isInfinity()?"":""},Sr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var sf=Ao(function(r,e){var t=e;t.base=Aa,t.short=oM,t.mont=null,t.edwards=null}),af=Ao(function(r,e){var t=e,i=Ai.assert;function n(f){f.type==="short"?this.curve=new sf.short(f):f.type==="edwards"?this.curve=new sf.edwards(f):this.curve=new sf.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function a(f,g){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var d=new n(g);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:d}),d}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Mn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Mn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Mn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Mn.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Mn.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mn.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Mn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Us(r){if(!(this instanceof Us))return new Us(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=pn.toArray(r.entropy,r.entropyEnc||"hex"),t=pn.toArray(r.nonce,r.nonceEnc||"hex"),i=pn.toArray(r.pers,r.persEnc||"hex");a0(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Eg=Us;Us.prototype._init=function(r,e,t){var i=r.concat(e).concat(t);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(r.concat(t||[])),this._reseed=1},Us.prototype.generate=function(r,e,t,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=t,t=e,e=null),t&&(t=pn.toArray(t,i||"hex"),this._update(t));for(var n=[];n.length"};var cM=Ai.assert;function Qf(r,e){if(r instanceof Qf)return r;this._importDER(r,e)||(cM(r.r&&r.s,"Signature without r or s"),this.r=new bt(r.r,16),this.s=new bt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var Ju=Qf;function uM(){this.place=0}function jl(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,a=0,c=e.place;a>>=0;return n<=127?!1:(e.place=c,n)}function Ag(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Qf.prototype.toDER=function(r){var e=this.r.toArray(),t=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t)),e=Ag(e),t=Ag(t);!t[0]&&!(t[1]&128);)t=t.slice(1);var i=[2];kl(i,e.length),i=i.concat(e),i.push(2),kl(i,t.length);var n=i.concat(t),a=[48];return kl(a,n.length),a=a.concat(n),Ai.encode(a,r)};var fM=function(){throw new Error("unsupported")},V3=Ai.assert;function zi(r){if(!(this instanceof zi))return new zi(r);typeof r=="string"&&(V3(Object.prototype.hasOwnProperty.call(af,r),"Unknown curve "+r),r=af[r]),r instanceof af.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var hM=zi;zi.prototype.keyPair=function(r){return new zl(this,r)},zi.prototype.keyFromPrivate=function(r,e){return zl.fromPrivate(this,r,e)},zi.prototype.keyFromPublic=function(r,e){return zl.fromPublic(this,r,e)},zi.prototype.genKeyPair=function(r){r||(r={});for(var e=new Eg({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||fM(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),t=this.n.byteLength(),i=this.n.sub(new bt(2));;){var n=new bt(e.generate(t));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},zi.prototype._truncateToN=function(r,e){var t=r.byteLength()*8-this.n.bitLength();return t>0&&(r=r.ushrn(t)),!e&&r.cmp(this.n)>=0?r.sub(this.n):r},zi.prototype.sign=function(r,e,t,i){typeof t=="object"&&(i=t,t=null),i||(i={}),e=this.keyFromPrivate(e,t),r=this._truncateToN(new bt(r,16));for(var n=this.n.byteLength(),a=e.getPrivate().toArray("be",n),c=r.toArray("be",n),f=new Eg({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),g=this.n.sub(new bt(1)),d=0;;d++){var m=i.k?i.k(d):new bt(f.generate(this.n.byteLength()));if(m=this._truncateToN(m,!0),!(m.cmpn(1)<=0||m.cmp(g)>=0)){var w=this.g.mul(m);if(!w.isInfinity()){var O=w.getX(),C=O.umod(this.n);if(C.cmpn(0)!==0){var P=m.invm(this.n).mul(C.mul(e.getPrivate()).iadd(r));if(P=P.umod(this.n),P.cmpn(0)!==0){var q=(w.getY().isOdd()?1:0)|(O.cmp(C)!==0?2:0);return i.canonical&&P.cmp(this.nh)>0&&(P=this.n.sub(P),q^=1),new Ju({r:C,s:P,recoveryParam:q})}}}}}},zi.prototype.verify=function(r,e,t,i){r=this._truncateToN(new bt(r,16)),t=this.keyFromPublic(t,i),e=new Ju(e,"hex");var n=e.r,a=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(r).umod(this.n),g=c.mul(n).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(f,t.getPublic(),g),d.isInfinity()?!1:d.eqXToP(n)):(d=this.g.mulAdd(f,t.getPublic(),g),d.isInfinity()?!1:d.getX().umod(this.n).cmp(n)===0)},zi.prototype.recoverPubKey=function(r,e,t,i){V3((3&t)===t,"The recovery param is more than two bits"),e=new Ju(e,i);var n=this.n,a=new bt(r),c=e.r,f=e.s,g=t&1,d=t>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?c=this.curve.pointFromX(c.add(this.curve.n),g):c=this.curve.pointFromX(c,g);var m=e.r.invm(n),w=n.sub(a).mul(m).umod(n),O=f.mul(m).umod(n);return this.g.mulAdd(w,c,O)},zi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Ju(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(r,e,n)}catch{continue}if(a.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var lM=Ao(function(r,e){var t=e;t.version="6.5.4",t.utils=Ai,t.rand=function(){throw new Error("unsupported")},t.curve=sf,t.curves=af,t.ec=hM,t.eddsa=null}),dM=lM.ec;const pM="signing-key/5.7.0",Ad=new Mr(pM);let Hl=null;function Ns(){return Hl||(Hl=new dM("secp256k1")),Hl}class gM{constructor(e){Qo(this,"curve","secp256k1"),Qo(this,"privateKey",ui(e)),XA(this.privateKey)!==32&&Ad.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Ns().keyFromPrivate(ir(this.privateKey));Qo(this,"publicKey","0x"+t.getPublic(!1,"hex")),Qo(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Qo(this,"_isSigningKey",!0)}_addPoint(e){const t=Ns().keyFromPublic(ir(this.publicKey)),i=Ns().keyFromPublic(ir(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Ns().keyFromPrivate(ir(this.privateKey)),i=ir(e);i.length!==32&&Ad.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return v3({recoveryParam:n.recoveryParam,r:$n("0x"+n.r.toString(16),32),s:$n("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Ns().keyFromPrivate(ir(this.privateKey)),i=Ns().keyFromPublic(ir(G3(e)));return $n("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function bM(r,e){const t=v3(e),i={r:ir(t.r),s:ir(t.s)};return"0x"+Ns().recoverPubKey(ir(r),i,t.recoveryParam).encode("hex",!1)}function G3(r,e){const t=ir(r);return t.length===32?new gM(t).publicKey:t.length===33?"0x"+Ns().keyFromPublic(t).getPublic(!1,"hex"):t.length===65?ui(t):Ad.throwArgumentError("invalid public or private key","key","[REDACTED]")}var xg;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(xg||(xg={}));function vM(r){const e=G3(r);return Ix(fg(i0(fg(e,1)),12))}function mM(r,e){return vM(bM(ir(r),e))}const yM="https://rpc.walletconnect.org/v1";async function wM(r,e,t,i,n,a){switch(t.t){case"eip191":return _M(r,e,t.s);case"eip1271":return await DM(r,e,t.s,i,n,a);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function _M(r,e,t){return mM(S3(e),t).toLowerCase()===r.toLowerCase()}async function DM(r,e,t,i,n,a){try{const c="0x1626ba7e",f="0000000000000000000000000000000000000000000000000000000000000040",g="0000000000000000000000000000000000000000000000000000000000000041",d=t.substring(2),m=S3(e).substring(2),w=c+m+f+g+d,O=await fetch(`${a||yM}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:EM(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:w},"latest"]})}),{result:C}=await O.json();return C?C.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function EM(){return Date.now()+Math.floor(Math.random()*1e3)}var AM=Object.defineProperty,xM=Object.defineProperties,SM=Object.getOwnPropertyDescriptors,Sg=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,IM=Object.prototype.propertyIsEnumerable,Mg=(r,e,t)=>e in r?AM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,CM=(r,e)=>{for(var t in e||(e={}))MM.call(e,t)&&Mg(r,t,e[t]);if(Sg)for(var t of Sg(e))IM.call(e,t)&&Mg(r,t,e[t]);return r},PM=(r,e)=>xM(r,SM(e));const OM="did:pkh:",c0=r=>r==null?void 0:r.split(":"),J3=r=>{const e=r&&c0(r);if(e)return r.includes(OM)?e[3]:e[1]},Ig=r=>{const e=r&&c0(r);if(e)return e[2]+":"+e[3]},Af=r=>{const e=r&&c0(r);if(e)return e.pop()};async function Cg(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,a=W3(n,n.iss),c=Af(n.iss);return await wM(c,a,i,J3(n.iss),t)}const W3=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=Af(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const a=`URI: ${r.aud||r.uri}`,c=`Version: ${r.version}`,f=`Chain ID: ${J3(e)}`,g=`Nonce: ${r.nonce}`,d=`Issued At: ${r.iat}`,m=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,O=r.requestId?`Request ID: ${r.requestId}`:void 0,C=r.resources?`Resources:${r.resources.map(q=>` -- ${q}`).join("")}`:void 0,P=of(r.resources);if(P){const q=yc(P);n=FM(n,q)}return[t,i,"",n,"",a,c,f,g,d,m,w,O,C].filter(q=>q!=null).join(` -`)};function TM(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function RM(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function ya(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const a=i[n];if(!Array.isArray(a))throw new Error(`Ability limits ${n} must be an array of objects, found: ${a}`);if(!a.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);a.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${c}`)})})})}function NM(r,e,t,i={}){return t==null||t.sort((n,a)=>n.localeCompare(a)),{att:{[r]:BM(e,t,i)}}}function BM(r,e,t={}){e=e==null?void 0:e.sort((n,a)=>n.localeCompare(a));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function Y3(r){return ya(r),`urn:recap:${TM(r).replace(/=/g,"")}`}function yc(r){const e=RM(r.replace("urn:recap:",""));return ya(e),e}function $M(r,e,t){const i=NM(r,e,t);return Y3(i)}function UM(r){return r&&r.includes("urn:recap:")}function qM(r,e){const t=yc(r),i=yc(e),n=LM(t,i);return Y3(n)}function LM(r,e){ya(r),ya(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,a)=>n.localeCompare(a)),i={att:{}};return t.forEach(n=>{var a,c;Object.keys(((a=r.att)==null?void 0:a[n])||{}).concat(Object.keys(((c=e.att)==null?void 0:c[n])||{})).sort((f,g)=>f.localeCompare(g)).forEach(f=>{var g,d;i.att[n]=PM(CM({},i.att[n]),{[f]:((g=r.att[n])==null?void 0:g[f])||((d=e.att[n])==null?void 0:d[f])})})}),i}function FM(r="",e){ya(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const g=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));g.sort((w,O)=>w.action.localeCompare(O.action));const d={};g.forEach(w=>{d[w.ability]||(d[w.ability]=[]),d[w.ability].push(w.action)});const m=Object.keys(d).map(w=>(n++,`(${n}) '${w}': '${d[w].join("', '")}' for '${f}'.`));i.push(m.join(", ").replace(".,","."))});const a=i.join(" "),c=`${t}${a}`;return`${r?r+" ":""}${c}`}function Pg(r){var e;const t=yc(r);ya(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function Og(r){const e=yc(r);ya(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var a;(a=n==null?void 0:n[0])!=null&&a.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function of(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return UM(e)?e:void 0}const Q3="base10",Yr="base16",Ls="base64pad",ec="base64url",Nc="utf8",X3=0,bs=1,Bc=2,zM=0,Tg=1,dc=12,u0=32;function jM(){const r=Vd.generateKeyPair();return{privateKey:Di(r.secretKey,Yr),publicKey:Di(r.publicKey,Yr)}}function xd(){const r=ks.randomBytes(u0);return Di(r,Yr)}function kM(r,e){const t=Vd.sharedKey(Hi(r,Yr),Hi(e,Yr),!0),i=new V_(Sc.SHA256,t).expand(u0);return Di(i,Yr)}function cf(r){const e=Sc.hash(Hi(r,Yr));return Di(e,Yr)}function hs(r){const e=Sc.hash(Hi(r,Nc));return Di(e,Yr)}function Z3(r){return Hi(`${r}`,Q3)}function wa(r){return Number(Di(r,Q3))}function HM(r){const e=Z3(typeof r.type<"u"?r.type:X3);if(wa(e)===bs&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Hi(r.senderPublicKey,Yr):void 0,i=typeof r.iv<"u"?Hi(r.iv,Yr):ks.randomBytes(dc),n=new Hd.ChaCha20Poly1305(Hi(r.symKey,Yr)).seal(i,Hi(r.message,Nc));return e2({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function KM(r,e){const t=Z3(Bc),i=ks.randomBytes(dc),n=Hi(r,Nc);return e2({type:t,sealed:n,iv:i,encoding:e})}function VM(r){const e=new Hd.ChaCha20Poly1305(Hi(r.symKey,Yr)),{sealed:t,iv:i}=wc({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return Di(n,Nc)}function GM(r,e){const{sealed:t}=wc({encoded:r,encoding:e});return Di(t,Nc)}function e2(r){const{encoding:e=Ls}=r;if(wa(r.type)===Bc)return Di(yl([r.type,r.sealed]),e);if(wa(r.type)===bs){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Di(yl([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return Di(yl([r.type,r.iv,r.sealed]),e)}function wc(r){const{encoded:e,encoding:t=Ls}=r,i=Hi(e,t),n=i.slice(zM,Tg),a=Tg;if(wa(n)===bs){const d=a+u0,m=d+dc,w=i.slice(a,d),O=i.slice(d,m),C=i.slice(m);return{type:n,sealed:C,iv:O,senderPublicKey:w}}if(wa(n)===Bc){const d=i.slice(a),m=ks.randomBytes(dc);return{type:n,sealed:d,iv:m}}const c=a+dc,f=i.slice(a,c),g=i.slice(c);return{type:n,sealed:g,iv:f}}function JM(r,e){const t=wc({encoded:r,encoding:e==null?void 0:e.encoding});return t2({type:wa(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Di(t.senderPublicKey,Yr):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function t2(r){const e=(r==null?void 0:r.type)||X3;if(e===bs){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function Rg(r){return r.type===bs&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function Ng(r){return r.type===Bc}function WM(r){return new Ev.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function YM(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function QM(r){return Buffer.from(YM(r),"base64")}function XM(r,e){const[t,i,n]=r.split("."),a=QM(n);if(a.length!==64)throw new Error("Invalid signature length");const c=a.slice(0,32).toString("hex"),f=a.slice(32,64).toString("hex"),g=`${t}.${i}`,d=new Sc.SHA256().update(Buffer.from(g)).digest(),m=WM(e),w=Buffer.from(d).toString("hex");if(!m.verify(w,{r:c,s:f}))throw new Error("Invalid signature");return md(r).payload}const ZM="irn";function Sd(r){return(r==null?void 0:r.relay)||{protocol:ZM}}function cc(r){const e=AA[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var eI=Object.defineProperty,tI=Object.defineProperties,rI=Object.getOwnPropertyDescriptors,Bg=Object.getOwnPropertySymbols,iI=Object.prototype.hasOwnProperty,nI=Object.prototype.propertyIsEnumerable,$g=(r,e,t)=>e in r?eI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ug=(r,e)=>{for(var t in e||(e={}))iI.call(e,t)&&$g(r,t,e[t]);if(Bg)for(var t of Bg(e))nI.call(e,t)&&$g(r,t,e[t]);return r},sI=(r,e)=>tI(r,rI(e));function aI(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const a=n.replace(i,""),c=r[n];t[a]=c}}),t}function qg(r){if(!r.includes("wc:")){const g=d3(r);g!=null&&g.includes("wc:")&&(r=g)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",c=vc.parse(a),f=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:i,topic:oI(n[0]),version:parseInt(n[1],10),symKey:c.symKey,relay:aI(c),methods:f,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function oI(r){return r.startsWith("//")?r.substring(2):r}function cI(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const a=t+e+n;r[n]&&(i[a]=r[n])}),i}function Lg(r){return`${r.protocol}:${r.topic}@${r.version}?`+vc.stringify(Ug(sI(Ug({symKey:r.symKey},cI(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function Wu(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function xo(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function uI(r){const e=[];return Object.values(r).forEach(t=>{e.push(...xo(t.accounts))}),e}function fI(r,e){const t=[];return Object.values(r).forEach(i=>{xo(i.accounts).includes(e)&&t.push(...i.methods)}),t}function hI(r,e){const t=[];return Object.values(r).forEach(i=>{xo(i.accounts).includes(e)&&t.push(...i.events)}),t}function f0(r){return r.includes(":")}function uc(r){return f0(r)?r.split(":")[0]:r}function lI(r){const e={};return r==null||r.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function Fg(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=lI(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=rf(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const dI={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},pI={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function De(r,e){const{message:t,code:i}=pI[r];return{message:e?`${t} ${e}`:t,code:i}}function Lt(r,e){const{message:t,code:i}=dI[r];return{message:e?`${t} ${e}`:t,code:i}}function Hn(r,e){return!!Array.isArray(r)}function _c(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function fi(r){return typeof r>"u"}function ur(r,e){return e&&fi(r)?!0:typeof r=="string"&&!!r.trim().length}function h0(r,e){return typeof r=="number"&&!isNaN(r)}function gI(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let a=!0;return la(n,i)?(i.forEach(c=>{const{accounts:f,methods:g,events:d}=r.namespaces[c],m=xo(f),w=t[c];(!la(a3(c,w),m)||!la(w.methods,g)||!la(w.events,d))&&(a=!1)}),a):!1}function xf(r){return ur(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function bI(r){if(ur(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&xf(t)}}return!1}function vI(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(ur(r,!1)){if(e(r))return!0;const t=d3(r);return e(t)}}catch{}return!1}function mI(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function yI(r){return r==null?void 0:r.topic}function wI(r,e){let t=null;return ur(r==null?void 0:r.publicKey,!1)||(t=De("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function zg(r){let e=!0;return Hn(r)?r.length&&(e=r.every(t=>ur(t,!1))):e=!1,e}function _I(r,e,t){let i=null;return Hn(e)&&e.length?e.forEach(n=>{i||xf(n)||(i=Lt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):xf(r)||(i=Lt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function DI(r,e,t){let i=null;return Object.entries(r).forEach(([n,a])=>{if(i)return;const c=_I(n,a3(n,a),`${e} ${t}`);c&&(i=c)}),i}function EI(r,e){let t=null;return Hn(r)?r.forEach(i=>{t||bI(i)||(t=Lt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Lt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function AI(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=EI(i==null?void 0:i.accounts,`${e} namespace`);n&&(t=n)}),t}function xI(r,e){let t=null;return zg(r==null?void 0:r.methods)?zg(r==null?void 0:r.events)||(t=Lt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Lt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function r2(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=xI(i,`${e}, namespace`);n&&(t=n)}),t}function SI(r,e,t){let i=null;if(r&&_c(r)){const n=r2(r,e);n&&(i=n);const a=DI(r,e,t);a&&(i=a)}else i=De("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function Kl(r,e){let t=null;if(r&&_c(r)){const i=r2(r,e);i&&(t=i);const n=AI(r,e);n&&(t=n)}else t=De("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function i2(r){return ur(r.protocol,!0)}function MI(r,e){let t=!1;return r?r&&Hn(r)&&r.length&&r.forEach(i=>{t=i2(i)}):t=!0,t}function II(r){return typeof r=="number"}function ci(r){return typeof r<"u"&&typeof r!==null}function CI(r){return!(!r||typeof r!="object"||!r.code||!h0(r.code)||!r.message||!ur(r.message,!1))}function PI(r){return!(fi(r)||!ur(r.method,!1))}function OI(r){return!(fi(r)||fi(r.result)&&fi(r.error)||!h0(r.id)||!ur(r.jsonrpc,!1))}function TI(r){return!(fi(r)||!ur(r.name,!1))}function jg(r,e){return!(!xf(e)||!uI(r).includes(e))}function RI(r,e,t){return ur(t,!1)?fI(r,e).includes(t):!1}function NI(r,e,t){return ur(t,!1)?hI(r,e).includes(t):!1}function kg(r,e,t){let i=null;const n=BI(r),a=$I(e),c=Object.keys(n),f=Object.keys(a),g=Hg(Object.keys(r)),d=Hg(Object.keys(e)),m=g.filter(w=>!d.includes(w));return m.length&&(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces. +*/(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&typeof self=="object",c=!n.JS_SHA3_NO_NODE_JS&&typeof ba=="object"&&ba.versions&&ba.versions.node;c?n=p3:a&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,g=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),m=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],O=[1,256,65536,16777216],I=[6,1536,393216,100663296],P=[0,8,16,24],q=[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],K=[224,256,384,512],Y=[128,256],z=["hex","buffer","arrayBuffer","array","digest"],W={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),g&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});for(var B=function(C,ee,L){return function(V){return new R(C,ee,C).update(V)[L]()}},j=function(C,ee,L){return function(V,G){return new R(C,ee,G).update(V)[L]()}},k=function(C,ee,L){return function(V,G,D,H){return h["cshake"+C].update(V,G,D,H)[L]()}},_=function(C,ee,L){return function(V,G,D,H){return h["kmac"+C].update(V,G,D,H)[L]()}},N=function(C,ee,L,V){for(var G=0;G>5,this.byteCount=this.blockCount<<2,this.outputBlocks=L>>5,this.extraBytes=(L&31)>>3;for(var V=0;V<50;++V)this.s[V]=0}R.prototype.update=function(C){if(this.finalized)throw new Error(t);var ee,L=typeof C;if(L!=="string"){if(L==="object"){if(C===null)throw new Error(e);if(g&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!Array.isArray(C)&&(!g||!ArrayBuffer.isView(C)))throw new Error(e)}else throw new Error(e);ee=!0}for(var V=this.blocks,G=this.byteCount,D=C.length,H=this.blockCount,ne=0,ce=this.s,fe,ye;ne>2]|=C[ne]<>2]|=ye<>2]|=(192|ye>>6)<>2]|=(128|ye&63)<=57344?(V[fe>>2]|=(224|ye>>12)<>2]|=(128|ye>>6&63)<>2]|=(128|ye&63)<>2]|=(240|ye>>18)<>2]|=(128|ye>>12&63)<>2]|=(128|ye>>6&63)<>2]|=(128|ye&63)<=G){for(this.start=fe-G,this.block=V[H],fe=0;fe>8,L=C&255;L>0;)G.unshift(L),C=C>>8,L=C&255,++V;return ee?G.push(V):G.unshift(V),this.update(G),G.length},R.prototype.encodeString=function(C){var ee,L=typeof C;if(L!=="string"){if(L==="object"){if(C===null)throw new Error(e);if(g&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!Array.isArray(C)&&(!g||!ArrayBuffer.isView(C)))throw new Error(e)}else throw new Error(e);ee=!0}var V=0,G=C.length;if(ee)V=G;else for(var D=0;D=57344?V+=3:(H=65536+((H&1023)<<10|C.charCodeAt(++D)&1023),V+=4)}return V+=this.encode(V*8),this.update(C),V},R.prototype.bytepad=function(C,ee){for(var L=this.encode(ee),V=0;V>2]|=this.padding[ee&3],this.lastByteIndex===this.byteCount)for(C[0]=C[L],ee=1;ee>4&15]+d[ne&15]+d[ne>>12&15]+d[ne>>8&15]+d[ne>>20&15]+d[ne>>16&15]+d[ne>>28&15]+d[ne>>24&15];D%C===0&&(ae(ee),G=0)}return V&&(ne=ee[G],H+=d[ne>>4&15]+d[ne&15],V>1&&(H+=d[ne>>12&15]+d[ne>>8&15]),V>2&&(H+=d[ne>>20&15]+d[ne>>16&15])),H},R.prototype.arrayBuffer=function(){this.finalize();var C=this.blockCount,ee=this.s,L=this.outputBlocks,V=this.extraBytes,G=0,D=0,H=this.outputBits>>3,ne;V?ne=new ArrayBuffer(L+1<<2):ne=new ArrayBuffer(H);for(var ce=new Uint32Array(ne);D>8&255,H[ne+2]=ce>>16&255,H[ne+3]=ce>>24&255;D%C===0&&ae(ee)}return V&&(ne=D<<2,ce=ee[G],H[ne]=ce&255,V>1&&(H[ne+1]=ce>>8&255),V>2&&(H[ne+2]=ce>>16&255)),H};function Z(C,ee,L){R.call(this,C,ee,L)}Z.prototype=new R,Z.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var ae=function(C){var ee,L,V,G,D,H,ne,ce,fe,ye,we,Te,Qe,Ce,Re,Se,me,Pe,Ne,be,Oe,xe,ve,qe,Me,_e,He,Ve,Ee,Ke,ht,Ge,_t,lt,We,Et,St,Be,Xe,tt,$e,et,Ze,Fe,ut,rt,ze,it,st,Ue,Ye,ft,je,Rt,Nt,at,vt,Rr,Nr,Br,$r,Ur,er;for(V=0;V<48;V+=2)G=C[0]^C[10]^C[20]^C[30]^C[40],D=C[1]^C[11]^C[21]^C[31]^C[41],H=C[2]^C[12]^C[22]^C[32]^C[42],ne=C[3]^C[13]^C[23]^C[33]^C[43],ce=C[4]^C[14]^C[24]^C[34]^C[44],fe=C[5]^C[15]^C[25]^C[35]^C[45],ye=C[6]^C[16]^C[26]^C[36]^C[46],we=C[7]^C[17]^C[27]^C[37]^C[47],Te=C[8]^C[18]^C[28]^C[38]^C[48],Qe=C[9]^C[19]^C[29]^C[39]^C[49],ee=Te^(H<<1|ne>>>31),L=Qe^(ne<<1|H>>>31),C[0]^=ee,C[1]^=L,C[10]^=ee,C[11]^=L,C[20]^=ee,C[21]^=L,C[30]^=ee,C[31]^=L,C[40]^=ee,C[41]^=L,ee=G^(ce<<1|fe>>>31),L=D^(fe<<1|ce>>>31),C[2]^=ee,C[3]^=L,C[12]^=ee,C[13]^=L,C[22]^=ee,C[23]^=L,C[32]^=ee,C[33]^=L,C[42]^=ee,C[43]^=L,ee=H^(ye<<1|we>>>31),L=ne^(we<<1|ye>>>31),C[4]^=ee,C[5]^=L,C[14]^=ee,C[15]^=L,C[24]^=ee,C[25]^=L,C[34]^=ee,C[35]^=L,C[44]^=ee,C[45]^=L,ee=ce^(Te<<1|Qe>>>31),L=fe^(Qe<<1|Te>>>31),C[6]^=ee,C[7]^=L,C[16]^=ee,C[17]^=L,C[26]^=ee,C[27]^=L,C[36]^=ee,C[37]^=L,C[46]^=ee,C[47]^=L,ee=ye^(G<<1|D>>>31),L=we^(D<<1|G>>>31),C[8]^=ee,C[9]^=L,C[18]^=ee,C[19]^=L,C[28]^=ee,C[29]^=L,C[38]^=ee,C[39]^=L,C[48]^=ee,C[49]^=L,Ce=C[0],Re=C[1],rt=C[11]<<4|C[10]>>>28,ze=C[10]<<4|C[11]>>>28,Ve=C[20]<<3|C[21]>>>29,Ee=C[21]<<3|C[20]>>>29,Br=C[31]<<9|C[30]>>>23,$r=C[30]<<9|C[31]>>>23,et=C[40]<<18|C[41]>>>14,Ze=C[41]<<18|C[40]>>>14,lt=C[2]<<1|C[3]>>>31,We=C[3]<<1|C[2]>>>31,Se=C[13]<<12|C[12]>>>20,me=C[12]<<12|C[13]>>>20,it=C[22]<<10|C[23]>>>22,st=C[23]<<10|C[22]>>>22,Ke=C[33]<<13|C[32]>>>19,ht=C[32]<<13|C[33]>>>19,Ur=C[42]<<2|C[43]>>>30,er=C[43]<<2|C[42]>>>30,Rt=C[5]<<30|C[4]>>>2,Nt=C[4]<<30|C[5]>>>2,Et=C[14]<<6|C[15]>>>26,St=C[15]<<6|C[14]>>>26,Pe=C[25]<<11|C[24]>>>21,Ne=C[24]<<11|C[25]>>>21,Ue=C[34]<<15|C[35]>>>17,Ye=C[35]<<15|C[34]>>>17,Ge=C[45]<<29|C[44]>>>3,_t=C[44]<<29|C[45]>>>3,qe=C[6]<<28|C[7]>>>4,Me=C[7]<<28|C[6]>>>4,at=C[17]<<23|C[16]>>>9,vt=C[16]<<23|C[17]>>>9,Be=C[26]<<25|C[27]>>>7,Xe=C[27]<<25|C[26]>>>7,be=C[36]<<21|C[37]>>>11,Oe=C[37]<<21|C[36]>>>11,ft=C[47]<<24|C[46]>>>8,je=C[46]<<24|C[47]>>>8,Fe=C[8]<<27|C[9]>>>5,ut=C[9]<<27|C[8]>>>5,_e=C[18]<<20|C[19]>>>12,He=C[19]<<20|C[18]>>>12,Rr=C[29]<<7|C[28]>>>25,Nr=C[28]<<7|C[29]>>>25,tt=C[38]<<8|C[39]>>>24,$e=C[39]<<8|C[38]>>>24,xe=C[48]<<14|C[49]>>>18,ve=C[49]<<14|C[48]>>>18,C[0]=Ce^~Se&Pe,C[1]=Re^~me&Ne,C[10]=qe^~_e&Ve,C[11]=Me^~He&Ee,C[20]=lt^~Et&Be,C[21]=We^~St&Xe,C[30]=Fe^~rt&it,C[31]=ut^~ze&st,C[40]=Rt^~at&Rr,C[41]=Nt^~vt&Nr,C[2]=Se^~Pe&be,C[3]=me^~Ne&Oe,C[12]=_e^~Ve&Ke,C[13]=He^~Ee&ht,C[22]=Et^~Be&tt,C[23]=St^~Xe&$e,C[32]=rt^~it&Ue,C[33]=ze^~st&Ye,C[42]=at^~Rr&Br,C[43]=vt^~Nr&$r,C[4]=Pe^~be&xe,C[5]=Ne^~Oe&ve,C[14]=Ve^~Ke&Ge,C[15]=Ee^~ht&_t,C[24]=Be^~tt&et,C[25]=Xe^~$e&Ze,C[34]=it^~Ue&ft,C[35]=st^~Ye&je,C[44]=Rr^~Br&Ur,C[45]=Nr^~$r&er,C[6]=be^~xe&Ce,C[7]=Oe^~ve&Re,C[16]=Ke^~Ge&qe,C[17]=ht^~_t&Me,C[26]=tt^~et<,C[27]=$e^~Ze&We,C[36]=Ue^~ft&Fe,C[37]=Ye^~je&ut,C[46]=Br^~Ur&Rt,C[47]=$r^~er&Nt,C[8]=xe^~Ce&Se,C[9]=ve^~Re&me,C[18]=Ge^~qe&_e,C[19]=_t^~Me&He,C[28]=et^~lt&Et,C[29]=Ze^~We&St,C[38]=ft^~Fe&rt,C[39]=je^~ut&ze,C[48]=Ur^~Rt&at,C[49]=er^~Nt&vt,C[0]^=q[V],C[1]^=q[V+1]};if(f)r.exports=h;else for(E=0;E{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(r){return r.message}return null}const cg=GA();var wd;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(wd||(wd={}));var ln;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ln||(ln={}));const ug="0123456789abcdef";let Mr=class gr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();sf[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(og>sf[i])&&console.log.apply(console,t)}debug(...e){this._log(gr.levels.DEBUG,e)}info(...e){this._log(gr.levels.INFO,e)}warn(...e){this._log(gr.levels.WARNING,e)}makeError(e,t,i){if(ag)return this.makeError("censored error",t,{});t||(t=gr.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(g=>{const d=i[g];try{if(d instanceof Uint8Array){let m="";for(let w=0;w>4],m+=ug[d[w]&15];n.push(g+"=Uint8Array(0x"+m+")")}else n.push(g+"="+JSON.stringify(d))}catch{n.push(g+"="+JSON.stringify(i[g].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;let c="";switch(t){case ln.NUMERIC_FAULT:{c="NUMERIC_FAULT";const g=e;switch(g){case"overflow":case"underflow":case"division-by-zero":c+="-"+g;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case ln.CALL_EXCEPTION:case ln.INSUFFICIENT_FUNDS:case ln.MISSING_NEW:case ln.NONCE_EXPIRED:case ln.REPLACEMENT_UNDERPRICED:case ln.TRANSACTION_REPLACED:case ln.UNPREDICTABLE_GAS_LIMIT:c=t;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=a,f.code=t,Object.keys(i).forEach(function(g){f[g]=i[g]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,gr.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){cg&&this.throwError("platform missing String.prototype.normalize",gr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cg})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,gr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,gr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",et&&this.throwError("too many arguments"+i,gr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",gr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",gr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",gr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Ol||(Ol=new gr(VA)),Ol}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",gr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),sg){if(!e)return;this.globalLogger().throwError("error censorship permanent",gr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ag=!!e,sg=!!t}static setLogLevel(e){const t=sf[e.toLowerCase()];if(t==null){gr.globalLogger().warn("invalid log level - "+e);return}og=t}static from(e){return new gr(e)}};Mr.errors=ln,Mr.levels=wd;const JA="bytes/5.7.0",cr=new Mr(JA);function b3(r){return!!r.toHexString}function no(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return no(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function WA(r){return Ei(r)&&!(r.length%2)||Do(r)}function fg(r){return typeof r=="number"&&r==r&&r%1===0}function Do(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!fg(r.length)||r.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ir(r,e){if(e||(e={}),typeof r=="number"){cr.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),no(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),b3(r)&&(r=r.toHexString()),Ei(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":cr.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;nir(n)),t=e.reduce((n,a)=>n+a.length,0),i=new Uint8Array(t);return e.reduce((n,a)=>(i.set(a,n),n+a.length),0),no(i)}function QA(r,e){r=ir(r),r.length>e&&cr.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),no(t)}function Ei(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const Tl="0123456789abcdef";function ui(r,e){if(e||(e={}),typeof r=="number"){cr.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=Tl[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),b3(r))return r.toHexString();if(Ei(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":cr.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(Do(r)){let t="0x";for(let i=0;i>4]+Tl[n&15]}return t}return cr.throwArgumentError("invalid hexlify value","value",r)}function XA(r){if(typeof r!="string")r=ui(r);else if(!Ei(r)||r.length%2)return null;return(r.length-2)/2}function hg(r,e,t){return typeof r!="string"?r=ui(r):(!Ei(r)||r.length%2)&&cr.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function Un(r,e){for(typeof r!="string"?r=ui(r):Ei(r)||cr.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&cr.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function v3(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(WA(r)){let t=ir(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ui(t.slice(0,32)),e.s=ui(t.slice(32,64))):t.length===65?(e.r=ui(t.slice(0,32)),e.s=ui(t.slice(32,64)),e.v=t[64]):cr.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:cr.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ui(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=QA(ir(e._vs),32);e._vs=ui(n);const a=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=a:e.recoveryParam!==a&&cr.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const c=ui(n);e.s==null?e.s=c:e.s!==c&&cr.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?cr.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&cr.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Ei(e.r)?cr.throwArgumentError("signature missing or invalid r","signature",r):e.r=Un(e.r,32),e.s==null||!Ei(e.s)?cr.throwArgumentError("signature missing or invalid s","signature",r):e.s=Un(e.s,32);const t=ir(e.s);t[0]>=128&&cr.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ui(t);e._vs&&(Ei(e._vs)||cr.throwArgumentError("signature invalid _vs","signature",r),e._vs=Un(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&cr.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function n0(r){return"0x"+KA.keccak_256(ir(r))}var m3={exports:{}},ZA={},ex=Object.freeze({__proto__:null,default:ZA}),tx=HA(ex);(function(r){(function(e,t){function i(u,h){if(!u)throw new Error(h||"Assertion failed")}function n(u,h){u.super_=h;var v=function(){};v.prototype=h.prototype,u.prototype=new v,u.prototype.constructor=u}function a(u,h,v){if(a.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((h==="le"||h==="be")&&(v=h,h=10),this._init(u||0,h||10,v||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=tx.Buffer}catch{}a.isBN=function(u){return u instanceof a?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===a.wordSize&&Array.isArray(u.words)},a.max=function(u,h){return u.cmp(h)>0?u:h},a.min=function(u,h){return u.cmp(h)<0?u:h},a.prototype._init=function(u,h,v){if(typeof u=="number")return this._initNumber(u,h,v);if(typeof u=="object")return this._initArray(u,h,v);h==="hex"&&(h=16),i(h===(h|0)&&h>=2&&h<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E=0;E-=3)M=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[S]|=M<>>26-x&67108863,x+=24,x>=26&&(x-=26,S++);else if(v==="le")for(E=0,S=0;E>>26-x&67108863,x+=24,x>=26&&(x-=26,S++);return this._strip()};function f(u,h){var v=u.charCodeAt(h);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;i(!1,"Invalid character in "+u)}function g(u,h,v){var E=f(u,v);return v-1>=h&&(E|=f(u,v-1)<<4),E}a.prototype._parseHex=function(u,h,v){this.length=Math.ceil((u.length-h)/6),this.words=new Array(this.length);for(var E=0;E=h;E-=2)x=g(u,h,E)<=18?(S-=18,M+=1,this.words[M]|=x>>>26):S+=8;else{var p=u.length-h;for(E=p%2===0?h+1:h;E=18?(S-=18,M+=1,this.words[M]|=x>>>26):S+=8}this._strip()};function d(u,h,v,E){for(var S=0,M=0,x=Math.min(u.length,v),p=h;p=49?M=b-49+10:b>=17?M=b-17+10:M=b,i(b>=0&&M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{a.prototype.inspect=w}else a.prototype.inspect=w;function w(){return(this.red?""}var O=["","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"],I=[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],P=[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];a.prototype.toString=function(u,h){u=u||10,h=h|0||1;var v;if(u===16||u==="hex"){v="";for(var E=0,S=0,M=0;M>>24-E&16777215,E+=2,E>=26&&(E-=26,M--),S!==0||M!==this.length-1?v=O[6-p.length]+p+v:v=p+v}for(S!==0&&(v=S.toString(16)+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(u===(u|0)&&u>=2&&u<=36){var b=I[u],R=P[u];v="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ae=Z.modrn(R).toString(u);Z=Z.idivn(R),Z.isZero()?v=ae+v:v=O[b-ae.length]+ae+v}for(this.isZero()&&(v="0"+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},a.prototype.toJSON=function(){return this.toString(16,2)},c&&(a.prototype.toBuffer=function(u,h){return this.toArrayLike(c,u,h)}),a.prototype.toArray=function(u,h){return this.toArrayLike(Array,u,h)};var q=function(u,h){return u.allocUnsafe?u.allocUnsafe(h):new u(h)};a.prototype.toArrayLike=function(u,h,v){this._strip();var E=this.byteLength(),S=v||Math.max(1,E);i(E<=S,"byte array longer than desired length"),i(S>0,"Requested array length <= 0");var M=q(u,S),x=h==="le"?"LE":"BE";return this["_toArrayLike"+x](M,E),M},a.prototype._toArrayLikeLE=function(u,h){for(var v=0,E=0,S=0,M=0;S>8&255),v>16&255),M===6?(v>24&255),E=0,M=0):(E=x>>>24,M+=2)}if(v=0&&(u[v--]=x>>8&255),v>=0&&(u[v--]=x>>16&255),M===6?(v>=0&&(u[v--]=x>>24&255),E=0,M=0):(E=x>>>24,M+=2)}if(v>=0)for(u[v--]=E;v>=0;)u[v--]=0},Math.clz32?a.prototype._countBits=function(u){return 32-Math.clz32(u)}:a.prototype._countBits=function(u){var h=u,v=0;return h>=4096&&(v+=13,h>>>=13),h>=64&&(v+=7,h>>>=7),h>=8&&(v+=4,h>>>=4),h>=2&&(v+=2,h>>>=2),v+h},a.prototype._zeroBits=function(u){if(u===0)return 26;var h=u,v=0;return h&8191||(v+=13,h>>>=13),h&127||(v+=7,h>>>=7),h&15||(v+=4,h>>>=4),h&3||(v+=2,h>>>=2),h&1||v++,v},a.prototype.bitLength=function(){var u=this.words[this.length-1],h=this._countBits(u);return(this.length-1)*26+h};function K(u){for(var h=new Array(u.bitLength()),v=0;v>>S&1}return h}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,h=0;hu.length?this.clone().ior(u):u.clone().ior(this)},a.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},a.prototype.iuand=function(u){var h;this.length>u.length?h=u:h=this;for(var v=0;vu.length?this.clone().iand(u):u.clone().iand(this)},a.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},a.prototype.iuxor=function(u){var h,v;this.length>u.length?(h=this,v=u):(h=u,v=this);for(var E=0;Eu.length?this.clone().ixor(u):u.clone().ixor(this)},a.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},a.prototype.inotn=function(u){i(typeof u=="number"&&u>=0);var h=Math.ceil(u/26)|0,v=u%26;this._expand(h),v>0&&h--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-v),this._strip()},a.prototype.notn=function(u){return this.clone().inotn(u)},a.prototype.setn=function(u,h){i(typeof u=="number"&&u>=0);var v=u/26|0,E=u%26;return this._expand(v+1),h?this.words[v]=this.words[v]|1<u.length?(v=this,E=u):(v=u,E=this);for(var S=0,M=0;M>>26;for(;S!==0&&M>>26;if(this.length=v.length,S!==0)this.words[this.length]=S,this.length++;else if(v!==this)for(;Mu.length?this.clone().iadd(u):u.clone().iadd(this)},a.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var h=this.iadd(u);return u.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var v=this.cmp(u);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,S;v>0?(E=this,S=u):(E=u,S=this);for(var M=0,x=0;x>26,this.words[x]=h&67108863;for(;M!==0&&x>26,this.words[x]=h&67108863;if(M===0&&x>>26,ae=b&67108863,C=Math.min(R,h.length-1),ee=Math.max(0,R-u.length+1);ee<=C;ee++){var L=R-ee|0;S=u.words[L]|0,M=h.words[ee]|0,x=S*M+ae,Z+=x/67108864|0,ae=x&67108863}v.words[R]=ae|0,b=Z|0}return b!==0?v.words[R]=b|0:v.length--,v._strip()}var z=function(u,h,v){var E=u.words,S=h.words,M=v.words,x=0,p,b,R,Z=E[0]|0,ae=Z&8191,C=Z>>>13,ee=E[1]|0,L=ee&8191,V=ee>>>13,G=E[2]|0,D=G&8191,H=G>>>13,ne=E[3]|0,ce=ne&8191,fe=ne>>>13,ye=E[4]|0,we=ye&8191,Te=ye>>>13,Qe=E[5]|0,Ce=Qe&8191,Re=Qe>>>13,Se=E[6]|0,me=Se&8191,Pe=Se>>>13,Ne=E[7]|0,be=Ne&8191,Oe=Ne>>>13,xe=E[8]|0,ve=xe&8191,qe=xe>>>13,Me=E[9]|0,_e=Me&8191,He=Me>>>13,Ve=S[0]|0,Ee=Ve&8191,Ke=Ve>>>13,ht=S[1]|0,Ge=ht&8191,_t=ht>>>13,lt=S[2]|0,We=lt&8191,Et=lt>>>13,St=S[3]|0,Be=St&8191,Xe=St>>>13,tt=S[4]|0,$e=tt&8191,et=tt>>>13,Ze=S[5]|0,Fe=Ze&8191,ut=Ze>>>13,rt=S[6]|0,ze=rt&8191,it=rt>>>13,st=S[7]|0,Ue=st&8191,Ye=st>>>13,ft=S[8]|0,je=ft&8191,Rt=ft>>>13,Nt=S[9]|0,at=Nt&8191,vt=Nt>>>13;v.negative=u.negative^h.negative,v.length=19,p=Math.imul(ae,Ee),b=Math.imul(ae,Ke),b=b+Math.imul(C,Ee)|0,R=Math.imul(C,Ke);var Rr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,p=Math.imul(L,Ee),b=Math.imul(L,Ke),b=b+Math.imul(V,Ee)|0,R=Math.imul(V,Ke),p=p+Math.imul(ae,Ge)|0,b=b+Math.imul(ae,_t)|0,b=b+Math.imul(C,Ge)|0,R=R+Math.imul(C,_t)|0;var Nr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,p=Math.imul(D,Ee),b=Math.imul(D,Ke),b=b+Math.imul(H,Ee)|0,R=Math.imul(H,Ke),p=p+Math.imul(L,Ge)|0,b=b+Math.imul(L,_t)|0,b=b+Math.imul(V,Ge)|0,R=R+Math.imul(V,_t)|0,p=p+Math.imul(ae,We)|0,b=b+Math.imul(ae,Et)|0,b=b+Math.imul(C,We)|0,R=R+Math.imul(C,Et)|0;var Br=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Br>>>26)|0,Br&=67108863,p=Math.imul(ce,Ee),b=Math.imul(ce,Ke),b=b+Math.imul(fe,Ee)|0,R=Math.imul(fe,Ke),p=p+Math.imul(D,Ge)|0,b=b+Math.imul(D,_t)|0,b=b+Math.imul(H,Ge)|0,R=R+Math.imul(H,_t)|0,p=p+Math.imul(L,We)|0,b=b+Math.imul(L,Et)|0,b=b+Math.imul(V,We)|0,R=R+Math.imul(V,Et)|0,p=p+Math.imul(ae,Be)|0,b=b+Math.imul(ae,Xe)|0,b=b+Math.imul(C,Be)|0,R=R+Math.imul(C,Xe)|0;var $r=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+($r>>>26)|0,$r&=67108863,p=Math.imul(we,Ee),b=Math.imul(we,Ke),b=b+Math.imul(Te,Ee)|0,R=Math.imul(Te,Ke),p=p+Math.imul(ce,Ge)|0,b=b+Math.imul(ce,_t)|0,b=b+Math.imul(fe,Ge)|0,R=R+Math.imul(fe,_t)|0,p=p+Math.imul(D,We)|0,b=b+Math.imul(D,Et)|0,b=b+Math.imul(H,We)|0,R=R+Math.imul(H,Et)|0,p=p+Math.imul(L,Be)|0,b=b+Math.imul(L,Xe)|0,b=b+Math.imul(V,Be)|0,R=R+Math.imul(V,Xe)|0,p=p+Math.imul(ae,$e)|0,b=b+Math.imul(ae,et)|0,b=b+Math.imul(C,$e)|0,R=R+Math.imul(C,et)|0;var Ur=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,p=Math.imul(Ce,Ee),b=Math.imul(Ce,Ke),b=b+Math.imul(Re,Ee)|0,R=Math.imul(Re,Ke),p=p+Math.imul(we,Ge)|0,b=b+Math.imul(we,_t)|0,b=b+Math.imul(Te,Ge)|0,R=R+Math.imul(Te,_t)|0,p=p+Math.imul(ce,We)|0,b=b+Math.imul(ce,Et)|0,b=b+Math.imul(fe,We)|0,R=R+Math.imul(fe,Et)|0,p=p+Math.imul(D,Be)|0,b=b+Math.imul(D,Xe)|0,b=b+Math.imul(H,Be)|0,R=R+Math.imul(H,Xe)|0,p=p+Math.imul(L,$e)|0,b=b+Math.imul(L,et)|0,b=b+Math.imul(V,$e)|0,R=R+Math.imul(V,et)|0,p=p+Math.imul(ae,Fe)|0,b=b+Math.imul(ae,ut)|0,b=b+Math.imul(C,Fe)|0,R=R+Math.imul(C,ut)|0;var er=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(er>>>26)|0,er&=67108863,p=Math.imul(me,Ee),b=Math.imul(me,Ke),b=b+Math.imul(Pe,Ee)|0,R=Math.imul(Pe,Ke),p=p+Math.imul(Ce,Ge)|0,b=b+Math.imul(Ce,_t)|0,b=b+Math.imul(Re,Ge)|0,R=R+Math.imul(Re,_t)|0,p=p+Math.imul(we,We)|0,b=b+Math.imul(we,Et)|0,b=b+Math.imul(Te,We)|0,R=R+Math.imul(Te,Et)|0,p=p+Math.imul(ce,Be)|0,b=b+Math.imul(ce,Xe)|0,b=b+Math.imul(fe,Be)|0,R=R+Math.imul(fe,Xe)|0,p=p+Math.imul(D,$e)|0,b=b+Math.imul(D,et)|0,b=b+Math.imul(H,$e)|0,R=R+Math.imul(H,et)|0,p=p+Math.imul(L,Fe)|0,b=b+Math.imul(L,ut)|0,b=b+Math.imul(V,Fe)|0,R=R+Math.imul(V,ut)|0,p=p+Math.imul(ae,ze)|0,b=b+Math.imul(ae,it)|0,b=b+Math.imul(C,ze)|0,R=R+Math.imul(C,it)|0;var Xr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,p=Math.imul(be,Ee),b=Math.imul(be,Ke),b=b+Math.imul(Oe,Ee)|0,R=Math.imul(Oe,Ke),p=p+Math.imul(me,Ge)|0,b=b+Math.imul(me,_t)|0,b=b+Math.imul(Pe,Ge)|0,R=R+Math.imul(Pe,_t)|0,p=p+Math.imul(Ce,We)|0,b=b+Math.imul(Ce,Et)|0,b=b+Math.imul(Re,We)|0,R=R+Math.imul(Re,Et)|0,p=p+Math.imul(we,Be)|0,b=b+Math.imul(we,Xe)|0,b=b+Math.imul(Te,Be)|0,R=R+Math.imul(Te,Xe)|0,p=p+Math.imul(ce,$e)|0,b=b+Math.imul(ce,et)|0,b=b+Math.imul(fe,$e)|0,R=R+Math.imul(fe,et)|0,p=p+Math.imul(D,Fe)|0,b=b+Math.imul(D,ut)|0,b=b+Math.imul(H,Fe)|0,R=R+Math.imul(H,ut)|0,p=p+Math.imul(L,ze)|0,b=b+Math.imul(L,it)|0,b=b+Math.imul(V,ze)|0,R=R+Math.imul(V,it)|0,p=p+Math.imul(ae,Ue)|0,b=b+Math.imul(ae,Ye)|0,b=b+Math.imul(C,Ue)|0,R=R+Math.imul(C,Ye)|0;var Wi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,p=Math.imul(ve,Ee),b=Math.imul(ve,Ke),b=b+Math.imul(qe,Ee)|0,R=Math.imul(qe,Ke),p=p+Math.imul(be,Ge)|0,b=b+Math.imul(be,_t)|0,b=b+Math.imul(Oe,Ge)|0,R=R+Math.imul(Oe,_t)|0,p=p+Math.imul(me,We)|0,b=b+Math.imul(me,Et)|0,b=b+Math.imul(Pe,We)|0,R=R+Math.imul(Pe,Et)|0,p=p+Math.imul(Ce,Be)|0,b=b+Math.imul(Ce,Xe)|0,b=b+Math.imul(Re,Be)|0,R=R+Math.imul(Re,Xe)|0,p=p+Math.imul(we,$e)|0,b=b+Math.imul(we,et)|0,b=b+Math.imul(Te,$e)|0,R=R+Math.imul(Te,et)|0,p=p+Math.imul(ce,Fe)|0,b=b+Math.imul(ce,ut)|0,b=b+Math.imul(fe,Fe)|0,R=R+Math.imul(fe,ut)|0,p=p+Math.imul(D,ze)|0,b=b+Math.imul(D,it)|0,b=b+Math.imul(H,ze)|0,R=R+Math.imul(H,it)|0,p=p+Math.imul(L,Ue)|0,b=b+Math.imul(L,Ye)|0,b=b+Math.imul(V,Ue)|0,R=R+Math.imul(V,Ye)|0,p=p+Math.imul(ae,je)|0,b=b+Math.imul(ae,Rt)|0,b=b+Math.imul(C,je)|0,R=R+Math.imul(C,Rt)|0;var Zr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,p=Math.imul(_e,Ee),b=Math.imul(_e,Ke),b=b+Math.imul(He,Ee)|0,R=Math.imul(He,Ke),p=p+Math.imul(ve,Ge)|0,b=b+Math.imul(ve,_t)|0,b=b+Math.imul(qe,Ge)|0,R=R+Math.imul(qe,_t)|0,p=p+Math.imul(be,We)|0,b=b+Math.imul(be,Et)|0,b=b+Math.imul(Oe,We)|0,R=R+Math.imul(Oe,Et)|0,p=p+Math.imul(me,Be)|0,b=b+Math.imul(me,Xe)|0,b=b+Math.imul(Pe,Be)|0,R=R+Math.imul(Pe,Xe)|0,p=p+Math.imul(Ce,$e)|0,b=b+Math.imul(Ce,et)|0,b=b+Math.imul(Re,$e)|0,R=R+Math.imul(Re,et)|0,p=p+Math.imul(we,Fe)|0,b=b+Math.imul(we,ut)|0,b=b+Math.imul(Te,Fe)|0,R=R+Math.imul(Te,ut)|0,p=p+Math.imul(ce,ze)|0,b=b+Math.imul(ce,it)|0,b=b+Math.imul(fe,ze)|0,R=R+Math.imul(fe,it)|0,p=p+Math.imul(D,Ue)|0,b=b+Math.imul(D,Ye)|0,b=b+Math.imul(H,Ue)|0,R=R+Math.imul(H,Ye)|0,p=p+Math.imul(L,je)|0,b=b+Math.imul(L,Rt)|0,b=b+Math.imul(V,je)|0,R=R+Math.imul(V,Rt)|0,p=p+Math.imul(ae,at)|0,b=b+Math.imul(ae,vt)|0,b=b+Math.imul(C,at)|0,R=R+Math.imul(C,vt)|0;var Yi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,p=Math.imul(_e,Ge),b=Math.imul(_e,_t),b=b+Math.imul(He,Ge)|0,R=Math.imul(He,_t),p=p+Math.imul(ve,We)|0,b=b+Math.imul(ve,Et)|0,b=b+Math.imul(qe,We)|0,R=R+Math.imul(qe,Et)|0,p=p+Math.imul(be,Be)|0,b=b+Math.imul(be,Xe)|0,b=b+Math.imul(Oe,Be)|0,R=R+Math.imul(Oe,Xe)|0,p=p+Math.imul(me,$e)|0,b=b+Math.imul(me,et)|0,b=b+Math.imul(Pe,$e)|0,R=R+Math.imul(Pe,et)|0,p=p+Math.imul(Ce,Fe)|0,b=b+Math.imul(Ce,ut)|0,b=b+Math.imul(Re,Fe)|0,R=R+Math.imul(Re,ut)|0,p=p+Math.imul(we,ze)|0,b=b+Math.imul(we,it)|0,b=b+Math.imul(Te,ze)|0,R=R+Math.imul(Te,it)|0,p=p+Math.imul(ce,Ue)|0,b=b+Math.imul(ce,Ye)|0,b=b+Math.imul(fe,Ue)|0,R=R+Math.imul(fe,Ye)|0,p=p+Math.imul(D,je)|0,b=b+Math.imul(D,Rt)|0,b=b+Math.imul(H,je)|0,R=R+Math.imul(H,Rt)|0,p=p+Math.imul(L,at)|0,b=b+Math.imul(L,vt)|0,b=b+Math.imul(V,at)|0,R=R+Math.imul(V,vt)|0;var Qi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,p=Math.imul(_e,We),b=Math.imul(_e,Et),b=b+Math.imul(He,We)|0,R=Math.imul(He,Et),p=p+Math.imul(ve,Be)|0,b=b+Math.imul(ve,Xe)|0,b=b+Math.imul(qe,Be)|0,R=R+Math.imul(qe,Xe)|0,p=p+Math.imul(be,$e)|0,b=b+Math.imul(be,et)|0,b=b+Math.imul(Oe,$e)|0,R=R+Math.imul(Oe,et)|0,p=p+Math.imul(me,Fe)|0,b=b+Math.imul(me,ut)|0,b=b+Math.imul(Pe,Fe)|0,R=R+Math.imul(Pe,ut)|0,p=p+Math.imul(Ce,ze)|0,b=b+Math.imul(Ce,it)|0,b=b+Math.imul(Re,ze)|0,R=R+Math.imul(Re,it)|0,p=p+Math.imul(we,Ue)|0,b=b+Math.imul(we,Ye)|0,b=b+Math.imul(Te,Ue)|0,R=R+Math.imul(Te,Ye)|0,p=p+Math.imul(ce,je)|0,b=b+Math.imul(ce,Rt)|0,b=b+Math.imul(fe,je)|0,R=R+Math.imul(fe,Rt)|0,p=p+Math.imul(D,at)|0,b=b+Math.imul(D,vt)|0,b=b+Math.imul(H,at)|0,R=R+Math.imul(H,vt)|0;var ei=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(ei>>>26)|0,ei&=67108863,p=Math.imul(_e,Be),b=Math.imul(_e,Xe),b=b+Math.imul(He,Be)|0,R=Math.imul(He,Xe),p=p+Math.imul(ve,$e)|0,b=b+Math.imul(ve,et)|0,b=b+Math.imul(qe,$e)|0,R=R+Math.imul(qe,et)|0,p=p+Math.imul(be,Fe)|0,b=b+Math.imul(be,ut)|0,b=b+Math.imul(Oe,Fe)|0,R=R+Math.imul(Oe,ut)|0,p=p+Math.imul(me,ze)|0,b=b+Math.imul(me,it)|0,b=b+Math.imul(Pe,ze)|0,R=R+Math.imul(Pe,it)|0,p=p+Math.imul(Ce,Ue)|0,b=b+Math.imul(Ce,Ye)|0,b=b+Math.imul(Re,Ue)|0,R=R+Math.imul(Re,Ye)|0,p=p+Math.imul(we,je)|0,b=b+Math.imul(we,Rt)|0,b=b+Math.imul(Te,je)|0,R=R+Math.imul(Te,Rt)|0,p=p+Math.imul(ce,at)|0,b=b+Math.imul(ce,vt)|0,b=b+Math.imul(fe,at)|0,R=R+Math.imul(fe,vt)|0;var Mi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,p=Math.imul(_e,$e),b=Math.imul(_e,et),b=b+Math.imul(He,$e)|0,R=Math.imul(He,et),p=p+Math.imul(ve,Fe)|0,b=b+Math.imul(ve,ut)|0,b=b+Math.imul(qe,Fe)|0,R=R+Math.imul(qe,ut)|0,p=p+Math.imul(be,ze)|0,b=b+Math.imul(be,it)|0,b=b+Math.imul(Oe,ze)|0,R=R+Math.imul(Oe,it)|0,p=p+Math.imul(me,Ue)|0,b=b+Math.imul(me,Ye)|0,b=b+Math.imul(Pe,Ue)|0,R=R+Math.imul(Pe,Ye)|0,p=p+Math.imul(Ce,je)|0,b=b+Math.imul(Ce,Rt)|0,b=b+Math.imul(Re,je)|0,R=R+Math.imul(Re,Rt)|0,p=p+Math.imul(we,at)|0,b=b+Math.imul(we,vt)|0,b=b+Math.imul(Te,at)|0,R=R+Math.imul(Te,vt)|0;var Ii=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,p=Math.imul(_e,Fe),b=Math.imul(_e,ut),b=b+Math.imul(He,Fe)|0,R=Math.imul(He,ut),p=p+Math.imul(ve,ze)|0,b=b+Math.imul(ve,it)|0,b=b+Math.imul(qe,ze)|0,R=R+Math.imul(qe,it)|0,p=p+Math.imul(be,Ue)|0,b=b+Math.imul(be,Ye)|0,b=b+Math.imul(Oe,Ue)|0,R=R+Math.imul(Oe,Ye)|0,p=p+Math.imul(me,je)|0,b=b+Math.imul(me,Rt)|0,b=b+Math.imul(Pe,je)|0,R=R+Math.imul(Pe,Rt)|0,p=p+Math.imul(Ce,at)|0,b=b+Math.imul(Ce,vt)|0,b=b+Math.imul(Re,at)|0,R=R+Math.imul(Re,vt)|0;var lr=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(lr>>>26)|0,lr&=67108863,p=Math.imul(_e,ze),b=Math.imul(_e,it),b=b+Math.imul(He,ze)|0,R=Math.imul(He,it),p=p+Math.imul(ve,Ue)|0,b=b+Math.imul(ve,Ye)|0,b=b+Math.imul(qe,Ue)|0,R=R+Math.imul(qe,Ye)|0,p=p+Math.imul(be,je)|0,b=b+Math.imul(be,Rt)|0,b=b+Math.imul(Oe,je)|0,R=R+Math.imul(Oe,Rt)|0,p=p+Math.imul(me,at)|0,b=b+Math.imul(me,vt)|0,b=b+Math.imul(Pe,at)|0,R=R+Math.imul(Pe,vt)|0;var Xi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,p=Math.imul(_e,Ue),b=Math.imul(_e,Ye),b=b+Math.imul(He,Ue)|0,R=Math.imul(He,Ye),p=p+Math.imul(ve,je)|0,b=b+Math.imul(ve,Rt)|0,b=b+Math.imul(qe,je)|0,R=R+Math.imul(qe,Rt)|0,p=p+Math.imul(be,at)|0,b=b+Math.imul(be,vt)|0,b=b+Math.imul(Oe,at)|0,R=R+Math.imul(Oe,vt)|0;var Zi=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,p=Math.imul(_e,je),b=Math.imul(_e,Rt),b=b+Math.imul(He,je)|0,R=Math.imul(He,Rt),p=p+Math.imul(ve,at)|0,b=b+Math.imul(ve,vt)|0,b=b+Math.imul(qe,at)|0,R=R+Math.imul(qe,vt)|0;var en=(x+p|0)+((b&8191)<<13)|0;x=(R+(b>>>13)|0)+(en>>>26)|0,en&=67108863,p=Math.imul(_e,at),b=Math.imul(_e,vt),b=b+Math.imul(He,at)|0,R=Math.imul(He,vt);var Ks=(x+p|0)+((b&8191)<<13)|0;return x=(R+(b>>>13)|0)+(Ks>>>26)|0,Ks&=67108863,M[0]=Rr,M[1]=Nr,M[2]=Br,M[3]=$r,M[4]=Ur,M[5]=er,M[6]=Xr,M[7]=Wi,M[8]=Zr,M[9]=Yi,M[10]=Qi,M[11]=ei,M[12]=Mi,M[13]=Ii,M[14]=lr,M[15]=Xi,M[16]=Zi,M[17]=en,M[18]=Ks,x!==0&&(M[19]=x,v.length++),v};Math.imul||(z=Y);function W(u,h,v){v.negative=h.negative^u.negative,v.length=u.length+h.length;for(var E=0,S=0,M=0;M>>26)|0,S+=x>>>26,x&=67108863}v.words[M]=p,E=x,x=S}return E!==0?v.words[M]=E:v.length--,v._strip()}function B(u,h,v){return W(u,h,v)}a.prototype.mulTo=function(u,h){var v,E=this.length+u.length;return this.length===10&&u.length===10?v=z(this,u,h):E<63?v=Y(this,u,h):E<1024?v=W(this,u,h):v=B(this,u,h),v},a.prototype.mul=function(u){var h=new a(null);return h.words=new Array(this.length+u.length),this.mulTo(u,h)},a.prototype.mulf=function(u){var h=new a(null);return h.words=new Array(this.length+u.length),B(this,u,h)},a.prototype.imul=function(u){return this.clone().mulTo(u,this)},a.prototype.imuln=function(u){var h=u<0;h&&(u=-u),i(typeof u=="number"),i(u<67108864);for(var v=0,E=0;E>=26,v+=S/67108864|0,v+=M>>>26,this.words[E]=M&67108863}return v!==0&&(this.words[E]=v,this.length++),h?this.ineg():this},a.prototype.muln=function(u){return this.clone().imuln(u)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(u){var h=K(u);if(h.length===0)return new a(1);for(var v=this,E=0;E=0);var h=u%26,v=(u-h)/26,E=67108863>>>26-h<<26-h,S;if(h!==0){var M=0;for(S=0;S>>26-h}M&&(this.words[S]=M,this.length++)}if(v!==0){for(S=this.length-1;S>=0;S--)this.words[S+v]=this.words[S];for(S=0;S=0);var E;h?E=(h-h%26)/26:E=0;var S=u%26,M=Math.min((u-S)/26,this.length),x=67108863^67108863>>>S<M)for(this.length-=M,b=0;b=0&&(R!==0||b>=E);b--){var Z=this.words[b]|0;this.words[b]=R<<26-S|Z>>>S,R=Z&x}return p&&R!==0&&(p.words[p.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(u,h,v){return i(this.negative===0),this.iushrn(u,h,v)},a.prototype.shln=function(u){return this.clone().ishln(u)},a.prototype.ushln=function(u){return this.clone().iushln(u)},a.prototype.shrn=function(u){return this.clone().ishrn(u)},a.prototype.ushrn=function(u){return this.clone().iushrn(u)},a.prototype.testn=function(u){i(typeof u=="number"&&u>=0);var h=u%26,v=(u-h)/26,E=1<=0);var h=u%26,v=(u-h)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(h!==0&&v++,this.length=Math.min(v,this.length),h!==0){var E=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},a.prototype.isubn=function(u){if(i(typeof u=="number"),i(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(p/67108864|0),this.words[S+v]=M&67108863}for(;S>26,this.words[S+v]=M&67108863;if(x===0)return this._strip();for(i(x===-1),x=0,S=0;S>26,this.words[S]=M&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(u,h){var v=this.length-u.length,E=this.clone(),S=u,M=S.words[S.length-1]|0,x=this._countBits(M);v=26-x,v!==0&&(S=S.ushln(v),E.iushln(v),M=S.words[S.length-1]|0);var p=E.length-S.length,b;if(h!=="mod"){b=new a(null),b.length=p+1,b.words=new Array(b.length);for(var R=0;R=0;ae--){var C=(E.words[S.length+ae]|0)*67108864+(E.words[S.length+ae-1]|0);for(C=Math.min(C/M|0,67108863),E._ishlnsubmul(S,C,ae);E.negative!==0;)C--,E.negative=0,E._ishlnsubmul(S,1,ae),E.isZero()||(E.negative^=1);b&&(b.words[ae]=C)}return b&&b._strip(),E._strip(),h!=="div"&&v!==0&&E.iushrn(v),{div:b||null,mod:E}},a.prototype.divmod=function(u,h,v){if(i(!u.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var E,S,M;return this.negative!==0&&u.negative===0?(M=this.neg().divmod(u,h),h!=="mod"&&(E=M.div.neg()),h!=="div"&&(S=M.mod.neg(),v&&S.negative!==0&&S.iadd(u)),{div:E,mod:S}):this.negative===0&&u.negative!==0?(M=this.divmod(u.neg(),h),h!=="mod"&&(E=M.div.neg()),{div:E,mod:M.mod}):this.negative&u.negative?(M=this.neg().divmod(u.neg(),h),h!=="div"&&(S=M.mod.neg(),v&&S.negative!==0&&S.isub(u)),{div:M.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new a(0),mod:this}:u.length===1?h==="div"?{div:this.divn(u.words[0]),mod:null}:h==="mod"?{div:null,mod:new a(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new a(this.modrn(u.words[0]))}:this._wordDiv(u,h)},a.prototype.div=function(u){return this.divmod(u,"div",!1).div},a.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},a.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},a.prototype.divRound=function(u){var h=this.divmod(u);if(h.mod.isZero())return h.div;var v=h.div.negative!==0?h.mod.isub(u):h.mod,E=u.ushrn(1),S=u.andln(1),M=v.cmp(E);return M<0||S===1&&M===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},a.prototype.modrn=function(u){var h=u<0;h&&(u=-u),i(u<=67108863);for(var v=(1<<26)%u,E=0,S=this.length-1;S>=0;S--)E=(v*E+(this.words[S]|0))%u;return h?-E:E},a.prototype.modn=function(u){return this.modrn(u)},a.prototype.idivn=function(u){var h=u<0;h&&(u=-u),i(u<=67108863);for(var v=0,E=this.length-1;E>=0;E--){var S=(this.words[E]|0)+v*67108864;this.words[E]=S/u|0,v=S%u}return this._strip(),h?this.ineg():this},a.prototype.divn=function(u){return this.clone().idivn(u)},a.prototype.egcd=function(u){i(u.negative===0),i(!u.isZero());var h=this,v=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var E=new a(1),S=new a(0),M=new a(0),x=new a(1),p=0;h.isEven()&&v.isEven();)h.iushrn(1),v.iushrn(1),++p;for(var b=v.clone(),R=h.clone();!h.isZero();){for(var Z=0,ae=1;!(h.words[0]&ae)&&Z<26;++Z,ae<<=1);if(Z>0)for(h.iushrn(Z);Z-- >0;)(E.isOdd()||S.isOdd())&&(E.iadd(b),S.isub(R)),E.iushrn(1),S.iushrn(1);for(var C=0,ee=1;!(v.words[0]&ee)&&C<26;++C,ee<<=1);if(C>0)for(v.iushrn(C);C-- >0;)(M.isOdd()||x.isOdd())&&(M.iadd(b),x.isub(R)),M.iushrn(1),x.iushrn(1);h.cmp(v)>=0?(h.isub(v),E.isub(M),S.isub(x)):(v.isub(h),M.isub(E),x.isub(S))}return{a:M,b:x,gcd:v.iushln(p)}},a.prototype._invmp=function(u){i(u.negative===0),i(!u.isZero());var h=this,v=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var E=new a(1),S=new a(0),M=v.clone();h.cmpn(1)>0&&v.cmpn(1)>0;){for(var x=0,p=1;!(h.words[0]&p)&&x<26;++x,p<<=1);if(x>0)for(h.iushrn(x);x-- >0;)E.isOdd()&&E.iadd(M),E.iushrn(1);for(var b=0,R=1;!(v.words[0]&R)&&b<26;++b,R<<=1);if(b>0)for(v.iushrn(b);b-- >0;)S.isOdd()&&S.iadd(M),S.iushrn(1);h.cmp(v)>=0?(h.isub(v),E.isub(S)):(v.isub(h),S.isub(E))}var Z;return h.cmpn(1)===0?Z=E:Z=S,Z.cmpn(0)<0&&Z.iadd(u),Z},a.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var h=this.clone(),v=u.clone();h.negative=0,v.negative=0;for(var E=0;h.isEven()&&v.isEven();E++)h.iushrn(1),v.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;v.isEven();)v.iushrn(1);var S=h.cmp(v);if(S<0){var M=h;h=v,v=M}else if(S===0||v.cmpn(1)===0)break;h.isub(v)}while(!0);return v.iushln(E)},a.prototype.invm=function(u){return this.egcd(u).a.umod(u)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(u){return this.words[0]&u},a.prototype.bincn=function(u){i(typeof u=="number");var h=u%26,v=(u-h)/26,E=1<>>26,x&=67108863,this.words[M]=x}return S!==0&&(this.words[M]=S,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(u){var h=u<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var v;if(this.length>1)v=1;else{h&&(u=-u),i(u<=67108863,"Number is too big");var E=this.words[0]|0;v=E===u?0:Eu.length)return 1;if(this.length=0;v--){var E=this.words[v]|0,S=u.words[v]|0;if(E!==S){ES&&(h=1);break}}return h},a.prototype.gtn=function(u){return this.cmpn(u)===1},a.prototype.gt=function(u){return this.cmp(u)===1},a.prototype.gten=function(u){return this.cmpn(u)>=0},a.prototype.gte=function(u){return this.cmp(u)>=0},a.prototype.ltn=function(u){return this.cmpn(u)===-1},a.prototype.lt=function(u){return this.cmp(u)===-1},a.prototype.lten=function(u){return this.cmpn(u)<=0},a.prototype.lte=function(u){return this.cmp(u)<=0},a.prototype.eqn=function(u){return this.cmpn(u)===0},a.prototype.eq=function(u){return this.cmp(u)===0},a.red=function(u){return new U(u)},a.prototype.toRed=function(u){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(u){return this.red=u,this},a.prototype.forceRed=function(u){return i(!this.red,"Already a number in reduction context"),this._forceRed(u)},a.prototype.redAdd=function(u){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},a.prototype.redIAdd=function(u){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},a.prototype.redSub=function(u){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},a.prototype.redISub=function(u){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},a.prototype.redShl=function(u){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},a.prototype.redMul=function(u){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},a.prototype.redIMul=function(u){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(u){return i(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var j={k256:null,p224:null,p192:null,p25519:null};function k(u,h){this.name=u,this.p=new a(h,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var u=new a(null);return u.words=new Array(Math.ceil(this.n/13)),u},k.prototype.ireduce=function(u){var h=u,v;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),v=h.bitLength();while(v>this.n);var E=v0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},k.prototype.split=function(u,h){u.iushrn(this.n,0,h)},k.prototype.imulK=function(u){return u.imul(this.k)};function _(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,k),_.prototype.split=function(u,h){for(var v=4194303,E=Math.min(u.length,9),S=0;S>>22,M=x}M>>>=22,u.words[S-10]=M,M===0&&u.length>10?u.length-=10:u.length-=9},_.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var h=0,v=0;v>>=26,u.words[v]=S,h=E}return h!==0&&(u.words[u.length++]=h),u},a._prime=function(u){if(j[u])return j[u];var h;if(u==="k256")h=new _;else if(u==="p224")h=new N;else if(u==="p192")h=new se;else if(u==="p25519")h=new le;else throw new Error("Unknown prime "+u);return j[u]=h,h};function U(u){if(typeof u=="string"){var h=a._prime(u);this.m=h.p,this.prime=h}else i(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}U.prototype._verify1=function(u){i(u.negative===0,"red works only with positives"),i(u.red,"red works only with red numbers")},U.prototype._verify2=function(u,h){i((u.negative|h.negative)===0,"red works only with positives"),i(u.red&&u.red===h.red,"red works only with red numbers")},U.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(m(u,u.umod(this.m)._forceRed(this)),u)},U.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},U.prototype.add=function(u,h){this._verify2(u,h);var v=u.add(h);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},U.prototype.iadd=function(u,h){this._verify2(u,h);var v=u.iadd(h);return v.cmp(this.m)>=0&&v.isub(this.m),v},U.prototype.sub=function(u,h){this._verify2(u,h);var v=u.sub(h);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},U.prototype.isub=function(u,h){this._verify2(u,h);var v=u.isub(h);return v.cmpn(0)<0&&v.iadd(this.m),v},U.prototype.shl=function(u,h){return this._verify1(u),this.imod(u.ushln(h))},U.prototype.imul=function(u,h){return this._verify2(u,h),this.imod(u.imul(h))},U.prototype.mul=function(u,h){return this._verify2(u,h),this.imod(u.mul(h))},U.prototype.isqr=function(u){return this.imul(u,u.clone())},U.prototype.sqr=function(u){return this.mul(u,u)},U.prototype.sqrt=function(u){if(u.isZero())return u.clone();var h=this.m.andln(3);if(i(h%2===1),h===3){var v=this.m.add(new a(1)).iushrn(2);return this.pow(u,v)}for(var E=this.m.subn(1),S=0;!E.isZero()&&E.andln(1)===0;)S++,E.iushrn(1);i(!E.isZero());var M=new a(1).toRed(this),x=M.redNeg(),p=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new a(2*b*b).toRed(this);this.pow(b,p).cmp(x)!==0;)b.redIAdd(x);for(var R=this.pow(b,E),Z=this.pow(u,E.addn(1).iushrn(1)),ae=this.pow(u,E),C=S;ae.cmp(M)!==0;){for(var ee=ae,L=0;ee.cmp(M)!==0;L++)ee=ee.redSqr();i(L=0;S--){for(var R=h.words[S],Z=b-1;Z>=0;Z--){var ae=R>>Z&1;if(M!==E[0]&&(M=this.sqr(M)),ae===0&&x===0){p=0;continue}x<<=1,x|=ae,p++,!(p!==v&&(S!==0||Z!==0))&&(M=this.mul(M,E[x]),p=0,x=0)}b=26}return M},U.prototype.convertTo=function(u){var h=u.umod(this.m);return h===u?h.clone():h},U.prototype.convertFrom=function(u){var h=u.clone();return h.red=null,h},a.mont=function(u){return new y(u)};function y(u){U.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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)}n(y,U),y.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},y.prototype.convertFrom=function(u){var h=this.imod(u.mul(this.rinv));return h.red=null,h},y.prototype.imul=function(u,h){if(u.isZero()||h.isZero())return u.words[0]=0,u.length=1,u;var v=u.imul(h),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(E).iushrn(this.shift),M=S;return S.cmp(this.m)>=0?M=S.isub(this.m):S.cmpn(0)<0&&(M=S.iadd(this.m)),M._forceRed(this)},y.prototype.mul=function(u,h){if(u.isZero()||h.isZero())return new a(0)._forceRed(this);var v=u.mul(h),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(E).iushrn(this.shift),M=S;return S.cmp(this.m)>=0?M=S.isub(this.m):S.cmpn(0)<0&&(M=S.iadd(this.m)),M._forceRed(this)},y.prototype.invm=function(u){var h=this.imod(u._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(r,p3)})(m3);var bt=m3.exports;const y3="bignumber/5.7.0";var _f=bt.BN;const hs=new Mr(y3),Rl={},lg=9007199254740991;function rx(r){return r!=null&&(Gt.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Ei(r)||typeof r=="bigint"||Do(r))}let dg=!1;class Gt{constructor(e,t){e!==Rl&&hs.throwError("cannot call constructor directly; use BigNumber.from",Mr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ai(It(this).fromTwos(e))}toTwos(e){return ai(It(this).toTwos(e))}abs(){return this._hex[0]==="-"?Gt.from(this._hex.substring(1)):this}add(e){return ai(It(this).add(It(e)))}sub(e){return ai(It(this).sub(It(e)))}div(e){return Gt.from(e).isZero()&&Ui("division-by-zero","div"),ai(It(this).div(It(e)))}mul(e){return ai(It(this).mul(It(e)))}mod(e){const t=It(e);return t.isNeg()&&Ui("division-by-zero","mod"),ai(It(this).umod(t))}pow(e){const t=It(e);return t.isNeg()&&Ui("negative-power","pow"),ai(It(this).pow(t))}and(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","and"),ai(It(this).and(t))}or(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","or"),ai(It(this).or(t))}xor(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ui("unbound-bitwise-result","xor"),ai(It(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ui("negative-width","mask"),ai(It(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ui("negative-width","shl"),ai(It(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ui("negative-width","shr"),ai(It(this).shrn(e))}eq(e){return It(this).eq(It(e))}lt(e){return It(this).lt(It(e))}lte(e){return It(this).lte(It(e))}gt(e){return It(this).gt(It(e))}gte(e){return It(this).gte(It(e))}isNegative(){return this._hex[0]==="-"}isZero(){return It(this).isZero()}toNumber(){try{return It(this).toNumber()}catch{Ui("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return hs.throwError("this platform does not support BigInt",Mr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dg||(dg=!0,hs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?hs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Mr.errors.UNEXPECTED_ARGUMENT,{}):hs.throwError("BigNumber.toString does not accept parameters",Mr.errors.UNEXPECTED_ARGUMENT,{})),It(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Gt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Gt(Rl,yc(e)):e.match(/^-?[0-9]+$/)?new Gt(Rl,yc(new _f(e))):hs.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ui("underflow","BigNumber.from",e),(e>=lg||e<=-lg)&&Ui("overflow","BigNumber.from",e),Gt.from(String(e));const t=e;if(typeof t=="bigint")return Gt.from(t.toString());if(Do(t))return Gt.from(ui(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return Gt.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Ei(i)||i[0]==="-"&&Ei(i.substring(1))))return Gt.from(i)}return hs.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function yc(r){if(typeof r!="string")return yc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&hs.throwArgumentError("invalid hex","value",r),r=yc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function ai(r){return Gt.from(yc(r))}function It(r){const e=Gt.from(r).toHexString();return e[0]==="-"?new _f("-"+e.substring(3),16):new _f(e.substring(2),16)}function Ui(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),hs.throwError(r,Mr.errors.NUMERIC_FAULT,i)}function ix(r){return new _f(r,36).toString(16)}const Wr=new Mr(y3),lc={},w3=Gt.from(0),_3=Gt.from(-1);function D3(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),Wr.throwError(r,Mr.errors.NUMERIC_FAULT,n)}let dc="0";for(;dc.length<256;)dc+=dc;function s0(r){if(typeof r!="number")try{r=Gt.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+dc.substring(0,r):Wr.throwArgumentError("invalid decimal size","decimals",r)}function Nl(r,e){e==null&&(e=0);const t=s0(e);r=Gt.from(r);const i=r.lt(w3);i&&(r=r.mul(_3));let n=r.mod(t).toString();for(;n.length2&&Wr.throwArgumentError("too many decimal points","value",r);let a=n[0],c=n[1];for(a||(a="0"),c||(c="0");c[c.length-1]==="0";)c=c.substring(0,c.length-1);for(c.length>t.length-1&&D3("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.lengthe[c]==null?g:(typeof e[c]!==f&&Wr.throwArgumentError("invalid fixed format ("+c+" not "+f+")","format."+c,e[c]),e[c]);t=a("signed","boolean",t),i=a("width","number",i),n=a("decimals","number",n)}return i%8&&Wr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Wr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new _d(lc,t,i,n)}},E3=class Gr{constructor(e,t,i,n){e!==lc&&Wr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Mr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Wr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=os(this._value,this.format.decimals),i=os(e._value,e.format.decimals);return Gr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=os(this._value,this.format.decimals),i=os(e._value,e.format.decimals);return Gr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=os(this._value,this.format.decimals),i=os(e._value,e.format.decimals);return Gr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=os(this._value,this.format.decimals),i=os(e._value,e.format.decimals);return Gr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Gr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(pg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Gr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(pg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&Wr.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=Gr.from("1"+dc.substring(0,e),this.format),n=nx.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Wr.throwArgumentError("invalid byte width","width",e);const t=Gt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Un(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Gr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!rx(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),Gr.fromString(Nl(e,t),Bl.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=Bl.from(t),n=os(e,i.decimals);!i.signed&&n.lt(w3)&&D3("unsigned value cannot be negative","overflow","value",e);let a=null;i.signed?a=n.toTwos(i.width).toHexString():(a=n.toHexString(),a=Un(a,i.width/8));const c=Nl(n,i.decimals);return new Gr(lc,a,c,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=Bl.from(t);if(ir(e).length>i.width/8)throw new Error("overflow");let n=Gt.from(e);i.signed&&(n=n.fromTwos(i.width));const a=n.toTwos((i.signed?0:1)+i.width).toHexString(),c=Nl(n,i.decimals);return new Gr(lc,a,c,i)}static from(e,t){if(typeof e=="string")return Gr.fromString(e,t);if(Do(e))return Gr.fromBytes(e,t);try{return Gr.fromValue(e,0,t)}catch(i){if(i.code!==Mr.errors.INVALID_ARGUMENT)throw i}return Wr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}};const pg=E3.from(1),nx=E3.from("0.5"),sx="strings/5.7.0",ax=new Mr(sx);var Df;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Df||(Df={}));var gg;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(gg||(gg={}));function $l(r,e=Df.current){e!=Df.current&&(ax.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const a=r.charCodeAt(i);if(i>=r.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const c=65536+((n&1023)<<10)+(a&1023);t.push(c>>18|240),t.push(c>>12&63|128),t.push(c>>6&63|128),t.push(c&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ir(t)}function ox(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t{let a=n.split(":");t+=parseInt(a[0],16),i[t]=e(a[1])}),i}function bg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}bg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),Ul("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Ul("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Ul("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",ox),bg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function cx(r){r=atob(r);const e=[];for(let t=0;t0&&Array.isArray(f)?n(f,c-1):t.push(f)})};return n(r,e),t}function ux(r){const e={};for(let t=0;t>--g&1}const w=31,O=Math.pow(2,w),I=O>>>1,P=I>>1,q=O-1;let K=0;for(let j=0;j1;){let le=k+_>>>1;j>>1|m(),N=N<<1^I,se=(se^I)<<1|I|1;z=N,W=1+se-N}let B=i-4;return Y.map(j=>{switch(j-B){case 3:return B+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return B+256+(r[f++]<<8|r[f++]);case 1:return B+r[f++];default:return j-1}})}function hx(r){let e=0;return()=>r[e++]}function lx(r){return hx(fx(r))}function dx(r){return r&1?~r>>1:r>>1}function px(r,e){let t=Array(r);for(let i=0;ie[c]):t}function bx(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(mx(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(yx(t,r))}return ux(A3(e))}function vx(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function x3(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;ni[c].push(a));return i}function mx(r,e){let t=1+e(),i=e(),n=vx(e),a=x3(n.length,1+r,e);return A3(a.map((c,f)=>{const g=c[0],d=c.slice(1);return Array(n[f]).fill(void 0).map((m,w)=>{let O=w*i;return[g+w*t,d.map(I=>I+O)]})}))}function yx(r,e){let t=1+e();return x3(t,1+r,e).map(i=>[i[0],i.slice(1)])}function wx(r){let e=Ef(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let d=Ef(r,e);if(d.length==0)break;i.push({set:new Set(d),node:t()})}i.sort((d,m)=>m.set.size-d.set.size);let n=r(),a=n%3;n=n/3|0;let c=!!(n&1);n>>=1;let f=n==1,g=n==2;return{branches:i,valid:a,fe0f:c,save:f,check:g}}}function _x(){return lx(cx("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ku=_x();new Set(Ef(Ku)),new Set(Ef(Ku)),bx(Ku),wx(Ku);const Dx=new Uint8Array(32);Dx.fill(0);const Ex=`Ethereum Signed Message: +`;function S3(r){return typeof r=="string"&&(r=$l(r)),n0(YA([$l(Ex),$l(String(r.length)),r]))}const Ax="address/5.7.0",cc=new Mr(Ax);function mg(r){Ei(r,20)||cc.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ir(n0(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const xx=9007199254740991;function Sx(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const a0={};for(let r=0;r<10;r++)a0[String(r)]=String(r);for(let r=0;r<26;r++)a0[String.fromCharCode(65+r)]=String(10+r);const yg=Math.floor(Sx(xx));function Mx(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>a0[i]).join("");for(;e.length>=yg;){let i=e.substring(0,yg);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function Ix(r){let e=null;if(typeof r!="string"&&cc.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=mg(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&cc.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==Mx(r)&&cc.throwArgumentError("bad icap checksum","address",r),e=ix(r.substring(4));e.length<40;)e="0"+e;e=mg("0x"+e)}else cc.throwArgumentError("invalid address","address",r);return e}function Xo(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}const Cx=new Uint8Array(32);Cx.fill(0),Gt.from(-1);const Px=Gt.from(0),Ox=Gt.from(1);Gt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Un(Ox.toHexString(),32),Un(Px.toHexString(),32);var In={},Pt={},Nc=M3;function M3(r,e){if(!r)throw new Error(e||"Assertion failed")}M3.equal=function(r,e,t){if(r!=e)throw new Error(t||"Assertion failed: "+r+" != "+e)};var Dd={exports:{}};typeof Object.create=="function"?Dd.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:Dd.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}};var Tx=Nc,Rx=Dd.exports;Pt.inherits=Rx;function Nx(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function Bx(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n>6|192,t[i++]=a&63|128):Nx(r,n)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=a>>18|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128,t[i++]=a&63|128):(t[i++]=a>>12|224,t[i++]=a>>6&63|128,t[i++]=a&63|128)}else for(n=0;n>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Pt.htonl=I3;function Ux(r,e){for(var t="",i=0;i>>0}return a}Pt.join32=qx;function Lx(r,e){for(var t=new Array(r.length*4),i=0,n=0;i>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}Pt.split32=Lx;function Fx(r,e){return r>>>e|r<<32-e}Pt.rotr32=Fx;function zx(r,e){return r<>>32-e}Pt.rotl32=zx;function jx(r,e){return r+e>>>0}Pt.sum32=jx;function kx(r,e,t){return r+e+t>>>0}Pt.sum32_3=kx;function Hx(r,e,t,i){return r+e+t+i>>>0}Pt.sum32_4=Hx;function Kx(r,e,t,i,n){return r+e+t+i+n>>>0}Pt.sum32_5=Kx;function Vx(r,e,t,i){var n=r[e],a=r[e+1],c=i+a>>>0,f=(c>>0,r[e+1]=c}Pt.sum64=Vx;function Gx(r,e,t,i){var n=e+i>>>0,a=(n>>0}Pt.sum64_hi=Gx;function Jx(r,e,t,i){var n=e+i;return n>>>0}Pt.sum64_lo=Jx;function Wx(r,e,t,i,n,a,c,f){var g=0,d=e;d=d+i>>>0,g+=d>>0,g+=d>>0,g+=d>>0}Pt.sum64_4_hi=Wx;function Yx(r,e,t,i,n,a,c,f){var g=e+i+a+f;return g>>>0}Pt.sum64_4_lo=Yx;function Qx(r,e,t,i,n,a,c,f,g,d){var m=0,w=e;w=w+i>>>0,m+=w>>0,m+=w>>0,m+=w>>0,m+=w>>0}Pt.sum64_5_hi=Qx;function Xx(r,e,t,i,n,a,c,f,g,d){var m=e+i+a+f+d;return m>>>0}Pt.sum64_5_lo=Xx;function Zx(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Pt.rotr64_hi=Zx;function eS(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Pt.rotr64_lo=eS;function tS(r,e,t){return r>>>t}Pt.shr64_hi=tS;function rS(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Pt.shr64_lo=rS;var Eo={},wg=Pt,iS=Nc;function Vu(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Eo.BlockHash=Vu,Vu.prototype.update=function(r,e){if(r=wg.toArray(r,e),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){r=this.pending;var t=r.length%this._delta8;this.pending=r.slice(r.length-t,r.length),this.pending.length===0&&(this.pending=null),r=wg.join32(r,0,r.length-t,this.endian);for(var i=0;i>>24&255,i[n++]=r>>>16&255,i[n++]=r>>>8&255,i[n++]=r&255}else for(i[n++]=r&255,i[n++]=r>>>8&255,i[n++]=r>>>16&255,i[n++]=r>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a>>3}Wn.g0_256=cS;function uS(r){return qn(r,17)^qn(r,19)^r>>>10}Wn.g1_256=uS;var fo=Pt,fS=Eo,hS=Wn,ql=fo.rotl32,Zo=fo.sum32,lS=fo.sum32_5,dS=hS.ft_1,N3=fS.BlockHash,pS=[1518500249,1859775393,2400959708,3395469782];function Tn(){if(!(this instanceof Tn))return new Tn;N3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}fo.inherits(Tn,N3);var gS=Tn;Tn.blockSize=512,Tn.outSize=160,Tn.hmacStrength=80,Tn.padLength=64,Tn.prototype._update=function(r,e){for(var t=this.W,i=0;i<16;i++)t[i]=r[e+i];for(;ithis.blockSize&&(r=new this.Hash().update(r).digest()),rM(r.length<=this.blockSize);for(var e=r.length;e>8,O=m&255;w?g.push(w,O):g.push(O)}return g}t.toArray=i;function n(c){return c.length===1?"0"+c:c}t.zero2=n;function a(c){for(var f="",g=0;g(O>>1)-1?q=(O>>1)-K:q=K,I.isubn(q)):q=0,w[P]=q,I.iushrn(1)}return w}t.getNAF=i;function n(g,d){var m=[[],[]];g=g.clone(),d=d.clone();for(var w=0,O=0,I;g.cmpn(-w)>0||d.cmpn(-O)>0;){var P=g.andln(3)+w&3,q=d.andln(3)+O&3;P===3&&(P=-1),q===3&&(q=-1);var K;P&1?(I=g.andln(7)+w&7,(I===3||I===5)&&q===2?K=-P:K=P):K=0,m[0].push(K);var Y;q&1?(I=d.andln(7)+O&7,(I===3||I===5)&&P===2?Y=-q:Y=q):Y=0,m[1].push(Y),2*w===K+1&&(w=1-w),2*O===Y+1&&(O=1-O),g.iushrn(1),d.iushrn(1)}return m}t.getJSF=n;function a(g,d,m){var w="_"+d;g.prototype[d]=function(){return this[w]!==void 0?this[w]:this[w]=m.call(this)}}t.cachedProperty=a;function c(g){return typeof g=="string"?t.toArray(g,"hex"):g}t.parseBytes=c;function f(g){return new bt(g,"hex","le")}t.intFromLE=f}),Ju=Ai.getNAF,sM=Ai.getJSF,Af=Ai.assert;function $s(r,e){this.type=r,this.p=new bt(e.p,16),this.red=e.prime?bt.red(e.prime):bt.mont(this.p),this.zero=new bt(0).toRed(this.red),this.one=new bt(1).toRed(this.red),this.two=new bt(2).toRed(this.red),this.n=e.n&&new bt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var xa=$s;$s.prototype.point=function(){throw new Error("Not implemented")},$s.prototype.validate=function(){throw new Error("Not implemented")},$s.prototype._fixedNafMul=function(r,e){Af(r.precomputed);var t=r._getDoubles(),i=Ju(e,1,this._bitLength),n=(1<=c;g--)f=(f<<1)+i[g];a.push(f)}for(var d=this.jpoint(null,null,null),m=this.jpoint(null,null,null),w=n;w>0;w--){for(c=0;c=0;f--){for(var g=0;f>=0&&a[f]===0;f--)g++;if(f>=0&&g++,c=c.dblp(g),f<0)break;var d=a[f];Af(d!==0),r.type==="affine"?d>0?c=c.mixedAdd(n[d-1>>1]):c=c.mixedAdd(n[-d-1>>1].neg()):d>0?c=c.add(n[d-1>>1]):c=c.add(n[-d-1>>1].neg())}return r.type==="affine"?c.toP():c},$s.prototype._wnafMulAdd=function(r,e,t,i,n){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,g=0,d,m,w;for(d=0;d=1;d-=2){var I=d-1,P=d;if(a[I]!==1||a[P]!==1){f[I]=Ju(t[I],a[I],this._bitLength),f[P]=Ju(t[P],a[P],this._bitLength),g=Math.max(f[I].length,g),g=Math.max(f[P].length,g);continue}var q=[e[I],null,null,e[P]];e[I].y.cmp(e[P].y)===0?(q[1]=e[I].add(e[P]),q[2]=e[I].toJ().mixedAdd(e[P].neg())):e[I].y.cmp(e[P].y.redNeg())===0?(q[1]=e[I].toJ().mixedAdd(e[P]),q[2]=e[I].add(e[P].neg())):(q[1]=e[I].toJ().mixedAdd(e[P]),q[2]=e[I].toJ().mixedAdd(e[P].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],Y=sM(t[I],t[P]);for(g=Math.max(Y[0].length,g),f[I]=new Array(g),f[P]=new Array(g),m=0;m=0;d--){for(var k=0;d>=0;){var _=!0;for(m=0;m=0&&k++,B=B.dblp(k),d<0)break;for(m=0;m0?w=c[m][N-1>>1]:N<0&&(w=c[m][-N-1>>1].neg()),w.type==="affine"?B=B.mixedAdd(w):B=B.add(w))}}for(d=0;d=Math.ceil((r.bitLength()+1)/e.step):!1},qi.prototype._getDoubles=function(r,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var t=[this],i=this,n=0;n=0&&(O=g,I=d),m.negative&&(m=m.neg(),w=w.neg()),O.negative&&(O=O.neg(),I=I.neg()),[{a:m,b:w},{a:O,b:I}]},ki.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],i=e[1],n=i.b.mul(r).divRound(this.n),a=t.b.neg().mul(r).divRound(this.n),c=n.mul(t.a),f=a.mul(i.a),g=n.mul(t.b),d=a.mul(i.b),m=r.sub(c).sub(f),w=g.add(d).neg();return{k1:m,k2:w}},ki.prototype.pointFromX=function(r,e){r=new bt(r,16),r.red||(r=r.toRed(this.red));var t=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=t.redSqrt();if(i.redSqr().redSub(t).cmp(this.zero)!==0)throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(r,i)},ki.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return t.redSqr().redISub(n).cmpn(0)===0},ki.prototype._endoWnafMulAdd=function(r,e,t){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},yr.prototype.isInfinity=function(){return this.inf},yr.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(this.x.cmp(r.x)===0)return this.curve.point(null,null);var e=this.y.redSub(r.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),i=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,i)},yr.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(r.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),i=r.redInvm(),n=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),c=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},yr.prototype.getX=function(){return this.x.fromRed()},yr.prototype.getY=function(){return this.y.fromRed()},yr.prototype.mul=function(r){return r=new bt(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},yr.prototype.mulAdd=function(r,e,t){var i=[this,e],n=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},yr.prototype.jmulAdd=function(r,e,t){var i=[this,e],n=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},yr.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||this.x.cmp(r.x)===0&&this.y.cmp(r.y)===0)},yr.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,i=function(n){return n.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e},yr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var r=this.curve.jpoint(this.x,this.y,this.curve.one);return r};function Sr(r,e,t,i){xa.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bt(0)):(this.x=new bt(e,16),this.y=new bt(t,16),this.z=new bt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}c0(Sr,xa.BasePoint),ki.prototype.jpoint=function(r,e,t){return new Sr(this,r,e,t)},Sr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),i=this.y.redMul(e).redMul(r);return this.curve.point(t,i)},Sr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Sr.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),i=this.x.redMul(e),n=r.x.redMul(t),a=this.y.redMul(e.redMul(r.z)),c=r.y.redMul(t.redMul(this.z)),f=i.redSub(n),g=a.redSub(c);if(f.cmpn(0)===0)return g.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=f.redSqr(),m=d.redMul(f),w=i.redMul(d),O=g.redSqr().redIAdd(m).redISub(w).redISub(w),I=g.redMul(w.redISub(O)).redISub(a.redMul(m)),P=this.z.redMul(r.z).redMul(f);return this.curve.jpoint(O,I,P)},Sr.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,i=r.x.redMul(e),n=this.y,a=r.y.redMul(e).redMul(this.z),c=t.redSub(i),f=n.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=c.redSqr(),d=g.redMul(c),m=t.redMul(g),w=f.redSqr().redIAdd(d).redISub(m).redISub(m),O=f.redMul(m.redISub(w)).redISub(n.redMul(d)),I=this.z.redMul(c);return this.curve.jpoint(w,O,I)},Sr.prototype.dblp=function(r){if(r===0)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var t=this;for(e=0;e=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},Sr.prototype.inspect=function(){return this.isInfinity()?"":""},Sr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var af=xo(function(r,e){var t=e;t.base=xa,t.short=oM,t.mont=null,t.edwards=null}),of=xo(function(r,e){var t=e,i=Ai.assert;function n(f){f.type==="short"?this.curve=new af.short(f):f.type==="edwards"?this.curve=new af.edwards(f):this.curve=new af.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function a(f,g){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var d=new n(g);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:d}),d}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:In.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:In.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:In.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:In.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:In.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:In.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:In.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:In.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Us(r){if(!(this instanceof Us))return new Us(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=gn.toArray(r.entropy,r.entropyEnc||"hex"),t=gn.toArray(r.nonce,r.nonceEnc||"hex"),i=gn.toArray(r.pers,r.persEnc||"hex");o0(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Ag=Us;Us.prototype._init=function(r,e,t){var i=r.concat(e).concat(t);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(r.concat(t||[])),this._reseed=1},Us.prototype.generate=function(r,e,t,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=t,t=e,e=null),t&&(t=gn.toArray(t,i||"hex"),this._update(t));for(var n=[];n.length"};var cM=Ai.assert;function Xf(r,e){if(r instanceof Xf)return r;this._importDER(r,e)||(cM(r.r&&r.s,"Signature without r or s"),this.r=new bt(r.r,16),this.s=new bt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var Wu=Xf;function uM(){this.place=0}function kl(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,a=0,c=e.place;a>>=0;return n<=127?!1:(e.place=c,n)}function xg(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Xf.prototype.toDER=function(r){var e=this.r.toArray(),t=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t)),e=xg(e),t=xg(t);!t[0]&&!(t[1]&128);)t=t.slice(1);var i=[2];Hl(i,e.length),i=i.concat(e),i.push(2),Hl(i,t.length);var n=i.concat(t),a=[48];return Hl(a,n.length),a=a.concat(n),Ai.encode(a,r)};var fM=function(){throw new Error("unsupported")},V3=Ai.assert;function zi(r){if(!(this instanceof zi))return new zi(r);typeof r=="string"&&(V3(Object.prototype.hasOwnProperty.call(of,r),"Unknown curve "+r),r=of[r]),r instanceof of.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var hM=zi;zi.prototype.keyPair=function(r){return new jl(this,r)},zi.prototype.keyFromPrivate=function(r,e){return jl.fromPrivate(this,r,e)},zi.prototype.keyFromPublic=function(r,e){return jl.fromPublic(this,r,e)},zi.prototype.genKeyPair=function(r){r||(r={});for(var e=new Ag({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||fM(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),t=this.n.byteLength(),i=this.n.sub(new bt(2));;){var n=new bt(e.generate(t));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},zi.prototype._truncateToN=function(r,e){var t=r.byteLength()*8-this.n.bitLength();return t>0&&(r=r.ushrn(t)),!e&&r.cmp(this.n)>=0?r.sub(this.n):r},zi.prototype.sign=function(r,e,t,i){typeof t=="object"&&(i=t,t=null),i||(i={}),e=this.keyFromPrivate(e,t),r=this._truncateToN(new bt(r,16));for(var n=this.n.byteLength(),a=e.getPrivate().toArray("be",n),c=r.toArray("be",n),f=new Ag({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),g=this.n.sub(new bt(1)),d=0;;d++){var m=i.k?i.k(d):new bt(f.generate(this.n.byteLength()));if(m=this._truncateToN(m,!0),!(m.cmpn(1)<=0||m.cmp(g)>=0)){var w=this.g.mul(m);if(!w.isInfinity()){var O=w.getX(),I=O.umod(this.n);if(I.cmpn(0)!==0){var P=m.invm(this.n).mul(I.mul(e.getPrivate()).iadd(r));if(P=P.umod(this.n),P.cmpn(0)!==0){var q=(w.getY().isOdd()?1:0)|(O.cmp(I)!==0?2:0);return i.canonical&&P.cmp(this.nh)>0&&(P=this.n.sub(P),q^=1),new Wu({r:I,s:P,recoveryParam:q})}}}}}},zi.prototype.verify=function(r,e,t,i){r=this._truncateToN(new bt(r,16)),t=this.keyFromPublic(t,i),e=new Wu(e,"hex");var n=e.r,a=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(r).umod(this.n),g=c.mul(n).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(f,t.getPublic(),g),d.isInfinity()?!1:d.eqXToP(n)):(d=this.g.mulAdd(f,t.getPublic(),g),d.isInfinity()?!1:d.getX().umod(this.n).cmp(n)===0)},zi.prototype.recoverPubKey=function(r,e,t,i){V3((3&t)===t,"The recovery param is more than two bits"),e=new Wu(e,i);var n=this.n,a=new bt(r),c=e.r,f=e.s,g=t&1,d=t>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?c=this.curve.pointFromX(c.add(this.curve.n),g):c=this.curve.pointFromX(c,g);var m=e.r.invm(n),w=n.sub(a).mul(m).umod(n),O=f.mul(m).umod(n);return this.g.mulAdd(w,c,O)},zi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Wu(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(r,e,n)}catch{continue}if(a.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var lM=xo(function(r,e){var t=e;t.version="6.5.4",t.utils=Ai,t.rand=function(){throw new Error("unsupported")},t.curve=af,t.curves=of,t.ec=hM,t.eddsa=null}),dM=lM.ec;const pM="signing-key/5.7.0",xd=new Mr(pM);let Kl=null;function Ns(){return Kl||(Kl=new dM("secp256k1")),Kl}class gM{constructor(e){Xo(this,"curve","secp256k1"),Xo(this,"privateKey",ui(e)),XA(this.privateKey)!==32&&xd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Ns().keyFromPrivate(ir(this.privateKey));Xo(this,"publicKey","0x"+t.getPublic(!1,"hex")),Xo(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Xo(this,"_isSigningKey",!0)}_addPoint(e){const t=Ns().keyFromPublic(ir(this.publicKey)),i=Ns().keyFromPublic(ir(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Ns().keyFromPrivate(ir(this.privateKey)),i=ir(e);i.length!==32&&xd.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return v3({recoveryParam:n.recoveryParam,r:Un("0x"+n.r.toString(16),32),s:Un("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Ns().keyFromPrivate(ir(this.privateKey)),i=Ns().keyFromPublic(ir(G3(e)));return Un("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function bM(r,e){const t=v3(e),i={r:ir(t.r),s:ir(t.s)};return"0x"+Ns().recoverPubKey(ir(r),i,t.recoveryParam).encode("hex",!1)}function G3(r,e){const t=ir(r);return t.length===32?new gM(t).publicKey:t.length===33?"0x"+Ns().keyFromPublic(t).getPublic(!1,"hex"):t.length===65?ui(t):xd.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Sg;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Sg||(Sg={}));function vM(r){const e=G3(r);return Ix(hg(n0(hg(e,1)),12))}function mM(r,e){return vM(bM(ir(r),e))}const yM="https://rpc.walletconnect.org/v1";async function wM(r,e,t,i,n,a){switch(t.t){case"eip191":return _M(r,e,t.s);case"eip1271":return await DM(r,e,t.s,i,n,a);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function _M(r,e,t){return mM(S3(e),t).toLowerCase()===r.toLowerCase()}async function DM(r,e,t,i,n,a){try{const c="0x1626ba7e",f="0000000000000000000000000000000000000000000000000000000000000040",g="0000000000000000000000000000000000000000000000000000000000000041",d=t.substring(2),m=S3(e).substring(2),w=c+m+f+g+d,O=await fetch(`${a||yM}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:EM(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:w},"latest"]})}),{result:I}=await O.json();return I?I.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function EM(){return Date.now()+Math.floor(Math.random()*1e3)}var AM=Object.defineProperty,xM=Object.defineProperties,SM=Object.getOwnPropertyDescriptors,Mg=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,IM=Object.prototype.propertyIsEnumerable,Ig=(r,e,t)=>e in r?AM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,CM=(r,e)=>{for(var t in e||(e={}))MM.call(e,t)&&Ig(r,t,e[t]);if(Mg)for(var t of Mg(e))IM.call(e,t)&&Ig(r,t,e[t]);return r},PM=(r,e)=>xM(r,SM(e));const OM="did:pkh:",u0=r=>r==null?void 0:r.split(":"),J3=r=>{const e=r&&u0(r);if(e)return r.includes(OM)?e[3]:e[1]},Cg=r=>{const e=r&&u0(r);if(e)return e[2]+":"+e[3]},xf=r=>{const e=r&&u0(r);if(e)return e.pop()};async function Pg(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,a=W3(n,n.iss),c=xf(n.iss);return await wM(c,a,i,J3(n.iss),t)}const W3=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=xf(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const a=`URI: ${r.aud||r.uri}`,c=`Version: ${r.version}`,f=`Chain ID: ${J3(e)}`,g=`Nonce: ${r.nonce}`,d=`Issued At: ${r.iat}`,m=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,O=r.requestId?`Request ID: ${r.requestId}`:void 0,I=r.resources?`Resources:${r.resources.map(q=>` +- ${q}`).join("")}`:void 0,P=cf(r.resources);if(P){const q=wc(P);n=FM(n,q)}return[t,i,"",n,"",a,c,f,g,d,m,w,O,I].filter(q=>q!=null).join(` +`)};function TM(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function RM(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function wa(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const a=i[n];if(!Array.isArray(a))throw new Error(`Ability limits ${n} must be an array of objects, found: ${a}`);if(!a.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);a.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${c}`)})})})}function NM(r,e,t,i={}){return t==null||t.sort((n,a)=>n.localeCompare(a)),{att:{[r]:BM(e,t,i)}}}function BM(r,e,t={}){e=e==null?void 0:e.sort((n,a)=>n.localeCompare(a));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function Y3(r){return wa(r),`urn:recap:${TM(r).replace(/=/g,"")}`}function wc(r){const e=RM(r.replace("urn:recap:",""));return wa(e),e}function $M(r,e,t){const i=NM(r,e,t);return Y3(i)}function UM(r){return r&&r.includes("urn:recap:")}function qM(r,e){const t=wc(r),i=wc(e),n=LM(t,i);return Y3(n)}function LM(r,e){wa(r),wa(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,a)=>n.localeCompare(a)),i={att:{}};return t.forEach(n=>{var a,c;Object.keys(((a=r.att)==null?void 0:a[n])||{}).concat(Object.keys(((c=e.att)==null?void 0:c[n])||{})).sort((f,g)=>f.localeCompare(g)).forEach(f=>{var g,d;i.att[n]=PM(CM({},i.att[n]),{[f]:((g=r.att[n])==null?void 0:g[f])||((d=e.att[n])==null?void 0:d[f])})})}),i}function FM(r="",e){wa(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const g=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));g.sort((w,O)=>w.action.localeCompare(O.action));const d={};g.forEach(w=>{d[w.ability]||(d[w.ability]=[]),d[w.ability].push(w.action)});const m=Object.keys(d).map(w=>(n++,`(${n}) '${w}': '${d[w].join("', '")}' for '${f}'.`));i.push(m.join(", ").replace(".,","."))});const a=i.join(" "),c=`${t}${a}`;return`${r?r+" ":""}${c}`}function Og(r){var e;const t=wc(r);wa(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function Tg(r){const e=wc(r);wa(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var a;(a=n==null?void 0:n[0])!=null&&a.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function cf(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return UM(e)?e:void 0}const Q3="base10",Yr="base16",Ls="base64pad",tc="base64url",Bc="utf8",X3=0,bs=1,$c=2,zM=0,Rg=1,pc=12,f0=32;function jM(){const r=Gd.generateKeyPair();return{privateKey:Di(r.secretKey,Yr),publicKey:Di(r.publicKey,Yr)}}function Sd(){const r=ks.randomBytes(f0);return Di(r,Yr)}function kM(r,e){const t=Gd.sharedKey(Hi(r,Yr),Hi(e,Yr),!0),i=new V_(Mc.SHA256,t).expand(f0);return Di(i,Yr)}function uf(r){const e=Mc.hash(Hi(r,Yr));return Di(e,Yr)}function ls(r){const e=Mc.hash(Hi(r,Bc));return Di(e,Yr)}function Z3(r){return Hi(`${r}`,Q3)}function _a(r){return Number(Di(r,Q3))}function HM(r){const e=Z3(typeof r.type<"u"?r.type:X3);if(_a(e)===bs&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Hi(r.senderPublicKey,Yr):void 0,i=typeof r.iv<"u"?Hi(r.iv,Yr):ks.randomBytes(pc),n=new Kd.ChaCha20Poly1305(Hi(r.symKey,Yr)).seal(i,Hi(r.message,Bc));return e2({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function KM(r,e){const t=Z3($c),i=ks.randomBytes(pc),n=Hi(r,Bc);return e2({type:t,sealed:n,iv:i,encoding:e})}function VM(r){const e=new Kd.ChaCha20Poly1305(Hi(r.symKey,Yr)),{sealed:t,iv:i}=_c({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return Di(n,Bc)}function GM(r,e){const{sealed:t}=_c({encoded:r,encoding:e});return Di(t,Bc)}function e2(r){const{encoding:e=Ls}=r;if(_a(r.type)===$c)return Di(wl([r.type,r.sealed]),e);if(_a(r.type)===bs){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Di(wl([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return Di(wl([r.type,r.iv,r.sealed]),e)}function _c(r){const{encoded:e,encoding:t=Ls}=r,i=Hi(e,t),n=i.slice(zM,Rg),a=Rg;if(_a(n)===bs){const d=a+f0,m=d+pc,w=i.slice(a,d),O=i.slice(d,m),I=i.slice(m);return{type:n,sealed:I,iv:O,senderPublicKey:w}}if(_a(n)===$c){const d=i.slice(a),m=ks.randomBytes(pc);return{type:n,sealed:d,iv:m}}const c=a+pc,f=i.slice(a,c),g=i.slice(c);return{type:n,sealed:g,iv:f}}function JM(r,e){const t=_c({encoded:r,encoding:e==null?void 0:e.encoding});return t2({type:_a(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Di(t.senderPublicKey,Yr):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function t2(r){const e=(r==null?void 0:r.type)||X3;if(e===bs){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function Ng(r){return r.type===bs&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function Bg(r){return r.type===$c}function WM(r){return new Av.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function YM(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function QM(r){return Buffer.from(YM(r),"base64")}function XM(r,e){const[t,i,n]=r.split("."),a=QM(n);if(a.length!==64)throw new Error("Invalid signature length");const c=a.slice(0,32).toString("hex"),f=a.slice(32,64).toString("hex"),g=`${t}.${i}`,d=new Mc.SHA256().update(Buffer.from(g)).digest(),m=WM(e),w=Buffer.from(d).toString("hex");if(!m.verify(w,{r:c,s:f}))throw new Error("Invalid signature");return yd(r).payload}const ZM="irn";function Md(r){return(r==null?void 0:r.relay)||{protocol:ZM}}function uc(r){const e=AA[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var eI=Object.defineProperty,tI=Object.defineProperties,rI=Object.getOwnPropertyDescriptors,$g=Object.getOwnPropertySymbols,iI=Object.prototype.hasOwnProperty,nI=Object.prototype.propertyIsEnumerable,Ug=(r,e,t)=>e in r?eI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qg=(r,e)=>{for(var t in e||(e={}))iI.call(e,t)&&Ug(r,t,e[t]);if($g)for(var t of $g(e))nI.call(e,t)&&Ug(r,t,e[t]);return r},sI=(r,e)=>tI(r,rI(e));function aI(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const a=n.replace(i,""),c=r[n];t[a]=c}}),t}function Lg(r){if(!r.includes("wc:")){const g=d3(r);g!=null&&g.includes("wc:")&&(r=g)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",c=mc.parse(a),f=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:i,topic:oI(n[0]),version:parseInt(n[1],10),symKey:c.symKey,relay:aI(c),methods:f,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function oI(r){return r.startsWith("//")?r.substring(2):r}function cI(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const a=t+e+n;r[n]&&(i[a]=r[n])}),i}function Fg(r){return`${r.protocol}:${r.topic}@${r.version}?`+mc.stringify(qg(sI(qg({symKey:r.symKey},cI(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function Yu(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function So(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function uI(r){const e=[];return Object.values(r).forEach(t=>{e.push(...So(t.accounts))}),e}function fI(r,e){const t=[];return Object.values(r).forEach(i=>{So(i.accounts).includes(e)&&t.push(...i.methods)}),t}function hI(r,e){const t=[];return Object.values(r).forEach(i=>{So(i.accounts).includes(e)&&t.push(...i.events)}),t}function h0(r){return r.includes(":")}function fc(r){return h0(r)?r.split(":")[0]:r}function lI(r){const e={};return r==null||r.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function zg(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=lI(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=nf(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const dI={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},pI={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function De(r,e){const{message:t,code:i}=pI[r];return{message:e?`${t} ${e}`:t,code:i}}function Lt(r,e){const{message:t,code:i}=dI[r];return{message:e?`${t} ${e}`:t,code:i}}function Kn(r,e){return!!Array.isArray(r)}function Dc(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function fi(r){return typeof r>"u"}function ur(r,e){return e&&fi(r)?!0:typeof r=="string"&&!!r.trim().length}function l0(r,e){return typeof r=="number"&&!isNaN(r)}function gI(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let a=!0;return da(n,i)?(i.forEach(c=>{const{accounts:f,methods:g,events:d}=r.namespaces[c],m=So(f),w=t[c];(!da(a3(c,w),m)||!da(w.methods,g)||!da(w.events,d))&&(a=!1)}),a):!1}function Sf(r){return ur(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function bI(r){if(ur(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Sf(t)}}return!1}function vI(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(ur(r,!1)){if(e(r))return!0;const t=d3(r);return e(t)}}catch{}return!1}function mI(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function yI(r){return r==null?void 0:r.topic}function wI(r,e){let t=null;return ur(r==null?void 0:r.publicKey,!1)||(t=De("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function jg(r){let e=!0;return Kn(r)?r.length&&(e=r.every(t=>ur(t,!1))):e=!1,e}function _I(r,e,t){let i=null;return Kn(e)&&e.length?e.forEach(n=>{i||Sf(n)||(i=Lt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Sf(r)||(i=Lt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function DI(r,e,t){let i=null;return Object.entries(r).forEach(([n,a])=>{if(i)return;const c=_I(n,a3(n,a),`${e} ${t}`);c&&(i=c)}),i}function EI(r,e){let t=null;return Kn(r)?r.forEach(i=>{t||bI(i)||(t=Lt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Lt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function AI(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=EI(i==null?void 0:i.accounts,`${e} namespace`);n&&(t=n)}),t}function xI(r,e){let t=null;return jg(r==null?void 0:r.methods)?jg(r==null?void 0:r.events)||(t=Lt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Lt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function r2(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=xI(i,`${e}, namespace`);n&&(t=n)}),t}function SI(r,e,t){let i=null;if(r&&Dc(r)){const n=r2(r,e);n&&(i=n);const a=DI(r,e,t);a&&(i=a)}else i=De("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function Vl(r,e){let t=null;if(r&&Dc(r)){const i=r2(r,e);i&&(t=i);const n=AI(r,e);n&&(t=n)}else t=De("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function i2(r){return ur(r.protocol,!0)}function MI(r,e){let t=!1;return r?r&&Kn(r)&&r.length&&r.forEach(i=>{t=i2(i)}):t=!0,t}function II(r){return typeof r=="number"}function ci(r){return typeof r<"u"&&typeof r!==null}function CI(r){return!(!r||typeof r!="object"||!r.code||!l0(r.code)||!r.message||!ur(r.message,!1))}function PI(r){return!(fi(r)||!ur(r.method,!1))}function OI(r){return!(fi(r)||fi(r.result)&&fi(r.error)||!l0(r.id)||!ur(r.jsonrpc,!1))}function TI(r){return!(fi(r)||!ur(r.name,!1))}function kg(r,e){return!(!Sf(e)||!uI(r).includes(e))}function RI(r,e,t){return ur(t,!1)?fI(r,e).includes(t):!1}function NI(r,e,t){return ur(t,!1)?hI(r,e).includes(t):!1}function Hg(r,e,t){let i=null;const n=BI(r),a=$I(e),c=Object.keys(n),f=Object.keys(a),g=Kg(Object.keys(r)),d=Kg(Object.keys(e)),m=g.filter(w=>!d.includes(w));return m.length&&(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces. Required: ${m.toString()} - Received: ${Object.keys(e).toString()}`)),la(c,f)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),da(c,f)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces. Required: ${c.toString()} - Approved: ${f.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||i)return;const O=xo(e[w].accounts);O.includes(w)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w} + Approved: ${f.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||i)return;const O=So(e[w].accounts);O.includes(w)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w} Required: ${w} - Approved: ${O.toString()}`))}),c.forEach(w=>{i||(la(n[w].methods,a[w].methods)?la(n[w].events,a[w].events)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function BI(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function Hg(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function $I(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=xo(r[t].accounts);i==null||i.forEach(n=>{e[n]={accounts:r[t].accounts.filter(a=>a.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function UI(r,e){return h0(r)&&r<=e.max&&r>=e.min}function Kg(){const r=Tc();return new Promise(e=>{switch(r){case _i.browser:e(qI());break;case _i.reactNative:e(LI());break;case _i.node:e(FI());break;default:e(!0)}})}function qI(){return Oc()&&(navigator==null?void 0:navigator.onLine)}async function LI(){if(wo()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const r=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function FI(){return!0}function zI(r){switch(Tc()){case _i.browser:jI(r);break;case _i.reactNative:kI(r);break}}function jI(r){!wo()&&Oc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function kI(r){wo()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}const Vl={};class tc{static get(e){return Vl[e]}static set(e,t){Vl[e]=t}static delete(e){delete Vl[e]}}class xa{}let HI=class extends xa{constructor(e){super()}};const Vg=Ae.FIVE_SECONDS,So={pulse:"heartbeat_pulse"};let KI=class n2 extends HI{constructor(e){super(e),this.events=new Vi.EventEmitter,this.interval=Vg,this.interval=(e==null?void 0:e.interval)||Vg}static async init(e){const t=new n2(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Ae.toMiliseconds(this.interval))}pulse(){this.events.emit(So.pulse)}};const VI=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,GI=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,JI=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function WI(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){YI(r);return}return e}function YI(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Yu(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!JI.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(VI.test(r)||GI.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,WI)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function QI(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function _r(r,...e){try{return QI(r(...e))}catch(t){return Promise.reject(t)}}function XI(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function ZI(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function uf(r){if(XI(r))return String(r);if(ZI(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return uf(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function s2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const Md="base64:";function eC(r){if(typeof r=="string")return r;s2();const e=Buffer.from(r).toString("base64");return Md+e}function tC(r){return typeof r!="string"||!r.startsWith(Md)?r:(s2(),Buffer.from(r.slice(Md.length),"base64"))}function oi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function rC(...r){return oi(r.join(":"))}function Qu(r){return r=oi(r),r?r+":":""}const iC="memory",nC=()=>{const r=new Map;return{name:iC,getInstance:()=>r,hasItem(e){return r.has(e)},getItem(e){return r.get(e)??null},getItemRaw(e){return r.get(e)??null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function sC(r={}){const e={mounts:{"":r.driver||nC()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=d=>{for(const m of e.mountpoints)if(d.startsWith(m))return{base:m,relativeKey:d.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:d,driver:e.mounts[""]}},i=(d,m)=>e.mountpoints.filter(w=>w.startsWith(d)||m&&d.startsWith(w)).map(w=>({relativeBase:d.length>w.length?d.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(d,m)=>{if(e.watching){m=oi(m);for(const w of e.watchListeners)w(d,m)}},a=async()=>{if(!e.watching){e.watching=!0;for(const d in e.mounts)e.unwatch[d]=await Gg(e.mounts[d],n,d)}},c=async()=>{if(e.watching){for(const d in e.unwatch)await e.unwatch[d]();e.unwatch={},e.watching=!1}},f=(d,m,w)=>{const O=new Map,C=P=>{let q=O.get(P.base);return q||(q={driver:P.driver,base:P.base,items:[]},O.set(P.base,q)),q};for(const P of d){const q=typeof P=="string",K=oi(q?P:P.key),Y=q?void 0:P.value,z=q||!P.options?m:{...m,...P.options},W=t(K);C(W).items.push({key:K,value:Y,relativeKey:W.relativeKey,options:z})}return Promise.all([...O.values()].map(P=>w(P))).then(P=>P.flat())},g={hasItem(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return _r(O.hasItem,w,m)},getItem(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return _r(O.getItem,w,m).then(C=>Yu(C))},getItems(d,m){return f(d,m,w=>w.driver.getItems?_r(w.driver.getItems,w.items.map(O=>({key:O.relativeKey,options:O.options})),m).then(O=>O.map(C=>({key:rC(w.base,C.key),value:Yu(C.value)}))):Promise.all(w.items.map(O=>_r(w.driver.getItem,O.relativeKey,O.options).then(C=>({key:O.key,value:Yu(C)})))))},getItemRaw(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return O.getItemRaw?_r(O.getItemRaw,w,m):_r(O.getItem,w,m).then(C=>tC(C))},async setItem(d,m,w={}){if(m===void 0)return g.removeItem(d);d=oi(d);const{relativeKey:O,driver:C}=t(d);C.setItem&&(await _r(C.setItem,O,uf(m),w),C.watch||n("update",d))},async setItems(d,m){await f(d,m,async w=>{if(w.driver.setItems)return _r(w.driver.setItems,w.items.map(O=>({key:O.relativeKey,value:uf(O.value),options:O.options})),m);w.driver.setItem&&await Promise.all(w.items.map(O=>_r(w.driver.setItem,O.relativeKey,uf(O.value),O.options)))})},async setItemRaw(d,m,w={}){if(m===void 0)return g.removeItem(d,w);d=oi(d);const{relativeKey:O,driver:C}=t(d);if(C.setItemRaw)await _r(C.setItemRaw,O,m,w);else if(C.setItem)await _r(C.setItem,O,eC(m),w);else return;C.watch||n("update",d)},async removeItem(d,m={}){typeof m=="boolean"&&(m={removeMeta:m}),d=oi(d);const{relativeKey:w,driver:O}=t(d);O.removeItem&&(await _r(O.removeItem,w,m),(m.removeMeta||m.removeMata)&&await _r(O.removeItem,w+"$",m),O.watch||n("remove",d))},async getMeta(d,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),d=oi(d);const{relativeKey:w,driver:O}=t(d),C=Object.create(null);if(O.getMeta&&Object.assign(C,await _r(O.getMeta,w,m)),!m.nativeOnly){const P=await _r(O.getItem,w+"$",m).then(q=>Yu(q));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(C,P))}return C},setMeta(d,m,w={}){return this.setItem(d+"$",m,w)},removeMeta(d,m={}){return this.removeItem(d+"$",m)},async getKeys(d,m={}){d=Qu(d);const w=i(d,!0);let O=[];const C=[];for(const P of w){const q=await _r(P.driver.getKeys,P.relativeBase,m);for(const K of q){const Y=P.mountpoint+oi(K);O.some(z=>Y.startsWith(z))||C.push(Y)}O=[P.mountpoint,...O.filter(K=>!K.startsWith(P.mountpoint))]}return d?C.filter(P=>P.startsWith(d)&&P[P.length-1]!=="$"):C.filter(P=>P[P.length-1]!=="$")},async clear(d,m={}){d=Qu(d),await Promise.all(i(d,!1).map(async w=>{if(w.driver.clear)return _r(w.driver.clear,w.relativeBase,m);if(w.driver.removeItem){const O=await w.driver.getKeys(w.relativeBase||"",m);return Promise.all(O.map(C=>w.driver.removeItem(C,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(d=>Jg(d)))},async watch(d){return await a(),e.watchListeners.push(d),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==d),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(d,m){if(d=Qu(d),d&&e.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(e.mountpoints.push(d),e.mountpoints.sort((w,O)=>O.length-w.length)),e.mounts[d]=m,e.watching&&Promise.resolve(Gg(m,n,d)).then(w=>{e.unwatch[d]=w}).catch(console.error),g},async unmount(d,m=!0){d=Qu(d),!(!d||!e.mounts[d])&&(e.watching&&d in e.unwatch&&(e.unwatch[d](),delete e.unwatch[d]),m&&await Jg(e.mounts[d]),e.mountpoints=e.mountpoints.filter(w=>w!==d),delete e.mounts[d])},getMount(d=""){d=oi(d)+":";const m=t(d);return{driver:m.driver,base:m.base}},getMounts(d="",m={}){return d=oi(d),i(d,m.parents).map(O=>({driver:O.driver,base:O.mountpoint}))},keys:(d,m={})=>g.getKeys(d,m),get:(d,m={})=>g.getItem(d,m),set:(d,m,w={})=>g.setItem(d,m,w),has:(d,m={})=>g.hasItem(d,m),del:(d,m={})=>g.removeItem(d,m),remove:(d,m={})=>g.removeItem(d,m)};return g}function Gg(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Jg(r){typeof r.dispose=="function"&&await _r(r.dispose)}function Sa(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function a2(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=Sa(t);return(n,a)=>i.then(c=>a(c.transaction(e,n).objectStore(e)))}let Gl;function $c(){return Gl||(Gl=a2("keyval-store","keyval")),Gl}function Wg(r,e=$c()){return e("readonly",t=>Sa(t.get(r)))}function aC(r,e,t=$c()){return t("readwrite",i=>(i.put(e,r),Sa(i.transaction)))}function oC(r,e=$c()){return e("readwrite",t=>(t.delete(r),Sa(t.transaction)))}function cC(r=$c()){return r("readwrite",e=>(e.clear(),Sa(e.transaction)))}function uC(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Sa(r.transaction)}function fC(r=$c()){return r("readonly",e=>{if(e.getAllKeys)return Sa(e.getAllKeys());const t=[];return uC(e,i=>t.push(i.key)).then(()=>t)})}const hC="idb-keyval";var lC=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=a2(r.dbName,r.storeName)),{name:hC,options:r,async hasItem(n){return!(typeof await Wg(t(n),i)>"u")},async getItem(n){return await Wg(t(n),i)??null},setItem(n,a){return aC(t(n),a,i)},removeItem(n){return oC(t(n),i)},getKeys(){return fC(i)},clear(){return cC(i)}}};const dC="WALLET_CONNECT_V2_INDEXED_DB",pC="keyvaluestorage";let gC=class{constructor(){this.indexedDb=sC({driver:lC({dbName:dC,storeName:pC})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,ys(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Jl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},ff={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Jl<"u"&&Jl.localStorage?ff.exports=Jl.localStorage:typeof window<"u"&&window.localStorage?ff.exports=window.localStorage:ff.exports=new e})();function bC(r){var e;return[r[0],ma((e=r[1])!=null?e:"")]}class vC{constructor(){this.localStorage=ff.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(bC)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return ma(t)}async setItem(e,t){this.localStorage.setItem(e,ys(t))}async removeItem(e){this.localStorage.removeItem(e)}}const mC="wc_storage_version",Yg=1,yC=async(r,e,t)=>{const i=mC,n=await e.getItem(i);if(n&&n>=Yg){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const c=[];for(;a.length;){const f=a.shift();if(!f)continue;const g=f.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const d=await r.getItem(f);await e.setItem(f,d),c.push(f)}}await e.setItem(i,Yg),t(e),wC(r,c)},wC=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};let _C=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new vC;this.storage=e;try{const t=new gC;yC(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};function DC(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var EC=AC;function AC(r,e,t){var i=t&&t.stringify||DC,n=1;if(typeof r=="object"&&r!==null){var a=e.length+n;if(a===1)return r;var c=new Array(a);c[0]=i(r);for(var f=1;f-1?w:0,r.charCodeAt(C+1)){case 100:case 102:if(m>=g||e[m]==null)break;w=g||e[m]==null)break;w=g||e[m]===void 0)break;w",w=C+2,C++;break}d+=i(e[m]),w=C+2,C++;break;case 115:if(m>=g)break;w-1&&(a=!1);const c=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",g=Object.create(t);g.log||(g.log=Ec),Object.defineProperty(g,"levelVal",{get:m}),Object.defineProperty(g,"level",{get:w,set:O});const d={transmit:e,serialize:n,asObject:r.browser.asObject,levels:c,timestamp:OC(r)};g.levels=Fn.levels,g.level=f,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Ec,g.serializers=i,g._serialize=n,g._stdErrSerialize=a,g.child=C,e&&(g._logEvent=Id());function m(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function O(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,Ja(d,g,"error","log"),Ja(d,g,"fatal","error"),Ja(d,g,"warn","error"),Ja(d,g,"info","log"),Ja(d,g,"debug","log"),Ja(d,g,"trace","log")}function C(P,q){if(!P)throw new Error("missing bindings for child Pino");q=q||{},n&&P.serializers&&(q.serializers=P.serializers);const K=q.serializers;if(n&&K){var Y=Object.assign({},i,K),z=r.browser.serialize===!0?Object.keys(Y):n;delete P.serializers,Xf([P],z,Y,this._stdErrSerialize)}function W(B){this._childLevel=(B._childLevel|0)+1,this.error=Wa(B,P,"error"),this.fatal=Wa(B,P,"fatal"),this.warn=Wa(B,P,"warn"),this.info=Wa(B,P,"info"),this.debug=Wa(B,P,"debug"),this.trace=Wa(B,P,"trace"),Y&&(this.serializers=Y,this._serialize=z),e&&(this._logEvent=Id([].concat(B._logEvent.bindings,P)))}return W.prototype=this,new W(this)}return g}Fn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Fn.stdSerializers=xC;Fn.stdTimeFunctions=Object.assign({},{nullTime:o2,epochTime:c2,unixTime:TC,isoTime:RC});function Ja(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ec:n[t]?n[t]:Dc[t]||Dc[i]||Ec,MC(r,e,t)}function MC(r,e,t){!r.transmit&&e[t]===Ec||(e[t]=function(i){return function(){const a=r.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Dc?Dc:this;for(var g=0;g-1&&a in t&&(r[n][a]=t[a](r[n][a]))}function Wa(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;nthis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},u2=class{constructor(e,t=l0){this.level=e??"error",this.levelValue=Xa.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Xg(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Xa.levels.values.error?console.error(e):t===Xa.levels.values.warn?console.warn(e):t===Xa.levels.values.debug?console.debug(e):t===Xa.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ys({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Xg(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(ys({extraMetadata:e})),new Blob(t,{type:"application/json"})}},UC=class{constructor(e,t=l0){this.baseChunkLogger=new u2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}};class qC{constructor(e,t=l0){this.baseChunkLogger=new u2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var LC=Object.defineProperty,FC=Object.defineProperties,zC=Object.getOwnPropertyDescriptors,Zg=Object.getOwnPropertySymbols,jC=Object.prototype.hasOwnProperty,kC=Object.prototype.propertyIsEnumerable,eb=(r,e,t)=>e in r?LC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sf=(r,e)=>{for(var t in e||(e={}))jC.call(e,t)&&eb(r,t,e[t]);if(Zg)for(var t of Zg(e))kC.call(e,t)&&eb(r,t,e[t]);return r},Mf=(r,e)=>FC(r,zC(e));function Zf(r){return Mf(Sf({},r),{level:(r==null?void 0:r.level)||BC.level})}function HC(r,e=qc){return r[e]||""}function KC(r,e,t=qc){return r[t]=e,r}function pi(r,e=qc){let t="";return typeof r.bindings>"u"?t=HC(r,e):t=r.bindings().context||"",t}function VC(r,e,t=qc){const i=pi(r,t);return i.trim()?`${i}/${e}`:e}function Qr(r,e,t=qc){const i=VC(r,e,t),n=r.child({context:i});return KC(n,i,t)}function GC(r){var e,t;const i=new UC((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Uc(Mf(Sf({},r.opts),{level:"trace",browser:Mf(Sf({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function JC(r){var e;const t=new qC((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Uc(Mf(Sf({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function WC(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?GC(r):JC(r)}let YC=class extends xa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},QC=class extends xa{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},XC=class{constructor(e,t){this.logger=e,this.core=t}},ZC=class extends xa{constructor(e,t){super(),this.relayer=e,this.logger=t}},eP=class extends xa{constructor(e){super()}},tP=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},rP=class extends xa{constructor(e,t){super(),this.relayer=e,this.logger=t}},iP=class extends xa{constructor(e,t){super(),this.core=e,this.logger=t}},nP=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},sP=class{constructor(e,t){this.projectId=e,this.logger=t}},aP=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}},oP=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},cP=class{constructor(e){this.client=e}};function uP(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function fP(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function C(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:C}}var hP=fP,lP=hP;const dP=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},pP=r=>new TextEncoder().encode(r),gP=r=>new TextDecoder().decode(r);class bP{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class vP{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return f2(this,e)}}class mP{constructor(e){this.decoders=e}or(e){return f2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const f2=(r,e)=>new mP({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class yP{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new bP(e,t,i),this.decoder=new vP(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const eh=({name:r,prefix:e,encode:t,decode:i})=>new yP(r,e,t,i),Lc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=lP(t,e);return eh({prefix:r,name:e,encode:i,decode:a=>dP(n(a))})},wP=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},_P=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<eh({prefix:e,name:r,encode(n){return _P(n,i,t)},decode(n){return wP(n,i,t,r)}}),DP=eh({prefix:"\0",name:"identity",encode:r=>gP(r),decode:r=>pP(r)}),EP=Object.freeze(Object.defineProperty({__proto__:null,identity:DP},Symbol.toStringTag,{value:"Module"})),AP=Or({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),xP=Object.freeze(Object.defineProperty({__proto__:null,base2:AP},Symbol.toStringTag,{value:"Module"})),SP=Or({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),MP=Object.freeze(Object.defineProperty({__proto__:null,base8:SP},Symbol.toStringTag,{value:"Module"})),IP=Lc({prefix:"9",name:"base10",alphabet:"0123456789"}),CP=Object.freeze(Object.defineProperty({__proto__:null,base10:IP},Symbol.toStringTag,{value:"Module"})),PP=Or({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OP=Or({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),TP=Object.freeze(Object.defineProperty({__proto__:null,base16:PP,base16upper:OP},Symbol.toStringTag,{value:"Module"})),RP=Or({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),NP=Or({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BP=Or({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$P=Or({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),UP=Or({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qP=Or({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),LP=Or({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),FP=Or({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zP=Or({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),jP=Object.freeze(Object.defineProperty({__proto__:null,base32:RP,base32hex:UP,base32hexpad:LP,base32hexpadupper:FP,base32hexupper:qP,base32pad:BP,base32padupper:$P,base32upper:NP,base32z:zP},Symbol.toStringTag,{value:"Module"})),kP=Lc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),HP=Lc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),KP=Object.freeze(Object.defineProperty({__proto__:null,base36:kP,base36upper:HP},Symbol.toStringTag,{value:"Module"})),VP=Lc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),GP=Lc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),JP=Object.freeze(Object.defineProperty({__proto__:null,base58btc:VP,base58flickr:GP},Symbol.toStringTag,{value:"Module"})),WP=Or({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),YP=Or({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QP=Or({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),XP=Or({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),ZP=Object.freeze(Object.defineProperty({__proto__:null,base64:WP,base64pad:YP,base64url:QP,base64urlpad:XP},Symbol.toStringTag,{value:"Module"})),h2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),eO=h2.reduce((r,e,t)=>(r[t]=e,r),[]),tO=h2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function rO(r){return r.reduce((e,t)=>(e+=eO[t],e),"")}function iO(r){const e=[];for(const t of r){const i=tO[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const nO=eh({prefix:"🚀",name:"base256emoji",encode:rO,decode:iO}),sO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:nO},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const tb={...EP,...xP,...MP,...CP,...TP,...jP,...KP,...JP,...ZP,...sO};function l2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const rb=l2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Yl=l2("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=uP(r.length);for(let t=0;tt.code===r);return e||pc[p2]}function g2(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var b2={};/*! ***************************************************************************** + Approved: ${O.toString()}`))}),c.forEach(w=>{i||(da(n[w].methods,a[w].methods)?da(n[w].events,a[w].events)||(i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=De("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function BI(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function Kg(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function $I(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=So(r[t].accounts);i==null||i.forEach(n=>{e[n]={accounts:r[t].accounts.filter(a=>a.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function UI(r,e){return l0(r)&&r<=e.max&&r>=e.min}function Vg(){const r=Rc();return new Promise(e=>{switch(r){case _i.browser:e(qI());break;case _i.reactNative:e(LI());break;case _i.node:e(FI());break;default:e(!0)}})}function qI(){return Tc()&&(navigator==null?void 0:navigator.onLine)}async function LI(){if(_o()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const r=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function FI(){return!0}function zI(r){switch(Rc()){case _i.browser:jI(r);break;case _i.reactNative:kI(r);break}}function jI(r){!_o()&&Tc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function kI(r){_o()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}const Gl={};class rc{static get(e){return Gl[e]}static set(e,t){Gl[e]=t}static delete(e){delete Gl[e]}}class Sa{}let HI=class extends Sa{constructor(e){super()}};const Gg=Ae.FIVE_SECONDS,Mo={pulse:"heartbeat_pulse"};let KI=class n2 extends HI{constructor(e){super(e),this.events=new Vi.EventEmitter,this.interval=Gg,this.interval=(e==null?void 0:e.interval)||Gg}static async init(e){const t=new n2(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Ae.toMiliseconds(this.interval))}pulse(){this.events.emit(Mo.pulse)}};const VI=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,GI=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,JI=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function WI(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){YI(r);return}return e}function YI(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Qu(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!JI.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(VI.test(r)||GI.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,WI)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function QI(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function _r(r,...e){try{return QI(r(...e))}catch(t){return Promise.reject(t)}}function XI(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function ZI(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function ff(r){if(XI(r))return String(r);if(ZI(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return ff(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function s2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const Id="base64:";function eC(r){if(typeof r=="string")return r;s2();const e=Buffer.from(r).toString("base64");return Id+e}function tC(r){return typeof r!="string"||!r.startsWith(Id)?r:(s2(),Buffer.from(r.slice(Id.length),"base64"))}function oi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function rC(...r){return oi(r.join(":"))}function Xu(r){return r=oi(r),r?r+":":""}const iC="memory",nC=()=>{const r=new Map;return{name:iC,getInstance:()=>r,hasItem(e){return r.has(e)},getItem(e){return r.get(e)??null},getItemRaw(e){return r.get(e)??null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function sC(r={}){const e={mounts:{"":r.driver||nC()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=d=>{for(const m of e.mountpoints)if(d.startsWith(m))return{base:m,relativeKey:d.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:d,driver:e.mounts[""]}},i=(d,m)=>e.mountpoints.filter(w=>w.startsWith(d)||m&&d.startsWith(w)).map(w=>({relativeBase:d.length>w.length?d.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(d,m)=>{if(e.watching){m=oi(m);for(const w of e.watchListeners)w(d,m)}},a=async()=>{if(!e.watching){e.watching=!0;for(const d in e.mounts)e.unwatch[d]=await Jg(e.mounts[d],n,d)}},c=async()=>{if(e.watching){for(const d in e.unwatch)await e.unwatch[d]();e.unwatch={},e.watching=!1}},f=(d,m,w)=>{const O=new Map,I=P=>{let q=O.get(P.base);return q||(q={driver:P.driver,base:P.base,items:[]},O.set(P.base,q)),q};for(const P of d){const q=typeof P=="string",K=oi(q?P:P.key),Y=q?void 0:P.value,z=q||!P.options?m:{...m,...P.options},W=t(K);I(W).items.push({key:K,value:Y,relativeKey:W.relativeKey,options:z})}return Promise.all([...O.values()].map(P=>w(P))).then(P=>P.flat())},g={hasItem(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return _r(O.hasItem,w,m)},getItem(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return _r(O.getItem,w,m).then(I=>Qu(I))},getItems(d,m){return f(d,m,w=>w.driver.getItems?_r(w.driver.getItems,w.items.map(O=>({key:O.relativeKey,options:O.options})),m).then(O=>O.map(I=>({key:rC(w.base,I.key),value:Qu(I.value)}))):Promise.all(w.items.map(O=>_r(w.driver.getItem,O.relativeKey,O.options).then(I=>({key:O.key,value:Qu(I)})))))},getItemRaw(d,m={}){d=oi(d);const{relativeKey:w,driver:O}=t(d);return O.getItemRaw?_r(O.getItemRaw,w,m):_r(O.getItem,w,m).then(I=>tC(I))},async setItem(d,m,w={}){if(m===void 0)return g.removeItem(d);d=oi(d);const{relativeKey:O,driver:I}=t(d);I.setItem&&(await _r(I.setItem,O,ff(m),w),I.watch||n("update",d))},async setItems(d,m){await f(d,m,async w=>{if(w.driver.setItems)return _r(w.driver.setItems,w.items.map(O=>({key:O.relativeKey,value:ff(O.value),options:O.options})),m);w.driver.setItem&&await Promise.all(w.items.map(O=>_r(w.driver.setItem,O.relativeKey,ff(O.value),O.options)))})},async setItemRaw(d,m,w={}){if(m===void 0)return g.removeItem(d,w);d=oi(d);const{relativeKey:O,driver:I}=t(d);if(I.setItemRaw)await _r(I.setItemRaw,O,m,w);else if(I.setItem)await _r(I.setItem,O,eC(m),w);else return;I.watch||n("update",d)},async removeItem(d,m={}){typeof m=="boolean"&&(m={removeMeta:m}),d=oi(d);const{relativeKey:w,driver:O}=t(d);O.removeItem&&(await _r(O.removeItem,w,m),(m.removeMeta||m.removeMata)&&await _r(O.removeItem,w+"$",m),O.watch||n("remove",d))},async getMeta(d,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),d=oi(d);const{relativeKey:w,driver:O}=t(d),I=Object.create(null);if(O.getMeta&&Object.assign(I,await _r(O.getMeta,w,m)),!m.nativeOnly){const P=await _r(O.getItem,w+"$",m).then(q=>Qu(q));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(I,P))}return I},setMeta(d,m,w={}){return this.setItem(d+"$",m,w)},removeMeta(d,m={}){return this.removeItem(d+"$",m)},async getKeys(d,m={}){d=Xu(d);const w=i(d,!0);let O=[];const I=[];for(const P of w){const q=await _r(P.driver.getKeys,P.relativeBase,m);for(const K of q){const Y=P.mountpoint+oi(K);O.some(z=>Y.startsWith(z))||I.push(Y)}O=[P.mountpoint,...O.filter(K=>!K.startsWith(P.mountpoint))]}return d?I.filter(P=>P.startsWith(d)&&P[P.length-1]!=="$"):I.filter(P=>P[P.length-1]!=="$")},async clear(d,m={}){d=Xu(d),await Promise.all(i(d,!1).map(async w=>{if(w.driver.clear)return _r(w.driver.clear,w.relativeBase,m);if(w.driver.removeItem){const O=await w.driver.getKeys(w.relativeBase||"",m);return Promise.all(O.map(I=>w.driver.removeItem(I,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(d=>Wg(d)))},async watch(d){return await a(),e.watchListeners.push(d),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==d),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(d,m){if(d=Xu(d),d&&e.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(e.mountpoints.push(d),e.mountpoints.sort((w,O)=>O.length-w.length)),e.mounts[d]=m,e.watching&&Promise.resolve(Jg(m,n,d)).then(w=>{e.unwatch[d]=w}).catch(console.error),g},async unmount(d,m=!0){d=Xu(d),!(!d||!e.mounts[d])&&(e.watching&&d in e.unwatch&&(e.unwatch[d](),delete e.unwatch[d]),m&&await Wg(e.mounts[d]),e.mountpoints=e.mountpoints.filter(w=>w!==d),delete e.mounts[d])},getMount(d=""){d=oi(d)+":";const m=t(d);return{driver:m.driver,base:m.base}},getMounts(d="",m={}){return d=oi(d),i(d,m.parents).map(O=>({driver:O.driver,base:O.mountpoint}))},keys:(d,m={})=>g.getKeys(d,m),get:(d,m={})=>g.getItem(d,m),set:(d,m,w={})=>g.setItem(d,m,w),has:(d,m={})=>g.hasItem(d,m),del:(d,m={})=>g.removeItem(d,m),remove:(d,m={})=>g.removeItem(d,m)};return g}function Jg(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Wg(r){typeof r.dispose=="function"&&await _r(r.dispose)}function Ma(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function a2(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=Ma(t);return(n,a)=>i.then(c=>a(c.transaction(e,n).objectStore(e)))}let Jl;function Uc(){return Jl||(Jl=a2("keyval-store","keyval")),Jl}function Yg(r,e=Uc()){return e("readonly",t=>Ma(t.get(r)))}function aC(r,e,t=Uc()){return t("readwrite",i=>(i.put(e,r),Ma(i.transaction)))}function oC(r,e=Uc()){return e("readwrite",t=>(t.delete(r),Ma(t.transaction)))}function cC(r=Uc()){return r("readwrite",e=>(e.clear(),Ma(e.transaction)))}function uC(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ma(r.transaction)}function fC(r=Uc()){return r("readonly",e=>{if(e.getAllKeys)return Ma(e.getAllKeys());const t=[];return uC(e,i=>t.push(i.key)).then(()=>t)})}const hC="idb-keyval";var lC=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=a2(r.dbName,r.storeName)),{name:hC,options:r,async hasItem(n){return!(typeof await Yg(t(n),i)>"u")},async getItem(n){return await Yg(t(n),i)??null},setItem(n,a){return aC(t(n),a,i)},removeItem(n){return oC(t(n),i)},getKeys(){return fC(i)},clear(){return cC(i)}}};const dC="WALLET_CONNECT_V2_INDEXED_DB",pC="keyvaluestorage";let gC=class{constructor(){this.indexedDb=sC({driver:lC({dbName:dC,storeName:pC})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,ys(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Wl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},hf={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Wl<"u"&&Wl.localStorage?hf.exports=Wl.localStorage:typeof window<"u"&&window.localStorage?hf.exports=window.localStorage:hf.exports=new e})();function bC(r){var e;return[r[0],ya((e=r[1])!=null?e:"")]}class vC{constructor(){this.localStorage=hf.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(bC)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return ya(t)}async setItem(e,t){this.localStorage.setItem(e,ys(t))}async removeItem(e){this.localStorage.removeItem(e)}}const mC="wc_storage_version",Qg=1,yC=async(r,e,t)=>{const i=mC,n=await e.getItem(i);if(n&&n>=Qg){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const c=[];for(;a.length;){const f=a.shift();if(!f)continue;const g=f.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const d=await r.getItem(f);await e.setItem(f,d),c.push(f)}}await e.setItem(i,Qg),t(e),wC(r,c)},wC=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};let _C=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new vC;this.storage=e;try{const t=new gC;yC(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};function DC(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var EC=AC;function AC(r,e,t){var i=t&&t.stringify||DC,n=1;if(typeof r=="object"&&r!==null){var a=e.length+n;if(a===1)return r;var c=new Array(a);c[0]=i(r);for(var f=1;f-1?w:0,r.charCodeAt(I+1)){case 100:case 102:if(m>=g||e[m]==null)break;w=g||e[m]==null)break;w=g||e[m]===void 0)break;w",w=I+2,I++;break}d+=i(e[m]),w=I+2,I++;break;case 115:if(m>=g)break;w-1&&(a=!1);const c=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",g=Object.create(t);g.log||(g.log=Ac),Object.defineProperty(g,"levelVal",{get:m}),Object.defineProperty(g,"level",{get:w,set:O});const d={transmit:e,serialize:n,asObject:r.browser.asObject,levels:c,timestamp:OC(r)};g.levels=zn.levels,g.level=f,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Ac,g.serializers=i,g._serialize=n,g._stdErrSerialize=a,g.child=I,e&&(g._logEvent=Cd());function m(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function O(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,Wa(d,g,"error","log"),Wa(d,g,"fatal","error"),Wa(d,g,"warn","error"),Wa(d,g,"info","log"),Wa(d,g,"debug","log"),Wa(d,g,"trace","log")}function I(P,q){if(!P)throw new Error("missing bindings for child Pino");q=q||{},n&&P.serializers&&(q.serializers=P.serializers);const K=q.serializers;if(n&&K){var Y=Object.assign({},i,K),z=r.browser.serialize===!0?Object.keys(Y):n;delete P.serializers,Zf([P],z,Y,this._stdErrSerialize)}function W(B){this._childLevel=(B._childLevel|0)+1,this.error=Ya(B,P,"error"),this.fatal=Ya(B,P,"fatal"),this.warn=Ya(B,P,"warn"),this.info=Ya(B,P,"info"),this.debug=Ya(B,P,"debug"),this.trace=Ya(B,P,"trace"),Y&&(this.serializers=Y,this._serialize=z),e&&(this._logEvent=Cd([].concat(B._logEvent.bindings,P)))}return W.prototype=this,new W(this)}return g}zn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};zn.stdSerializers=xC;zn.stdTimeFunctions=Object.assign({},{nullTime:o2,epochTime:c2,unixTime:TC,isoTime:RC});function Wa(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ac:n[t]?n[t]:Ec[t]||Ec[i]||Ac,MC(r,e,t)}function MC(r,e,t){!r.transmit&&e[t]===Ac||(e[t]=function(i){return function(){const a=r.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ec?Ec:this;for(var g=0;g-1&&a in t&&(r[n][a]=t[a](r[n][a]))}function Ya(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;nthis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},u2=class{constructor(e,t=d0){this.level=e??"error",this.levelValue=Za.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Zg(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Za.levels.values.error?console.error(e):t===Za.levels.values.warn?console.warn(e):t===Za.levels.values.debug?console.debug(e):t===Za.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ys({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Zg(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(ys({extraMetadata:e})),new Blob(t,{type:"application/json"})}},UC=class{constructor(e,t=d0){this.baseChunkLogger=new u2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}};class qC{constructor(e,t=d0){this.baseChunkLogger=new u2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var LC=Object.defineProperty,FC=Object.defineProperties,zC=Object.getOwnPropertyDescriptors,eb=Object.getOwnPropertySymbols,jC=Object.prototype.hasOwnProperty,kC=Object.prototype.propertyIsEnumerable,tb=(r,e,t)=>e in r?LC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mf=(r,e)=>{for(var t in e||(e={}))jC.call(e,t)&&tb(r,t,e[t]);if(eb)for(var t of eb(e))kC.call(e,t)&&tb(r,t,e[t]);return r},If=(r,e)=>FC(r,zC(e));function eh(r){return If(Mf({},r),{level:(r==null?void 0:r.level)||BC.level})}function HC(r,e=Lc){return r[e]||""}function KC(r,e,t=Lc){return r[t]=e,r}function pi(r,e=Lc){let t="";return typeof r.bindings>"u"?t=HC(r,e):t=r.bindings().context||"",t}function VC(r,e,t=Lc){const i=pi(r,t);return i.trim()?`${i}/${e}`:e}function Qr(r,e,t=Lc){const i=VC(r,e,t),n=r.child({context:i});return KC(n,i,t)}function GC(r){var e,t;const i=new UC((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:qc(If(Mf({},r.opts),{level:"trace",browser:If(Mf({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function JC(r){var e;const t=new qC((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:qc(If(Mf({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function WC(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?GC(r):JC(r)}let YC=class extends Sa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},QC=class extends Sa{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},XC=class{constructor(e,t){this.logger=e,this.core=t}},ZC=class extends Sa{constructor(e,t){super(),this.relayer=e,this.logger=t}},eP=class extends Sa{constructor(e){super()}},tP=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},rP=class extends Sa{constructor(e,t){super(),this.relayer=e,this.logger=t}},iP=class extends Sa{constructor(e,t){super(),this.core=e,this.logger=t}},nP=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},sP=class{constructor(e,t){this.projectId=e,this.logger=t}},aP=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}},oP=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},cP=class{constructor(e){this.client=e}};function uP(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function fP(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function I(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:I}}var hP=fP,lP=hP;const dP=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},pP=r=>new TextEncoder().encode(r),gP=r=>new TextDecoder().decode(r);class bP{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class vP{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return f2(this,e)}}class mP{constructor(e){this.decoders=e}or(e){return f2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const f2=(r,e)=>new mP({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class yP{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new bP(e,t,i),this.decoder=new vP(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const th=({name:r,prefix:e,encode:t,decode:i})=>new yP(r,e,t,i),Fc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=lP(t,e);return th({prefix:r,name:e,encode:i,decode:a=>dP(n(a))})},wP=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},_P=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<th({prefix:e,name:r,encode(n){return _P(n,i,t)},decode(n){return wP(n,i,t,r)}}),DP=th({prefix:"\0",name:"identity",encode:r=>gP(r),decode:r=>pP(r)}),EP=Object.freeze(Object.defineProperty({__proto__:null,identity:DP},Symbol.toStringTag,{value:"Module"})),AP=Or({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),xP=Object.freeze(Object.defineProperty({__proto__:null,base2:AP},Symbol.toStringTag,{value:"Module"})),SP=Or({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),MP=Object.freeze(Object.defineProperty({__proto__:null,base8:SP},Symbol.toStringTag,{value:"Module"})),IP=Fc({prefix:"9",name:"base10",alphabet:"0123456789"}),CP=Object.freeze(Object.defineProperty({__proto__:null,base10:IP},Symbol.toStringTag,{value:"Module"})),PP=Or({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OP=Or({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),TP=Object.freeze(Object.defineProperty({__proto__:null,base16:PP,base16upper:OP},Symbol.toStringTag,{value:"Module"})),RP=Or({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),NP=Or({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BP=Or({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$P=Or({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),UP=Or({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qP=Or({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),LP=Or({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),FP=Or({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zP=Or({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),jP=Object.freeze(Object.defineProperty({__proto__:null,base32:RP,base32hex:UP,base32hexpad:LP,base32hexpadupper:FP,base32hexupper:qP,base32pad:BP,base32padupper:$P,base32upper:NP,base32z:zP},Symbol.toStringTag,{value:"Module"})),kP=Fc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),HP=Fc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),KP=Object.freeze(Object.defineProperty({__proto__:null,base36:kP,base36upper:HP},Symbol.toStringTag,{value:"Module"})),VP=Fc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),GP=Fc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),JP=Object.freeze(Object.defineProperty({__proto__:null,base58btc:VP,base58flickr:GP},Symbol.toStringTag,{value:"Module"})),WP=Or({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),YP=Or({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QP=Or({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),XP=Or({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),ZP=Object.freeze(Object.defineProperty({__proto__:null,base64:WP,base64pad:YP,base64url:QP,base64urlpad:XP},Symbol.toStringTag,{value:"Module"})),h2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),eO=h2.reduce((r,e,t)=>(r[t]=e,r),[]),tO=h2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function rO(r){return r.reduce((e,t)=>(e+=eO[t],e),"")}function iO(r){const e=[];for(const t of r){const i=tO[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const nO=th({prefix:"🚀",name:"base256emoji",encode:rO,decode:iO}),sO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:nO},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const rb={...EP,...xP,...MP,...CP,...TP,...jP,...KP,...JP,...ZP,...sO};function l2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const ib=l2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ql=l2("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=uP(r.length);for(let t=0;tt.code===r);return e||gc[p2]}function g2(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var b2={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -41,16 +41,16 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Cd=function(r,e){return Cd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Cd(r,e)};function gO(r,e){Cd(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Pd=function(){return Pd=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;f--)(c=r[f])&&(a=(n<3?c(a):n>3?c(e,t,a):c(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a}function mO(r,e){return function(t,i){e(t,i,r)}}function yO(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function wO(r,e,t,i){function n(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{d(i.next(m))}catch(w){c(w)}}function g(m){try{d(i.throw(m))}catch(w){c(w)}}function d(m){m.done?a(m.value):n(m.value).then(f,g)}d((i=i.apply(r,e||[])).next())})}function _O(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(d){return function(m){return g([d,m])}}function g(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(a=d[0]&2?n.return:d[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,d[1])).done)return a;switch(n=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,n=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function v2(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,a=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(f){c={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return a}function AO(){for(var r=[],e=0;e1||f(O,C)})})}function f(O,C){try{g(i[O](C))}catch(P){w(a[0][3],P)}}function g(O){O.value instanceof Ac?Promise.resolve(O.value.v).then(d,m):w(a[0][2],O)}function d(O){f("next",O)}function m(O){f("throw",O)}function w(O,C){O(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function MO(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,a){e[n]=r[n]?function(c){return(t=!t)?{value:Ac(r[n](c)),done:n==="return"}:a?a(c):c}:a}}function IO(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Od=="function"?Od(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(c){return new Promise(function(f,g){c=r[a](c),n(f,g,c.done,c.value)})}}function n(a,c,f,g){Promise.resolve(g).then(function(d){a({value:d,done:f})},c)}}function CO(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function PO(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function OO(r){return r&&r.__esModule?r:{default:r}}function TO(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function RO(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const NO=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Pd},__asyncDelegator:MO,__asyncGenerator:SO,__asyncValues:IO,__await:Ac,__awaiter:wO,__classPrivateFieldGet:TO,__classPrivateFieldSet:RO,__createBinding:DO,__decorate:vO,__exportStar:EO,__extends:gO,__generator:_O,__importDefault:OO,__importStar:PO,__makeTemplateObject:CO,__metadata:yO,__param:mO,__read:v2,__rest:bO,__spread:AO,__spreadArrays:xO,__values:Od},Symbol.toStringTag,{value:"Module"})),BO=ev(NO);var os={},nb;function $O(){if(nb)return os;nb=1,Object.defineProperty(os,"__esModule",{value:!0}),os.isBrowserCryptoAvailable=os.getSubtleCrypto=os.getBrowerCrypto=void 0;function r(){return(globalThis==null?void 0:globalThis.crypto)||(globalThis==null?void 0:globalThis.msCrypto)||{}}os.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}os.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return os.isBrowserCryptoAvailable=t,os}var cs={},sb;function UO(){if(sb)return cs;sb=1;var r={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};Object.defineProperty(cs,"__esModule",{value:!0}),cs.isBrowser=cs.isNode=cs.isReactNative=void 0;function e(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}cs.isReactNative=e;function t(){return typeof r<"u"&&typeof r.versions<"u"&&typeof r.versions.node<"u"}cs.isNode=t;function i(){return!e()&&!t()}return cs.isBrowser=i,cs}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=BO;e.__exportStar($O(),r),e.__exportStar(UO(),r)})(b2);function Bs(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function da(r=6){return BigInt(Bs(r))}function Fs(r,e,t){return{id:t||Bs(),jsonrpc:"2.0",method:r,params:e}}function th(r,e){return{id:r,jsonrpc:"2.0",result:e}}function rh(r,e,t){return{id:r,jsonrpc:"2.0",error:qO(e)}}function qO(r,e){return typeof r>"u"?ib(d2):(typeof r=="string"&&(r=Object.assign(Object.assign({},ib(d0)),{message:r})),dO(r.code)&&(r=pO(r.code)),r)}class LO{}class FO extends LO{constructor(){super()}}class zO extends FO{constructor(e){super()}}const jO="^https?:",kO="^wss?:";function HO(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function m2(r,e){const t=HO(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function ab(r){return m2(r,jO)}function ob(r){return m2(r,kO)}function KO(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function y2(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function p0(r){return y2(r)&&"method"in r}function ih(r){return y2(r)&&(Cn(r)||ji(r))}function Cn(r){return"result"in r}function ji(r){return"error"in r}let vn=class extends zO{constructor(e){super(e),this.events=new Vi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Fs(e.method,e.params||[],e.id||da().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(a){n(a)}this.events.on(`${e.id}`,a=>{ji(a)?n(a.error):i(a.result)});try{await this.connection.send(e,t)}catch(a){n(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ih(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const VO=()=>typeof WebSocket<"u"?WebSocket:typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"?globalThis.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),GO=()=>typeof WebSocket<"u"||typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",cb=r=>r.split("?")[0],ub=10,JO=VO();let WO=class{constructor(e){if(this.url=e,this.events=new Vi.EventEmitter,this.registering=!1,!ob(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ys(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!ob(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),n(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=new URLSearchParams(e).get("origin"),a=b2.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!KO(e)},c=new JO(e,[],a);GO()?c.onerror=f=>{const g=f;i(this.emitError(g.error))}:c.on("error",f=>{i(this.emitError(f))}),c.onopen=()=>{this.onOpen(c),t(c)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?ma(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),a=rh(e,n);this.events.emit("payload",a)}parseError(e,t=this.url){return g2(e,cb(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>ub&&this.events.setMaxListeners(ub)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${cb(this.url)}`));return this.events.emit("register_error",t),t}};var If={exports:{}};If.exports;(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,a=2,c=9007199254740991,f="[object Arguments]",g="[object Array]",d="[object AsyncFunction]",m="[object Boolean]",w="[object Date]",O="[object Error]",C="[object Function]",P="[object GeneratorFunction]",q="[object Map]",K="[object Number]",Y="[object Null]",z="[object Object]",W="[object Promise]",B="[object Proxy]",j="[object RegExp]",k="[object Set]",_="[object String]",N="[object Symbol]",se="[object Undefined]",le="[object WeakMap]",U="[object ArrayBuffer]",y="[object DataView]",u="[object Float32Array]",h="[object Float64Array]",v="[object Int8Array]",E="[object Int16Array]",S="[object Int32Array]",M="[object Uint8Array]",x="[object Uint8ClampedArray]",p="[object Uint16Array]",b="[object Uint32Array]",R=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,I={};I[u]=I[h]=I[v]=I[E]=I[S]=I[M]=I[x]=I[p]=I[b]=!0,I[f]=I[g]=I[U]=I[m]=I[y]=I[w]=I[O]=I[C]=I[q]=I[K]=I[z]=I[j]=I[k]=I[_]=I[le]=!1;var ee=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,L=typeof self=="object"&&self&&self.Object===Object&&self,V=ee||L||Function("return this")(),G=e&&!e.nodeType&&e,D=G&&!0&&r&&!r.nodeType&&r,H=D&&D.exports===G,ne=H&&ee.process,ce=function(){try{return ne&&ne.binding&&ne.binding("util")}catch{}}(),fe=ce&&ce.isTypedArray;function ye(J,te){for(var pe=-1,Le=J==null?0:J.length,jt=0,pt=[];++pe-1}function Ur(J,te){var pe=this.__data__,Le=Vs(pe,J);return Le<0?(++this.size,pe.push([J,te])):pe[Le][1]=te,this}vt.prototype.clear=Rr,vt.prototype.delete=Nr,vt.prototype.get=Br,vt.prototype.has=$r,vt.prototype.set=Ur;function er(J){var te=-1,pe=J==null?0:J.length;for(this.clear();++tefr))return!1;var kt=pt.get(J);if(kt&&pt.get(te))return kt==te;var sr=-1,ti=!0,hr=pe&a?new ei:void 0;for(pt.set(J,te),pt.set(te,J);++sr-1&&J%1==0&&J-1&&J%1==0&&J<=c}function ru(J){var te=typeof J;return J!=null&&(te=="object"||te=="function")}function Ws(J){return J!=null&&typeof J=="object"}var iu=fe?Ce(fe):Hc;function hh(J){return uh(J)?jc(J):Kc(J)}function zt(){return[]}function Ft(){return!1}r.exports=fh})(If,If.exports);var YO=If.exports;const QO=Ld(YO),w2="wc",_2=2,g0="core",Kn=`${w2}@2:${g0}:`,XO={name:g0,logger:"error"},ZO={database:":memory:"},eT="crypto",fb="client_ed25519_seed",tT=Ae.ONE_DAY,rT="keychain",iT="0.3",nT="messages",sT="0.3",aT=Ae.SIX_HOURS,oT="publisher",D2="irn",cT="error",E2="wss://relay.walletconnect.org",uT="relayer",Jr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},fT="_subscription",Li={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},hT=.1,Td="2.17.0",Kt={link_mode:"link_mode",relay:"relay"},lT="0.3",dT="WALLETCONNECT_CLIENT_ID",hb="WALLETCONNECT_LINK_MODE_APPS",Pn={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},pT="subscription",gT="0.3",bT=Ae.FIVE_SECONDS*1e3,vT="pairing",mT="0.3",rc={wc_pairingDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:0}}},ha={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},un={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},yT="history",wT="0.3",_T="expirer",Fi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},DT="0.3",ET="verify-api",AT="https://verify.walletconnect.com",A2="https://verify.walletconnect.org",gc=A2,xT=`${gc}/v3`,ST=[AT,A2],MT="echo",IT="https://echo.walletconnect.com",Sn={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},us={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},fn={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ca={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ua={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},ic={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},CT=.1,PT="event-client",OT=86400,TT="https://pulse.walletconnect.org/batch";function RT(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function C(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:C}}var NT=RT,BT=NT;const x2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},$T=r=>new TextEncoder().encode(r),UT=r=>new TextDecoder().decode(r);class qT{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class LT{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return S2(this,e)}}class FT{constructor(e){this.decoders=e}or(e){return S2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const S2=(r,e)=>new FT({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class zT{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new qT(e,t,i),this.decoder=new LT(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const nh=({name:r,prefix:e,encode:t,decode:i})=>new zT(r,e,t,i),Fc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=BT(t,e);return nh({prefix:r,name:e,encode:i,decode:a=>x2(n(a))})},jT=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},kT=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<nh({prefix:e,name:r,encode(n){return kT(n,i,t)},decode(n){return jT(n,i,t,r)}}),HT=nh({prefix:"\0",name:"identity",encode:r=>UT(r),decode:r=>$T(r)});var KT=Object.freeze({__proto__:null,identity:HT});const VT=Tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var GT=Object.freeze({__proto__:null,base2:VT});const JT=Tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var WT=Object.freeze({__proto__:null,base8:JT});const YT=Fc({prefix:"9",name:"base10",alphabet:"0123456789"});var QT=Object.freeze({__proto__:null,base10:YT});const XT=Tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ZT=Tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var eR=Object.freeze({__proto__:null,base16:XT,base16upper:ZT});const tR=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rR=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iR=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nR=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sR=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aR=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oR=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cR=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uR=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fR=Object.freeze({__proto__:null,base32:tR,base32upper:rR,base32pad:iR,base32padupper:nR,base32hex:sR,base32hexupper:aR,base32hexpad:oR,base32hexpadupper:cR,base32z:uR});const hR=Fc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lR=Fc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var dR=Object.freeze({__proto__:null,base36:hR,base36upper:lR});const pR=Fc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gR=Fc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var bR=Object.freeze({__proto__:null,base58btc:pR,base58flickr:gR});const vR=Tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mR=Tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yR=Tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wR=Tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _R=Object.freeze({__proto__:null,base64:vR,base64pad:mR,base64url:yR,base64urlpad:wR});const M2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),DR=M2.reduce((r,e,t)=>(r[t]=e,r),[]),ER=M2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function AR(r){return r.reduce((e,t)=>(e+=DR[t],e),"")}function xR(r){const e=[];for(const t of r){const i=ER[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const SR=nh({prefix:"🚀",name:"base256emoji",encode:AR,decode:xR});var MR=Object.freeze({__proto__:null,base256emoji:SR}),IR=I2,lb=128,CR=127,PR=~CR,OR=Math.pow(2,31);function I2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=OR;)e[t++]=r&255|lb,r/=128;for(;r&PR;)e[t++]=r&255|lb,r>>>=7;return e[t]=r|0,I2.bytes=t-i+1,e}var TR=Rd,RR=128,db=127;function Rd(r,i){var t=0,i=i||0,n=0,a=i,c,f=r.length;do{if(a>=f)throw Rd.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=n<28?(c&db)<=RR);return Rd.bytes=a-i,t}var NR=Math.pow(2,7),BR=Math.pow(2,14),$R=Math.pow(2,21),UR=Math.pow(2,28),qR=Math.pow(2,35),LR=Math.pow(2,42),FR=Math.pow(2,49),zR=Math.pow(2,56),jR=Math.pow(2,63),kR=function(r){return r(C2.encode(r,e,t),e),gb=r=>C2.encodingLength(r),Nd=(r,e)=>{const t=e.byteLength,i=gb(r),n=i+gb(t),a=new Uint8Array(n+t);return pb(r,a,0),pb(t,a,i),a.set(e,n),new KR(r,t,e,a)};class KR{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const P2=({name:r,code:e,encode:t})=>new VR(r,e,t);class VR{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Nd(this.code,t):t.then(i=>Nd(this.code,i))}else throw Error("Unknown type, must be binary type")}}const O2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),GR=P2({name:"sha2-256",code:18,encode:O2("SHA-256")}),JR=P2({name:"sha2-512",code:19,encode:O2("SHA-512")});var WR=Object.freeze({__proto__:null,sha256:GR,sha512:JR});const T2=0,YR="identity",R2=x2,QR=r=>Nd(T2,R2(r)),XR={code:T2,name:YR,encode:R2,digest:QR};var ZR=Object.freeze({__proto__:null,identity:XR});new TextEncoder,new TextDecoder;const bb={...KT,...GT,...WT,...QT,...eR,...fR,...dR,...bR,..._R,...MR};({...WR,...ZR});function eN(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function N2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const vb=N2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ql=N2("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=eN(r.length);for(let t=0;t{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:a}=De("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(a)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,u3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?f3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class nN{constructor(e,t,i){this.core=e,this.logger=t,this.name=eT,this.randomSessionIdentifier=xd(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),a=Q1(n);return s3(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=jM();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const a=await this.getClientSeed(),c=Q1(a),f=this.randomSessionIdentifier;return await EA(f,n,tT,c)},this.generateSharedKey=(n,a,c)=>{this.isInitialized();const f=this.getPrivateKey(n),g=kM(f,a);return this.setSymKey(g,c)},this.setSymKey=async(n,a)=>{this.isInitialized();const c=a||cf(n);return await this.keychain.set(c,n),c},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,a,c)=>{this.isInitialized();const f=t2(c),g=ys(a);if(Ng(f))return KM(g,c==null?void 0:c.encoding);if(Rg(f)){const O=f.senderPublicKey,C=f.receiverPublicKey;n=await this.generateSharedKey(O,C)}const d=this.getSymKey(n),{type:m,senderPublicKey:w}=f;return HM({type:m,symKey:d,message:g,senderPublicKey:w,encoding:c==null?void 0:c.encoding})},this.decode=async(n,a,c)=>{this.isInitialized();const f=JM(a,c);if(Ng(f)){const g=GM(a,c==null?void 0:c.encoding);return ma(g)}if(Rg(f)){const g=f.receiverPublicKey,d=f.senderPublicKey;n=await this.generateSharedKey(g,d)}try{const g=this.getSymKey(n),d=VM({symKey:g,encoded:a,encoding:c==null?void 0:c.encoding});return ma(d)}catch(g){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(g)}},this.getPayloadType=(n,a=Ls)=>{const c=wc({encoded:n,encoding:a});return wa(c.type)},this.getPayloadSenderPublicKey=(n,a=Ls)=>{const c=wc({encoded:n,encoding:a});return c.senderPublicKey?oO(c.senderPublicKey,Yr):void 0},this.core=e,this.logger=Qr(t,this.name),this.keychain=i||new iN(this.core,this.logger)}get context(){return pi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(fb)}catch{e=xd(),await this.keychain.set(fb,e)}return rN(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class sN extends XC{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=nT,this.version=sT,this.initialized=!1,this.storagePrefix=Kn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const a=hs(n);let c=this.messages.get(i);return typeof c>"u"&&(c={}),typeof c[a]<"u"||(c[a]=n,this.messages.set(i,c),await this.persist()),a},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const a=this.get(i),c=hs(n);return typeof a[c]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Qr(e,this.name),this.core=t}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,u3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?f3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class aN extends ZC{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Vi.EventEmitter,this.name=oT,this.queue=new Map,this.publishTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.failedPublishTimeout=Ae.toMiliseconds(Ae.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,a)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:a}});const f=(a==null?void 0:a.ttl)||aT,g=Sd(a),d=(a==null?void 0:a.prompt)||!1,m=(a==null?void 0:a.tag)||0,w=(a==null?void 0:a.id)||da().toString(),O={topic:i,message:n,opts:{ttl:f,relay:g,prompt:d,tag:m,id:w,attestation:a==null?void 0:a.attestation}},C=`Failed to publish payload, please try again. id:${w} tag:${m}`,P=Date.now();let q,K=1;try{for(;q===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(C);this.logger.trace({id:w,attempts:K},`publisher.publish - attempt ${K}`),q=await await ro(this.rpcPublish(i,n,f,g,d,m,w,a==null?void 0:a.attestation).catch(Y=>this.logger.warn(Y)),this.publishTimeout,C),K++,q||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(Jr.publish,O),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:a}})}catch(Y){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Y),(c=a==null?void 0:a.internal)!=null&&c.throwOnFailedPublish)throw Y;this.queue.set(w,O)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=Qr(t,this.name),this.registerEventListeners()}get context(){return pi(this.logger)}rpcPublish(e,t,i,n,a,c,f,g){var d,m,w,O;const C={method:cc(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:a,tag:c,attestation:g},id:f};return fi((d=C.params)==null?void 0:d.prompt)&&((m=C.params)==null||delete m.prompt),fi((w=C.params)==null?void 0:w.tag)&&((O=C.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:C}),this.relayer.request(C)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(So.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Jr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Jr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class oN{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(a=>a!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var cN=Object.defineProperty,uN=Object.defineProperties,fN=Object.getOwnPropertyDescriptors,mb=Object.getOwnPropertySymbols,hN=Object.prototype.hasOwnProperty,lN=Object.prototype.propertyIsEnumerable,yb=(r,e,t)=>e in r?cN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nc=(r,e)=>{for(var t in e||(e={}))hN.call(e,t)&&yb(r,t,e[t]);if(mb)for(var t of mb(e))lN.call(e,t)&&yb(r,t,e[t]);return r},Xl=(r,e)=>uN(r,fN(e));class dN extends rP{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new oN,this.events=new Vi.EventEmitter,this.name=pT,this.version=gT,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Kn,this.subscribeTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const a=Sd(n),c={topic:i,relay:a,transportType:n==null?void 0:n.transportType};this.pending.set(i,c);const f=await this.rpcSubscribe(i,a,n==null?void 0:n.transportType);return typeof f=="string"&&(this.onSubscribe(f,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((a,c)=>{const f=new Ae.Watch;f.start(n);const g=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(g),f.stop(n),a(!0)),f.elapsed(n)>=bT&&(clearInterval(g),f.stop(n),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qr(t,this.name),this.clientId=""}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=Sd(i);await this.rpcUnsubscribe(e,t,n);const a=Lt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i=Kt.relay){i===Kt.relay&&await this.restartToComplete();const n={method:cc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{const a=hs(e+this.clientId);return i===Kt.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(c=>this.logger.warn(c))},Ae.toMiliseconds(Ae.ONE_SECOND)),a):await await ro(this.relayer.request(n).catch(c=>this.logger.warn(c)),this.subscribeTimeout)?a:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Jr.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:cc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await ro(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:cc(t.protocol).batchFetchMessages,params:{topics:e.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await ro(this.relayer.request(i).catch(a=>this.logger.warn(a)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jr.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:cc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,Xl(nc({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,nc({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,nc({},t)),this.topicMap.set(t.topic,e),this.events.emit(Pn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Pn.deleted,Xl(nc({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Pn.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Hn(t)&&this.onBatchSubscribe(t.map((i,n)=>Xl(nc({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(So.pulse,async()=>{await this.checkPending()}),this.events.on(Pn.created,async e=>{const t=Pn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Pn.deleted,async e=>{const t=Pn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var pN=Object.defineProperty,wb=Object.getOwnPropertySymbols,gN=Object.prototype.hasOwnProperty,bN=Object.prototype.propertyIsEnumerable,_b=(r,e,t)=>e in r?pN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vN=(r,e)=>{for(var t in e||(e={}))gN.call(e,t)&&_b(r,t,e[t]);if(wb)for(var t of wb(e))bN.call(e,t)&&_b(r,t,e[t]);return r};class mN extends eP{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Vi.EventEmitter,this.name=uT,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ae.toMiliseconds(Ae.THIRTY_SECONDS+Ae.ONE_SECOND),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const a=t.id||da().toString();await this.toEstablishConnection();try{const c=this.provider.request(t);this.requestsInFlight.set(a,{promise:c,request:t}),this.logger.trace({id:a,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const f=await new Promise(async(g,d)=>{const m=()=>{d(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(Li.disconnect,m);const w=await c;this.provider.off(Li.disconnect,m),g(w)});return this.logger.trace({id:a,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - published"),f}catch(c){throw this.logger.debug(`Failed to Publish Request: ${a}`),c}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(yf())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Jr.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Jr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Li.payload,this.onPayloadHandler),this.provider.on(Li.connect,this.onConnectHandler),this.provider.on(Li.disconnect,this.onDisconnectHandler),this.provider.on(Li.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qr(e.logger,this.name):Uc(Zf({level:e.logger||cT})),this.messages=new sN(this.logger,e.core),this.subscriber=new dN(this,this.logger),this.publisher=new aN(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||E2,this.projectId=e.projectId,this.bundleId=TA(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return pi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Kt.relay})}async subscribe(e,t){var i;this.isInitialized(),(t==null?void 0:t.transportType)==="relay"&&await this.toEstablishConnection();let n=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",a;const c=f=>{f.topic===e&&(this.subscriber.off(Pn.created,c),a())};return await Promise.all([new Promise(f=>{a=f,this.subscriber.on(Pn.created,c)}),new Promise(async f=>{n=await this.subscriber.subscribe(e,t)||n,f()})]),n}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await ro(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const n=()=>{this.provider.off(Li.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Li.disconnect,n),await ro(this.provider.connect(),Ae.toMiliseconds(Ae.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{i(a)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(a=>{this.logger.error(a),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Kg())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=br(Ae.FIVE_MINUTES),a={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,a)}this.events.emit(Jr.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,n,a;if(yf())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((a=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new vn(new WO($A({sdkVersion:Td,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),p0(e)){if(!e.method.endsWith(fT))return;const t=e.params,{topic:i,message:n,publishedAt:a,attestation:c}=t.data,f={topic:i,message:n,publishedAt:a,transportType:Kt.relay,attestation:c};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(vN({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else ih(e)&&this.events.emit(Jr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Jr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=th(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Li.payload,this.onPayloadHandler),this.provider.off(Li.connect,this.onConnectHandler),this.provider.off(Li.disconnect,this.onDisconnectHandler),this.provider.off(Li.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Kg();zI(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Jr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ae.toMiliseconds(hT))))}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var yN=Object.defineProperty,Db=Object.getOwnPropertySymbols,wN=Object.prototype.hasOwnProperty,_N=Object.prototype.propertyIsEnumerable,Eb=(r,e,t)=>e in r?yN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ab=(r,e)=>{for(var t in e||(e={}))wN.call(e,t)&&Eb(r,t,e[t]);if(Db)for(var t of Db(e))_N.call(e,t)&&Eb(r,t,e[t]);return r};class Ma extends tP{constructor(e,t,i,n=Kn,a=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=lT,this.cached=[],this.initialized=!1,this.storagePrefix=Kn,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!fi(c)?this.map.set(this.getKey(c),c):mI(c)?this.map.set(c.id,c):yI(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,f)=>{this.isInitialized(),this.map.has(c)?await this.update(c,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:f}),this.map.set(c,f),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(f=>Object.keys(c).every(g=>QO(f[g],c[g]))):this.values),this.update=async(c,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:f});const g=Ab(Ab({},this.getData(c)),f);this.map.set(c,g),await this.persist()},this.delete=async(c,f)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:f}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=Qr(t,this.name),this.storagePrefix=n,this.getKey=a}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=De("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class DN{constructor(e,t){this.core=e,this.logger=t,this.name=vT,this.version=mT,this.events=new Fd,this.initialized=!1,this.storagePrefix=Kn,this.ignoredPayloadTypes=[bs],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=xd(),a=await this.core.crypto.setSymKey(n),c=br(Ae.FIVE_MINUTES),f={protocol:D2},g={topic:a,expiry:c,relay:f,active:!1,methods:i==null?void 0:i.methods},d=Lg({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:n,relay:f,expiryTimestamp:c,methods:i==null?void 0:i.methods});return this.events.emit(ha.create,g),this.core.expirer.set(a,c),await this.pairings.set(a,g),await this.core.relayer.subscribe(a,{transportType:i==null?void 0:i.transportType}),{topic:a,uri:d}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[Sn.pairing_started]}});this.isValidPair(i,n);const{topic:a,symKey:c,relay:f,expiryTimestamp:g,methods:d}=qg(i.uri);n.props.properties.topic=a,n.addTrace(Sn.pairing_uri_validation_success),n.addTrace(Sn.pairing_uri_not_expired);let m;if(this.pairings.keys.includes(a)){if(m=this.pairings.get(a),n.addTrace(Sn.existing_pairing),m.active)throw n.setError(us.active_pairing_already_exists),new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);n.addTrace(Sn.pairing_not_expired)}const w=g||br(Ae.FIVE_MINUTES),O={topic:a,relay:f,expiry:w,active:!1,methods:d};this.core.expirer.set(a,w),await this.pairings.set(a,O),n.addTrace(Sn.store_new_pairing),i.activatePairing&&await this.activate({topic:a}),this.events.emit(ha.create,O),n.addTrace(Sn.emit_inactive_pairing),this.core.crypto.keychain.has(a)||await this.core.crypto.setSymKey(c,a),n.addTrace(Sn.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(us.no_internet_connection)}try{await this.core.relayer.subscribe(a,{relay:f})}catch(C){throw n.setError(us.subscribe_pairing_topic_failure),C}return n.addTrace(Sn.subscribe_pairing_topic_success),O},this.activate=async({topic:i})=>{this.isInitialized();const n=br(Ae.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const a=await this.sendRequest(n,"wc_pairingPing",{}),{done:c,resolve:f,reject:g}=fa();this.events.once(xt("pairing_ping",a),({error:d})=>{d?g(d):f()}),await c()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Lt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:a,expiry:c,methods:f}=i,g=this.core.crypto.keychain.get(n);return Lg({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:g,relay:a,expiryTimestamp:c,methods:f})},this.sendRequest=async(i,n,a)=>{const c=Fs(n,a),f=await this.core.crypto.encode(i,c),g=rc[n].req;return this.core.history.set(i,c),this.core.relayer.publish(i,f,g),c.id},this.sendResult=async(i,n,a)=>{const c=th(i,a),f=await this.core.crypto.encode(n,c),g=await this.core.history.get(n,i),d=rc[g.request.method].res;await this.core.relayer.publish(n,f,d),await this.core.history.resolve(c)},this.sendError=async(i,n,a)=>{const c=rh(i,a),f=await this.core.crypto.encode(n,c),g=await this.core.history.get(n,i),d=rc[g.request.method]?rc[g.request.method].res:rc.unregistered_method.res;await this.core.relayer.publish(n,f,d),await this.core.history.resolve(c)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Lt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Rs(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:a}=i;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(n,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,a);default:return this.onUnknownRpcMethodRequest(n,a)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:a}=i,c=(await this.core.history.get(n,a.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(n,a);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(i,n)=>{const{id:a}=n;try{this.isValidPing({topic:i}),await this.sendResult(a,i,!0),this.events.emit(ha.ping,{id:a,topic:i})}catch(c){await this.sendError(a,i,c),this.logger.error(c)}},this.onPairingPingResponse=(i,n)=>{const{id:a}=n;setTimeout(()=>{Cn(n)?this.events.emit(xt("pairing_ping",a),{}):ji(n)&&this.events.emit(xt("pairing_ping",a),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(ha.delete,{id:a,topic:i})}catch(c){await this.sendError(a,i,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:a,method:c}=n;try{if(this.registeredMethods.includes(c))return;const f=Lt("WC_METHOD_UNSUPPORTED",c);await this.sendError(a,i,f),this.logger.error(f)}catch(f){await this.sendError(a,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Lt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var a;if(!ci(i)){const{message:f}=De("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(us.malformed_pairing_uri),new Error(f)}if(!vI(i.uri)){const{message:f}=De("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(us.malformed_pairing_uri),new Error(f)}const c=qg(i==null?void 0:i.uri);if(!((a=c==null?void 0:c.relay)!=null&&a.protocol)){const{message:f}=De("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(us.malformed_pairing_uri),new Error(f)}if(!(c!=null&&c.symKey)){const{message:f}=De("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(us.malformed_pairing_uri),new Error(f)}if(c!=null&&c.expiryTimestamp&&Ae.toMiliseconds(c==null?void 0:c.expiryTimestamp){if(!ci(i)){const{message:a}=De("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!ci(i)){const{message:a}=De("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!ur(i,!1)){const{message:n}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Rs(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=De("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=Qr(t,this.name),this.pairings=new Ma(this.core,this.logger,this.name,this.storagePrefix)}get context(){return pi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Jr.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===Kt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const a=await this.core.crypto.decode(t,i);try{p0(a)?(this.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a})):ih(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a}),this.core.history.delete(t,a.id))}catch(c){this.logger.error(c)}})}registerExpirerEvents(){this.core.expirer.on(Fi.expired,async e=>{const{topic:t}=l3(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(ha.expire,{topic:t}))})}}class EN extends QC{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Vi.EventEmitter,this.name=yT,this.version=wT,this.cached=[],this.initialized=!1,this.storagePrefix=Kn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:a}),this.records.has(n.id))return;const c={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:a,expiry:br(Ae.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(un.created,c)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ji(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(un.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(a=>{if(a.topic===i){if(typeof n<"u"&&a.id!==n)return;this.records.delete(a.id),this.events.emit(un.deleted,a)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Fs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(un.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(un.created,e=>{const t=un.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(un.updated,e=>{const t=un.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(un.deleted,e=>{const t=un.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(So.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Ae.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(un.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class AN extends iP{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Vi.EventEmitter,this.name=_T,this.version=DT,this.cached=[],this.initialized=!1,this.storagePrefix=Kn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const a=this.formatTarget(i),c={target:a,expiry:n};this.expirations.set(a,c),this.checkExpiry(a,c),this.events.emit(Fi.created,{target:a,expiration:c})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),a=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Fi.deleted,{target:n,expiration:a})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return UA(e);if(typeof e=="number")return qA(e);const{message:t}=De("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Fi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Ae.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Fi.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(So.pulse,()=>this.checkExpirations()),this.events.on(Fi.created,e=>{const t=Fi.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Fi.expired,e=>{const t=Fi.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Fi.deleted,e=>{const t=Fi.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.getLocalStorage=Qt.getLocalStorageOrThrow=Qt.getCrypto=Qt.getCryptoOrThrow=Qt.getLocation=Qt.getLocationOrThrow=Qt.getNavigator=Qt.getNavigatorOrThrow=B2=Qt.getDocument=Qt.getDocumentOrThrow=Qt.getFromWindowOrThrow=Qt.getFromWindow=void 0;function Ia(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Qt.getFromWindow=Ia;function Mo(r){const e=Ia(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Qt.getFromWindowOrThrow=Mo;function xN(){return Mo("document")}Qt.getDocumentOrThrow=xN;function SN(){return Ia("document")}var B2=Qt.getDocument=SN;function MN(){return Mo("navigator")}Qt.getNavigatorOrThrow=MN;function IN(){return Ia("navigator")}Qt.getNavigator=IN;function CN(){return Mo("location")}Qt.getLocationOrThrow=CN;function PN(){return Ia("location")}Qt.getLocation=PN;function ON(){return Mo("crypto")}Qt.getCryptoOrThrow=ON;function TN(){return Ia("crypto")}Qt.getCrypto=TN;function RN(){return Mo("localStorage")}Qt.getLocalStorageOrThrow=RN;function NN(){return Ia("localStorage")}Qt.getLocalStorage=NN;class BN extends nP{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=ET,this.verifyUrlV3=xT,this.storagePrefix=Kn,this.version=_2,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ae.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt){if(!Oc()||this.isDevEnv)return;const a=window.location.origin,{id:c,decryptedId:f}=n,g=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${a}&id=${c}&decryptedId=${f}`;try{const d=B2(),m=this.startAbortTimer(Ae.ONE_SECOND*5),w=await new Promise((O,C)=>{const P=()=>{window.removeEventListener("message",K),d.body.removeChild(q),C("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const q=d.createElement("iframe");q.src=g,q.style.display="none",q.addEventListener("error",P,{signal:this.abortController.signal});const K=Y=>{if(Y.data&&typeof Y.data=="string")try{const z=JSON.parse(Y.data);if(z.type==="verify_attestation"){if(md(z.attestation).payload.id!==c)return;clearInterval(m),d.body.removeChild(q),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",K),O(z.attestation===null?"":z.attestation)}}catch(z){this.logger.warn(z)}};d.body.appendChild(q),window.addEventListener("message",K,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(d){this.logger.warn(d)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:a,hash:c,encryptedId:f}=n;if(a===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(a){if(md(a).payload.id!==f)return;const d=await this.isValidJwtAttestation(a);if(d){if(!d.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return d}}if(!c)return;const g=this.getVerifyUrl(n==null?void 0:n.verifyUrl);return this.fetchAttestation(c,g)},this.fetchAttestation=async(n,a)=>{this.logger.debug(`resolving attestation: ${n} from url: ${a}`);const c=this.startAbortTimer(Ae.ONE_SECOND*5),f=await fetch(`${a}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(c),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let a=n||gc;return ST.includes(a)||(this.logger.info(`verify url: ${a}, not included in trusted list, assigning default: ${gc}`),a=gc),a},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(Ae.FIVE_SECONDS),a=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await a.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const a=await this.getPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const c=await this.fetchAndPersistPublicKey();try{if(c)return this.validateAttestation(n,c)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async a=>{const c=await this.fetchPublicKey();c&&(await this.persistPublicKey(c),a(c))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,a)=>{const c=XM(n,a.publicKey),f={hasExpired:Ae.toMiliseconds(c.exp)this.abortController.abort(),Ae.toMiliseconds(e))}}class $N extends sP{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=MT,this.registerDeviceToken=async i=>{const{clientId:n,token:a,notificationType:c,enableEncrypted:f=!1}=i,g=`${IT}/${this.projectId}/clients`;await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:c,token:a,always_raw:f})})},this.logger=Qr(t,this.context)}}var UN=Object.defineProperty,xb=Object.getOwnPropertySymbols,qN=Object.prototype.hasOwnProperty,LN=Object.prototype.propertyIsEnumerable,Sb=(r,e,t)=>e in r?UN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sc=(r,e)=>{for(var t in e||(e={}))qN.call(e,t)&&Sb(r,t,e[t]);if(xb)for(var t of xb(e))LN.call(e,t)&&Sb(r,t,e[t]);return r};class FN extends aP{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=PT,this.storagePrefix=Kn,this.storageVersion=CT,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!r0())try{const n={eventId:ig(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:c3(this.core.relayer.protocol,this.core.relayer.version,Td)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:a="ERROR",type:c="",properties:{topic:f,trace:g}}=n,d=ig(),m=this.core.projectId||"",w=Date.now(),O=sc({eventId:d,timestamp:w,props:{event:a,type:c,properties:{topic:f,trace:g}},bundleId:m,domain:this.getAppDomain()},this.setMethods(d));return this.telemetryEnabled&&(this.events.set(d,O),this.shouldPersist=!0),O},this.getEvent=n=>{const{eventId:a,topic:c}=n;if(a)return this.events.get(a);const f=Array.from(this.events.values()).find(g=>g.props.properties.topic===c);if(f)return sc(sc({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:a}=n;this.events.delete(a),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(So.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{Ae.fromMiliseconds(Date.now())-Ae.fromMiliseconds(n.timestamp)>OT&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:a=>this.addTrace(n,a),setError:a=>this.setError(n,a)}),this.addTrace=(n,a)=>{const c=this.events.get(n);c&&(c.props.properties.trace.push(a),this.events.set(n,c),this.shouldPersist=!0)},this.setError=(n,a)=>{const c=this.events.get(n);c&&(c.props.type=a,c.timestamp=Date.now(),this.events.set(n,c),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(a=>{this.events.set(a.eventId,sc(sc({},a),this.setMethods(a.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[a,c]of this.events)c.props.type&&n.push(c);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const a of n)this.events.delete(a.eventId),this.shouldPersist=!0}catch(a){this.logger.warn(a)}},this.sendEvent=async n=>{const a=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${TT}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Td}${a}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>o3().url,this.logger=Qr(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var zN=Object.defineProperty,Mb=Object.getOwnPropertySymbols,jN=Object.prototype.hasOwnProperty,kN=Object.prototype.propertyIsEnumerable,Ib=(r,e,t)=>e in r?zN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cb=(r,e)=>{for(var t in e||(e={}))jN.call(e,t)&&Ib(r,t,e[t]);if(Mb)for(var t of Mb(e))kN.call(e,t)&&Ib(r,t,e[t]);return r};class b0 extends YC{constructor(e){var t;super(e),this.protocol=w2,this.version=_2,this.name=g0,this.events=new Vi.EventEmitter,this.initialized=!1,this.on=(c,f)=>this.events.on(c,f),this.once=(c,f)=>this.events.once(c,f),this.off=(c,f)=>this.events.off(c,f),this.removeListener=(c,f)=>this.events.removeListener(c,f),this.dispatchEnvelope=({topic:c,message:f,sessionExists:g})=>{if(!c||!f)return;const d={topic:c,message:f,publishedAt:Date.now(),transportType:Kt.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:g})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||E2,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=Zf({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:XO.logger}),{logger:n,chunkLoggerController:a}=WC({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=a,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,f;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Qr(n,this.name),this.heartbeat=new KI,this.crypto=new nN(this,this.logger,e==null?void 0:e.keychain),this.history=new EN(this,this.logger),this.expirer=new AN(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new _C(Cb(Cb({},ZO),e==null?void 0:e.storageOptions)),this.relayer=new mN({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new DN(this,this.logger),this.verify=new BN(this,this.logger,this.storage),this.echoClient=new $N(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new FN(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const t=new b0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(dT,i),t}get context(){return pi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(hb,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(hb)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const HN=b0,$2="wc",U2=2,q2="client",v0=`${$2}@${U2}:${q2}:`,Zl={name:q2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},Pb="WALLETCONNECT_DEEPLINK_CHOICE",KN="proposal",L2="Proposal expired",VN="session",Ya=Ae.SEVEN_DAYS,GN="engine",wr={wc_sessionPropose:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ae.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ae.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1119}}},ed={min:Ae.FIVE_MINUTES,max:Ae.SEVEN_DAYS},xn={idle:"IDLE",active:"ACTIVE"},JN="request",WN=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],YN="wc",QN="auth",XN="authKeys",ZN="pairingTopics",eB="requests",sh=`${YN}@${1.5}:${QN}:`,hf=`${sh}:PUB_KEY`;var tB=Object.defineProperty,rB=Object.defineProperties,iB=Object.getOwnPropertyDescriptors,Ob=Object.getOwnPropertySymbols,nB=Object.prototype.hasOwnProperty,sB=Object.prototype.propertyIsEnumerable,Tb=(r,e,t)=>e in r?tB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rr=(r,e)=>{for(var t in e||(e={}))nB.call(e,t)&&Tb(r,t,e[t]);if(Ob)for(var t of Ob(e))sB.call(e,t)&&Tb(r,t,e[t]);return r},hn=(r,e)=>rB(r,iB(e));class aB extends cP{constructor(e){super(e),this.name=GN,this.events=new Fd,this.initialized=!1,this.requestQueue={state:xn.idle,queue:[]},this.sessionRequestQueue={state:xn.idle,queue:[]},this.requestQueueDelay=Ae.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(wr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=hn(rr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:f,relays:g}=i;let d=n,m,w=!1;try{d&&(w=this.client.core.pairing.pairings.get(d).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),B}if(!d||!w){const{topic:B,uri:j}=await this.client.core.pairing.create();d=B,m=j}if(!d){const{message:B}=De("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(B)}const O=await this.client.core.crypto.generateKeyPair(),C=wr.wc_sessionPropose.req.ttl||Ae.FIVE_MINUTES,P=br(C),q=rr({requiredNamespaces:a,optionalNamespaces:c,relays:g??[{protocol:D2}],proposer:{publicKey:O,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:d},f&&{sessionProperties:f}),{reject:K,resolve:Y,done:z}=fa(C,L2);this.events.once(xt("session_connect"),async({error:B,session:j})=>{if(B)K(B);else if(j){j.self.publicKey=O;const k=hn(rr({},j),{pairingTopic:q.pairingTopic,requiredNamespaces:q.requiredNamespaces,optionalNamespaces:q.optionalNamespaces,transportType:Kt.relay});await this.client.session.set(j.topic,k),await this.setExpiry(j.topic,j.expiry),d&&await this.client.core.pairing.updateMetadata({topic:d,metadata:j.peer.metadata}),this.cleanupDuplicatePairings(k),Y(k)}});const W=await this.sendRequest({topic:d,method:"wc_sessionPropose",params:q,throwOnFailedPublish:!0});return await this.setProposal(W,rr({id:W},q)),{uri:m,approval:z}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,a;const c=this.client.core.eventClient.createEvent({properties:{topic:(i=t==null?void 0:t.id)==null?void 0:i.toString(),trace:[fn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(N){throw c.setError(ca.no_internet_connection),N}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(N){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),c.setError(ca.proposal_not_found),N}try{await this.isValidApprove(t)}catch(N){throw this.client.logger.error("approve() -> isValidApprove() failed"),c.setError(ca.session_approve_namespace_validation_failure),N}const{id:f,relayProtocol:g,namespaces:d,sessionProperties:m,sessionConfig:w}=t,O=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:c.eventId});const{pairingTopic:C,proposer:P,requiredNamespaces:q,optionalNamespaces:K}=O;let Y=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:C});Y||(Y=(a=this.client.core.eventClient)==null?void 0:a.createEvent({type:fn.session_approve_started,properties:{topic:C,trace:[fn.session_approve_started,fn.session_namespaces_validation_success]}}));const z=await this.client.core.crypto.generateKeyPair(),W=P.publicKey,B=await this.client.core.crypto.generateSharedKey(z,W),j=rr(rr({relay:{protocol:g??"irn"},namespaces:d,controller:{publicKey:z,metadata:this.client.metadata},expiry:br(Ya)},m&&{sessionProperties:m}),w&&{sessionConfig:w}),k=Kt.relay;Y.addTrace(fn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(B,{transportType:k})}catch(N){throw Y.setError(ca.subscribe_session_topic_failure),N}Y.addTrace(fn.subscribe_session_topic_success);const _=hn(rr({},j),{topic:B,requiredNamespaces:q,optionalNamespaces:K,pairingTopic:C,acknowledged:!1,self:j.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:z,transportType:Kt.relay});await this.client.session.set(B,_),Y.addTrace(fn.store_session);try{Y.addTrace(fn.publishing_session_settle),await this.sendRequest({topic:B,method:"wc_sessionSettle",params:j,throwOnFailedPublish:!0}).catch(N=>{throw Y==null||Y.setError(ca.session_settle_publish_failure),N}),Y.addTrace(fn.session_settle_publish_success),Y.addTrace(fn.publishing_session_approve),await this.sendResult({id:f,topic:C,result:{relay:{protocol:g??"irn"},responderPublicKey:z},throwOnFailedPublish:!0}).catch(N=>{throw Y==null||Y.setError(ca.session_approve_publish_failure),N}),Y.addTrace(fn.session_approve_publish_success)}catch(N){throw this.client.logger.error(N),this.client.session.delete(B,Lt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(B),N}return this.client.core.eventClient.deleteEvent({eventId:Y.eventId}),await this.client.core.pairing.updateMetadata({topic:C,metadata:P.metadata}),await this.client.proposal.delete(f,Lt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:C}),await this.setExpiry(B,br(Ya)),{topic:B,acknowledged:()=>Promise.resolve(this.client.session.get(B))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:i,reason:n}=t;let a;try{a=this.client.proposal.get(i).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),c}a&&(await this.sendError({id:i,topic:a,error:n,rpcOpts:wr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Lt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:a,resolve:c,reject:f}=fa(),g=Bs(),d=da().toString(),m=this.client.session.get(i).namespaces;return this.events.once(xt("session_update",g),({error:w})=>{w?f(w):c()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:g,relayRpcId:d}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:m}),f(w)}),{acknowledged:a}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(g){throw this.client.logger.error("extend() -> isValidExtend() failed"),g}const{topic:i}=t,n=Bs(),{done:a,resolve:c,reject:f}=fa();return this.events.once(xt("session_extend",n),({error:g})=>{g?f(g):c()}),await this.setExpiry(i,br(Ya)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(g=>{f(g)}),{acknowledged:a}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:i,request:n,topic:a,expiry:c=wr.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(a);(f==null?void 0:f.transportType)===Kt.relay&&await this.confirmOnlineStateOrThrow();const g=Bs(),d=da().toString(),{done:m,resolve:w,reject:O}=fa(c,"Request expired. Please try again.");this.events.once(xt("session_request",g),({error:P,result:q})=>{P?O(P):w(q)});const C=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return C?(await this.sendRequest({clientRpcId:g,relayRpcId:d,topic:a,method:"wc_sessionRequest",params:{request:hn(rr({},n),{expiryTimestamp:br(c)}),chainId:i},expiry:c,throwOnFailedPublish:!0,appLink:C}).catch(P=>O(P)),this.client.events.emit("session_request_sent",{topic:a,request:n,chainId:i,id:g}),await m()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:g,relayRpcId:d,topic:a,method:"wc_sessionRequest",params:{request:hn(rr({},n),{expiryTimestamp:br(c)}),chainId:i},expiry:c,throwOnFailedPublish:!0}).catch(q=>O(q)),this.client.events.emit("session_request_sent",{topic:a,request:n,chainId:i,id:g}),P()}),new Promise(async P=>{var q;if(!((q=f.sessionConfig)!=null&&q.disableDeepLink)){const K=await zA(this.client.core.storage,Pb);await LA({id:g,topic:a,wcDeepLink:K})}P()}),m()]).then(P=>P[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:a}=n,c=this.client.session.get(i);c.transportType===Kt.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);Cn(n)?await this.sendResult({id:a,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):ji(n)&&await this.sendError({id:a,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Bs(),a=da().toString(),{done:c,resolve:f,reject:g}=fa();this.events.once(xt("session_ping",n),({error:d})=>{d?g(d):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:a}),c()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:a}=t,c=da().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:a},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Lt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=De("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>gI(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const a=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),c=a?Kt.link_mode:Kt.relay;c===Kt.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:g="",uri:d,domain:m,nonce:w,type:O,exp:C,nbf:P,methods:q=[],expiry:K}=t,Y=[...t.resources||[]],{topic:z,uri:W}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:c});this.client.logger.info({message:"Generated new pairing",pairing:{topic:z,uri:W}});const B=await this.client.core.crypto.generateKeyPair(),j=cf(B);if(await Promise.all([this.client.auth.authKeys.set(hf,{responseTopic:j,publicKey:B}),this.client.auth.pairingTopics.set(j,{topic:j,pairingTopic:z})]),await this.client.core.relayer.subscribe(j,{transportType:c}),this.client.logger.info(`sending request to new pairing topic: ${z}`),q.length>0){const{namespace:M}=fc(f[0]);let x=$M(M,"request",q);of(Y)&&(x=qM(x,Y.pop())),Y.push(x)}const k=K&&K>wr.wc_sessionAuthenticate.req.ttl?K:wr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:O??"caip122",chains:f,statement:g,aud:d,domain:m,version:"1",nonce:w,iat:new Date().toISOString(),exp:C,nbf:P,resources:Y},requester:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:br(k)},N={eip155:{chains:f,methods:[...new Set(["personal_sign",...q])],events:["chainChanged","accountsChanged"]}},se={requiredNamespaces:{},optionalNamespaces:N,relays:[{protocol:"irn"}],pairingTopic:z,proposer:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:br(wr.wc_sessionPropose.req.ttl)},{done:le,resolve:U,reject:y}=fa(k,"Request expired"),u=async({error:M,session:x})=>{if(this.events.off(xt("session_request",v),h),M)y(M);else if(x){x.self.publicKey=B,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),z&&await this.client.core.pairing.updateMetadata({topic:z,metadata:x.peer.metadata});const p=this.client.session.get(x.topic);await this.deleteProposal(E),U({session:p})}},h=async M=>{var x,p,b;if(await this.deletePendingAuthRequest(v,{message:"fulfilled",code:0}),M.error){const V=Lt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return M.error.code===V.code?void 0:(this.events.off(xt("session_connect"),u),y(M.error.message))}await this.deleteProposal(E),this.events.off(xt("session_connect"),u);const{cacaos:R,responder:Z}=M.result,ae=[],I=[];for(const V of R){await Cg({cacao:V,projectId:this.client.core.projectId})||(this.client.logger.error(V,"Signature verification failed"),y(Lt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:G}=V,D=of(G.resources),H=[Ig(G.iss)],ne=Af(G.iss);if(D){const ce=Pg(D),fe=Og(D);ae.push(...ce),H.push(...fe)}for(const ce of H)I.push(`${ce}:${ne}`)}const ee=await this.client.core.crypto.generateSharedKey(B,Z.publicKey);let L;ae.length>0&&(L={topic:ee,acknowledged:!0,self:{publicKey:B,metadata:this.client.metadata},peer:Z,controller:Z.publicKey,expiry:br(Ya),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:z,namespaces:Fg([...new Set(ae)],[...new Set(I)]),transportType:c},await this.client.core.relayer.subscribe(ee,{transportType:c}),await this.client.session.set(ee,L),z&&await this.client.core.pairing.updateMetadata({topic:z,metadata:Z.metadata}),L=this.client.session.get(ee)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(p=Z.metadata.redirect)!=null&&p.linkMode&&(b=Z.metadata.redirect)!=null&&b.universal&&i&&(this.client.core.addLinkModeSupportedApp(Z.metadata.redirect.universal),this.client.session.update(ee,{transportType:Kt.link_mode})),U({auths:R,session:L})},v=Bs(),E=Bs();this.events.once(xt("session_connect"),u),this.events.once(xt("session_request",v),h);let S;try{if(a){const M=Fs("wc_sessionAuthenticate",_,v);this.client.core.history.set(z,M);const x=await this.client.core.crypto.encode("",M,{type:Bc,encoding:ec});S=Wu(i,z,x)}else await Promise.all([this.sendRequest({topic:z,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:v}),this.sendRequest({topic:z,method:"wc_sessionPropose",params:se,expiry:wr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:E})])}catch(M){throw this.events.off(xt("session_connect"),u),this.events.off(xt("session_request",v),h),M}return await this.setProposal(E,rr({id:E},se)),await this.setAuthRequest(v,{request:hn(rr({},_),{verifyContext:{}}),pairingTopic:z,transportType:c}),{uri:S??W,response:le}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,a=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[ua.authenticated_session_approve_started]}});try{this.isInitialized()}catch(K){throw a.setError(ic.no_internet_connection),K}const c=this.getPendingAuthRequest(i);if(!c)throw a.setError(ic.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=c.transportType||Kt.relay;f===Kt.relay&&await this.confirmOnlineStateOrThrow();const g=c.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),m=cf(g),w={type:bs,receiverPublicKey:g,senderPublicKey:d},O=[],C=[];for(const K of n){if(!await Cg({cacao:K,projectId:this.client.core.projectId})){a.setError(ic.invalid_cacao);const j=Lt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:m,error:j,encodeOpts:w}),new Error(j.message)}a.addTrace(ua.cacaos_verified);const{p:Y}=K,z=of(Y.resources),W=[Ig(Y.iss)],B=Af(Y.iss);if(z){const j=Pg(z),k=Og(z);O.push(...j),W.push(...k)}for(const j of W)C.push(`${j}:${B}`)}const P=await this.client.core.crypto.generateSharedKey(d,g);a.addTrace(ua.create_authenticated_session_topic);let q;if((O==null?void 0:O.length)>0){q={topic:P,acknowledged:!0,self:{publicKey:d,metadata:this.client.metadata},peer:{publicKey:g,metadata:c.requester.metadata},controller:g,expiry:br(Ya),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:c.pairingTopic,namespaces:Fg([...new Set(O)],[...new Set(C)]),transportType:f},a.addTrace(ua.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:f})}catch(K){throw a.setError(ic.subscribe_authenticated_session_topic_failure),K}a.addTrace(ua.subscribe_authenticated_session_topic_success),await this.client.session.set(P,q),a.addTrace(ua.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:c.pairingTopic,metadata:c.requester.metadata})}a.addTrace(ua.publishing_authenticated_session_approve);try{await this.sendResult({topic:m,id:i,result:{cacaos:n,responder:{publicKey:d,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(c.requester.metadata,f)})}catch(K){throw a.setError(ic.authenticated_session_approve_publish_failure),K}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:c.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:a.eventId}),{session:q}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,a=this.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);a.transportType===Kt.relay&&await this.confirmOnlineStateOrThrow();const c=a.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),g=cf(c),d={type:bs,receiverPublicKey:c,senderPublicKey:f};await this.sendError({id:i,topic:g,error:n,encodeOpts:d,rpcOpts:wr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(a.requester.metadata,a.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Lt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return W3(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(a=>{var c,f;return((c=a.peerMetadata)==null?void 0:c.url)&&((f=a.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:a=!1,emitEvent:c=!0,id:f=0}=t,{self:g}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Lt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(g.publicKey)&&await this.client.core.crypto.deleteKeyPair(g.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),a||this.client.core.expirer.del(n),this.client.core.storage.removeItem(Pb).catch(d=>this.client.logger.warn(d)),this.getPendingSessionRequests().forEach(d=>{d.topic===n&&this.deletePendingSessionRequest(d.id,Lt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=xn.idle),c&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),a=this.client.core.eventClient.getEvent({topic:n.pairingTopic});a==null||a.setError(ca.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Lt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),n&&(this.sessionRequestQueue.state=xn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,br(wr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:a,transportType:c=Kt.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:a,verifyContext:n.verifyContext,transportType:c})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:a,verifyContext:c}=t,f=a.request.expiryTimestamp||br(wr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:a,verifyContext:c})},this.sendRequest=async t=>{const{topic:i,method:n,params:a,expiry:c,relayRpcId:f,clientRpcId:g,throwOnFailedPublish:d,appLink:m}=t,w=Fs(n,a,g);let O;const C=!!m;try{const K=C?ec:Ls;O=await this.client.core.crypto.encode(i,w,{encoding:K})}catch(K){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),K}let P;if(WN.includes(n)){const K=hs(JSON.stringify(w)),Y=hs(O);P=await this.client.core.verify.register({id:Y,decryptedId:K})}const q=wr[n].req;if(q.attestation=P,c&&(q.ttl=c),f&&(q.id=f),this.client.core.history.set(i,w),C){const K=Wu(m,i,O);await globalThis.Linking.openURL(K,this.client.name)}else{const K=wr[n].req;c&&(K.ttl=c),f&&(K.id=f),d?(K.internal=hn(rr({},K.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,O,K)):this.client.core.relayer.publish(i,O,K).catch(Y=>this.client.logger.error(Y))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:a,throwOnFailedPublish:c,encodeOpts:f,appLink:g}=t,d=th(i,a);let m;const w=g&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const C=w?ec:Ls;m=await this.client.core.crypto.encode(n,d,hn(rr({},f||{}),{encoding:C}))}catch(C){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),C}let O;try{O=await this.client.core.history.get(n,i)}catch(C){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),C}if(w){const C=Wu(g,n,m);await globalThis.Linking.openURL(C,this.client.name)}else{const C=wr[O.request.method].res;c?(C.internal=hn(rr({},C.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,m,C)):this.client.core.relayer.publish(n,m,C).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(d)},this.sendError=async t=>{const{id:i,topic:n,error:a,encodeOpts:c,rpcOpts:f,appLink:g}=t,d=rh(i,a);let m;const w=g&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const C=w?ec:Ls;m=await this.client.core.crypto.encode(n,d,hn(rr({},c||{}),{encoding:C}))}catch(C){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),C}let O;try{O=await this.client.core.history.get(n,i)}catch(C){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),C}if(w){const C=Wu(g,n,m);await globalThis.Linking.openURL(C,this.client.name)}else{const C=f||wr[O.request.method].res;this.client.core.relayer.publish(n,m,C)}await this.client.core.history.resolve(d)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let a=!1;Rs(n.expiry)&&(a=!0),this.client.core.crypto.keychain.has(n.topic)||(a=!0),a&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Rs(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===xn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=xn.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=xn.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:a,transportType:c,encryptedId:f}=t,g=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:g}))switch(g){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:a,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:a,encryptedId:f,transportType:c});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:a,encryptedId:f,transportType:c});default:return this.client.logger.info(`Unsupported request method ${g}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:a}=t,c=(await this.client.core.history.get(i,n.id)).request.method;switch(c){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,a);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${c}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=De("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,a=this.expectedPairingMethodMap.get(i);return!a||a.includes(n)?!1:!!(a.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:a,encryptedId:c}=t,{params:f,id:g}=n;try{const d=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(rr({},n.params));const m=f.expiryTimestamp||br(wr.wc_sessionPropose.req.ttl),w=rr({id:g,pairingTopic:i,expiryTimestamp:m},f);await this.setProposal(g,w);const O=await this.getVerifyContext({attestationId:a,hash:hs(JSON.stringify(n)),encryptedId:c,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),d==null||d.setError(us.proposal_listener_not_found)),d==null||d.addTrace(Sn.emit_session_proposal),this.client.events.emit("session_proposal",{id:g,params:w,verifyContext:O})}catch(d){await this.sendError({id:g,topic:i,error:d,rpcOpts:wr.wc_sessionPropose.autoReject}),this.client.logger.error(d)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:a}=i;if(Cn(i)){const{result:c}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:c});const f=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const g=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:g});const d=c.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:d});const m=await this.client.core.crypto.generateSharedKey(g,d);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const w=await this.client.core.relayer.subscribe(m,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(ji(i)){await this.client.proposal.delete(a,Lt("USER_DISCONNECTED"));const c=xt("session_connect");if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners, 954`);this.events.emit(xt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:a}=i;try{this.isValidSessionSettleRequest(a);const{relay:c,controller:f,expiry:g,namespaces:d,sessionProperties:m,sessionConfig:w}=i.params,O=hn(rr(rr({topic:t,relay:c,expiry:g,namespaces:d,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},m&&{sessionProperties:m}),w&&{sessionConfig:w}),{transportType:Kt.relay}),C=xt("session_connect");if(this.events.listenerCount(C)===0)throw new Error(`emitting ${C} without any listeners 997`);this.events.emit(xt("session_connect"),{session:O}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(c){await this.sendError({id:n,topic:t,error:c}),this.client.logger.error(c)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;Cn(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(xt("session_approve",n),{})):ji(i)&&(await this.client.session.delete(t,Lt("USER_DISCONNECTED")),this.events.emit(xt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:a}=i;try{const c=`${t}_session_update`,f=tc.get(c);if(f&&this.isRequestOutOfSync(f,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError({id:a,topic:t,error:Lt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(rr({topic:t},n));try{tc.set(c,a),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0})}catch(g){throw tc.delete(c),g}this.client.events.emit("session_update",{id:a,topic:t,params:n})}catch(c){await this.sendError({id:a,topic:t,error:c}),this.client.logger.error(c)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,a=xt("session_update",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Cn(i)?this.events.emit(xt("session_update",n),{}):ji(i)&&this.events.emit(xt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,br(Ya)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,a=xt("session_extend",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Cn(i)?this.events.emit(xt("session_extend",n),{}):ji(i)&&this.events.emit(xt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,a=xt("session_ping",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{Cn(i)?this.events.emit(xt("session_ping",n),{}):ji(i)&&this.events.emit(xt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(a=>{this.client.core.relayer.once(Jr.publish,async()=>{a(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Lt("USER_DISCONNECTED")})]).catch(a=>this.client.logger.error(a))}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async t=>{var i,n,a;const{topic:c,payload:f,attestation:g,encryptedId:d,transportType:m}=t,{id:w,params:O}=f;try{await this.isValidRequest(rr({topic:c},O));const C=this.client.session.get(c),P=await this.getVerifyContext({attestationId:g,hash:hs(JSON.stringify(Fs("wc_sessionRequest",O,w))),encryptedId:d,metadata:C.peer.metadata,transportType:m}),q={id:w,topic:c,params:O,verifyContext:P};await this.setPendingSessionRequest(q),m===Kt.link_mode&&(i=C.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=C.peer.metadata.redirect)==null?void 0:n.universal),(a=this.client.signConfig)!=null&&a.disableRequestQueue?this.emitSessionRequest(q):(this.addSessionRequestToSessionRequestQueue(q),this.processSessionRequestQueue())}catch(C){await this.sendError({id:w,topic:c,error:C}),this.client.logger.error(C)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,a=xt("session_request",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Cn(i)?this.events.emit(xt("session_request",n),{result:i.result}):ji(i)&&this.events.emit(xt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:a}=i;try{const c=`${t}_session_event_${a.event.name}`,f=tc.get(c);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(rr({topic:t},a)),this.client.events.emit("session_event",{id:n,topic:t,params:a}),tc.set(c,n)}catch(c){await this.sendError({id:n,topic:t,error:c}),this.client.logger.error(c)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),Cn(i)?this.events.emit(xt("session_request",n),{result:i.result}):ji(i)&&this.events.emit(xt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:a,attestation:c,encryptedId:f,transportType:g}=t;try{const{requester:d,authPayload:m,expiryTimestamp:w}=a.params,O=await this.getVerifyContext({attestationId:c,hash:hs(JSON.stringify(a)),encryptedId:f,metadata:d.metadata,transportType:g}),C={requester:d,pairingTopic:n,id:a.id,authPayload:m,verifyContext:O,expiryTimestamp:w};await this.setAuthRequest(a.id,{request:C,pairingTopic:n,transportType:g}),g===Kt.link_mode&&(i=d.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(d.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:a.params,id:a.id,verifyContext:O})}catch(d){this.client.logger.error(d);const m=a.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),O=this.getAppLinkIfEnabled(a.params.requester.metadata,g),C={type:bs,receiverPublicKey:m,senderPublicKey:w};await this.sendError({id:a.id,topic:n,error:d,encodeOpts:C,rpcOpts:wr.wc_sessionAuthenticate.autoReject,appLink:O})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=xn.idle,this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{const c=a.request.id,f=xt("session_request",c);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(xt("session_request",a.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===xn.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=xn.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Fs("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(g)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:a,sessionProperties:c,relays:f}=t;if(fi(i)||await this.isValidPairingTopic(i),!MI(f)){const{message:g}=De("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(g)}!fi(n)&&_c(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!fi(a)&&_c(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),fi(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=SI(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!ci(t))throw new Error(De("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:a,sessionProperties:c}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),g=Kl(n,"approve()");if(g)throw new Error(g.message);const d=kg(f.requiredNamespaces,n,"approve()");if(d)throw new Error(d.message);if(!ur(a,!0)){const{message:m}=De("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(m)}fi(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async t=>{if(!ci(t)){const{message:a}=De("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!CI(n)){const{message:a}=De("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!ci(t)){const{message:d}=De("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(d)}const{relay:i,controller:n,namespaces:a,expiry:c}=t;if(!i2(i)){const{message:d}=De("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(d)}const f=wI(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const g=Kl(a,"onSessionSettleRequest()");if(g)throw new Error(g.message);if(Rs(c)){const{message:d}=De("EXPIRED","onSessionSettleRequest()");throw new Error(d)}},this.isValidUpdate=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(g)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const a=this.client.session.get(i),c=Kl(n,"update()");if(c)throw new Error(c.message);const f=kg(a.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(g)}const{topic:i,request:n,chainId:a,expiry:c}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!jg(f,a)){const{message:g}=De("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(g)}if(!PI(n)){const{message:g}=De("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(g)}if(!RI(f,a,n.method)){const{message:g}=De("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(g)}if(c&&!UI(c,ed)){const{message:g}=De("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${ed.min} and ${ed.max}`);throw new Error(g)}},this.isValidRespond=async t=>{var i;if(!ci(t)){const{message:c}=De("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:n,response:a}=t;try{await this.isValidSessionTopic(n)}catch(c){throw(i=t==null?void 0:t.response)!=null&&i.id&&this.cleanupAfterResponse(t),c}if(!OI(a)){const{message:c}=De("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!ci(t)){const{message:f}=De("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:a}=t;await this.isValidSessionTopic(i);const{namespaces:c}=this.client.session.get(i);if(!jg(c,a)){const{message:f}=De("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(f)}if(!TI(n)){const{message:f}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!NI(c,a,n.name)){const{message:f}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:a,nonce:c}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!ur(n,!1))throw new Error("uri is required parameter");if(!ur(a,!1))throw new Error("domain is required parameter");if(!ur(c,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(g=>fc(g).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=fc(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:a,metadata:c,transportType:f}=t,g={verified:{verifyUrl:c.verifyUrl||gc,validation:"UNKNOWN",origin:c.url||""}};try{if(f===Kt.link_mode){const m=this.getAppLinkIfEnabled(c,f);return g.verified.validation=m&&new URL(m).origin===new URL(c.url).origin?"VALID":"INVALID",g}const d=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:a,verifyUrl:c.verifyUrl});d&&(g.verified.origin=d.origin,g.verified.isScam=d.isScam,g.verified.validation=d.origin===new URL(c.url).origin?"VALID":"INVALID")}catch(d){this.client.logger.warn(d)}return this.client.logger.debug(`Verify context: ${JSON.stringify(g)}`),g},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!ur(n,!1)){const{message:a}=De("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(a)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const a=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(n++>=a)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=De("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,a,c,f,g,d,m,w,O;return!t||i!==Kt.link_mode?!1:((a=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:a.linkMode)===!0&&((f=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:f.universal)!==void 0&&((d=(g=this.client.metadata)==null?void 0:g.redirect)==null?void 0:d.universal)!==""&&((m=t==null?void 0:t.redirect)==null?void 0:m.universal)!==void 0&&((w=t==null?void 0:t.redirect)==null?void 0:w.universal)!==""&&((O=t==null?void 0:t.redirect)==null?void 0:O.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t==null?void 0:t.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=rg(t,"topic")||"",n=decodeURIComponent(rg(t,"wc_ev")||""),a=this.client.session.keys.includes(i);a&&this.client.session.update(i,{transportType:Kt.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:a})},this.registerLinkModeListeners=async()=>{var t;if(r0()||wo()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=globalThis==null?void 0:globalThis.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Jr.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:a}=e,{publicKey:c}=this.client.auth.authKeys.keys.includes(hf)?this.client.auth.authKeys.get(hf):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:c,encoding:a===Kt.link_mode?ec:Ls});try{p0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:a,encryptedId:hs(i)})):ih(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:a}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:a})}catch(g){this.client.logger.error(g)}}registerExpirerEvents(){this.client.core.expirer.on(Fi.expired,async e=>{const{topic:t,id:i}=l3(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,De("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,De("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(ha.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ha.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ur(e,!1)){const{message:t}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=De("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!ur(e,!1)){const{message:t}=De("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=De("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=De("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ur(e,!1)){const{message:t}=De("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=De("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!II(e)){const{message:t}=De("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=De("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class oB extends Ma{constructor(e,t){super(e,t,KN,v0),this.core=e,this.logger=t}}class cB extends Ma{constructor(e,t){super(e,t,VN,v0),this.core=e,this.logger=t}}class uB extends Ma{constructor(e,t){super(e,t,JN,v0,i=>i.id),this.core=e,this.logger=t}}class fB extends Ma{constructor(e,t){super(e,t,XN,sh,()=>hf),this.core=e,this.logger=t}}class hB extends Ma{constructor(e,t){super(e,t,ZN,sh),this.core=e,this.logger=t}}class lB extends Ma{constructor(e,t){super(e,t,eB,sh,i=>i.id),this.core=e,this.logger=t}}class dB{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new fB(this.core,this.logger),this.pairingTopics=new hB(this.core,this.logger),this.requests=new lB(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class m0 extends oP{constructor(e){super(e),this.protocol=$2,this.version=U2,this.name=Zl.name,this.events=new Vi.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(a){throw this.logger.error(a.message),a}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=(e==null?void 0:e.name)||Zl.name,this.metadata=(e==null?void 0:e.metadata)||o3(),this.signConfig=e==null?void 0:e.signConfig;const t=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Uc(Zf({level:(e==null?void 0:e.logger)||Zl.logger}));this.core=(e==null?void 0:e.core)||new HN(e),this.logger=Qr(t,this.name),this.session=new cB(this.core,this.logger),this.proposal=new oB(this.core,this.logger),this.pendingRequest=new uB(this.core,this.logger),this.engine=new aB(this),this.auth=new dB(this.core,this.logger)}static async init(e){const t=new m0(e);return await t.initialize(),t}get context(){return pi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Bd={exports:{}};(function(r,e){var t=typeof self<"u"?self:tv,i=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(c){var f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function g(h){return h&&DataView.prototype.isPrototypeOf(h)}if(f.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(h){return h&&d.indexOf(Object.prototype.toString.call(h))>-1};function w(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function O(h){return typeof h!="string"&&(h=String(h)),h}function C(h){var v={next:function(){var E=h.shift();return{done:E===void 0,value:E}}};return f.iterable&&(v[Symbol.iterator]=function(){return v}),v}function P(h){this.map={},h instanceof P?h.forEach(function(v,E){this.append(E,v)},this):Array.isArray(h)?h.forEach(function(v){this.append(v[0],v[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(v){this.append(v,h[v])},this)}P.prototype.append=function(h,v){h=w(h),v=O(v);var E=this.map[h];this.map[h]=E?E+", "+v:v},P.prototype.delete=function(h){delete this.map[w(h)]},P.prototype.get=function(h){return h=w(h),this.has(h)?this.map[h]:null},P.prototype.has=function(h){return this.map.hasOwnProperty(w(h))},P.prototype.set=function(h,v){this.map[w(h)]=O(v)},P.prototype.forEach=function(h,v){for(var E in this.map)this.map.hasOwnProperty(E)&&h.call(v,this.map[E],E,this)},P.prototype.keys=function(){var h=[];return this.forEach(function(v,E){h.push(E)}),C(h)},P.prototype.values=function(){var h=[];return this.forEach(function(v){h.push(v)}),C(h)},P.prototype.entries=function(){var h=[];return this.forEach(function(v,E){h.push([E,v])}),C(h)},f.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function q(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function K(h){return new Promise(function(v,E){h.onload=function(){v(h.result)},h.onerror=function(){E(h.error)}})}function Y(h){var v=new FileReader,E=K(v);return v.readAsArrayBuffer(h),E}function z(h){var v=new FileReader,E=K(v);return v.readAsText(h),E}function W(h){for(var v=new Uint8Array(h),E=new Array(v.length),S=0;S-1?v:h}function N(h,v){v=v||{};var E=v.body;if(h instanceof N){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,v.headers||(this.headers=new P(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!E&&h._bodyInit!=null&&(E=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new P(v.headers)),this.method=_(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function se(h){var v=new FormData;return h.trim().split("&").forEach(function(E){if(E){var S=E.split("="),M=S.shift().replace(/\+/g," "),x=S.join("=").replace(/\+/g," ");v.append(decodeURIComponent(M),decodeURIComponent(x))}}),v}function le(h){var v=new P,E=h.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(S){var M=S.split(":"),x=M.shift().trim();if(x){var p=M.join(":").trim();v.append(x,p)}}),v}j.call(N.prototype);function U(h,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new P(v.headers),this.url=v.url||"",this._initBody(h)}j.call(U.prototype),U.prototype.clone=function(){return new U(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},U.error=function(){var h=new U(null,{status:0,statusText:""});return h.type="error",h};var y=[301,302,303,307,308];U.redirect=function(h,v){if(y.indexOf(v)===-1)throw new RangeError("Invalid status code");return new U(null,{status:v,headers:{location:h}})},c.DOMException=a.DOMException;try{new c.DOMException}catch{c.DOMException=function(v,E){this.message=v,this.name=E;var S=Error(v);this.stack=S.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function u(h,v){return new Promise(function(E,S){var M=new N(h,v);if(M.signal&&M.signal.aborted)return S(new c.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function p(){x.abort()}x.onload=function(){var b={status:x.status,statusText:x.statusText,headers:le(x.getAllResponseHeaders()||"")};b.url="responseURL"in x?x.responseURL:b.headers.get("X-Request-URL");var R="response"in x?x.response:x.responseText;E(new U(R,b))},x.onerror=function(){S(new TypeError("Network request failed"))},x.ontimeout=function(){S(new TypeError("Network request failed"))},x.onabort=function(){S(new c.DOMException("Aborted","AbortError"))},x.open(M.method,M.url,!0),M.credentials==="include"?x.withCredentials=!0:M.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&f.blob&&(x.responseType="blob"),M.headers.forEach(function(b,R){x.setRequestHeader(R,b)}),M.signal&&(M.signal.addEventListener("abort",p),x.onreadystatechange=function(){x.readyState===4&&M.signal.removeEventListener("abort",p)}),x.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return u.polyfill=!0,a.fetch||(a.fetch=u,a.Headers=P,a.Request=N,a.Response=U),c.Headers=P,c.Request=N,c.Response=U,c.fetch=u,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(Bd,Bd.exports);var pB=Bd.exports;const Rb=Ld(pB);var gB=Object.defineProperty,bB=Object.defineProperties,vB=Object.getOwnPropertyDescriptors,Nb=Object.getOwnPropertySymbols,mB=Object.prototype.hasOwnProperty,yB=Object.prototype.propertyIsEnumerable,Bb=(r,e,t)=>e in r?gB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$b=(r,e)=>{for(var t in e||(e={}))mB.call(e,t)&&Bb(r,t,e[t]);if(Nb)for(var t of Nb(e))yB.call(e,t)&&Bb(r,t,e[t]);return r},Ub=(r,e)=>bB(r,vB(e));const wB={Accept:"application/json","Content-Type":"application/json"},_B="POST",qb={headers:wB,method:_B},Lb=10;class Wn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Vi.EventEmitter,this.isAvailable=!1,this.registering=!1,!ab(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=ys(e),i=await(await Rb(this.url,Ub($b({},qb),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!ab(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),n(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ys({id:1,jsonrpc:"2.0",method:"test",params:[]});await Rb(e,Ub($b({},qb),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?ma(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),a=rh(e,n);this.events.emit("payload",a)}parseError(e,t=this.url){return g2(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Lb&&this.events.setMaxListeners(Lb)}}const Fb="error",DB="wss://relay.walletconnect.org",EB="wc",AB="universal_provider",zb=`${EB}@2:${AB}:`,F2="https://rpc.walletconnect.org/v1/",Za="generic",xB=`${F2}bundler`,mn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ac=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},$d={exports:{}};/** +***************************************************************************** */var Pd=function(r,e){return Pd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Pd(r,e)};function gO(r,e){Pd(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Od=function(){return Od=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;f--)(c=r[f])&&(a=(n<3?c(a):n>3?c(e,t,a):c(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a}function mO(r,e){return function(t,i){e(t,i,r)}}function yO(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function wO(r,e,t,i){function n(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{d(i.next(m))}catch(w){c(w)}}function g(m){try{d(i.throw(m))}catch(w){c(w)}}function d(m){m.done?a(m.value):n(m.value).then(f,g)}d((i=i.apply(r,e||[])).next())})}function _O(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(d){return function(m){return g([d,m])}}function g(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(a=d[0]&2?n.return:d[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,d[1])).done)return a;switch(n=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,n=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function v2(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,a=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(f){c={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return a}function AO(){for(var r=[],e=0;e1||f(O,I)})})}function f(O,I){try{g(i[O](I))}catch(P){w(a[0][3],P)}}function g(O){O.value instanceof xc?Promise.resolve(O.value.v).then(d,m):w(a[0][2],O)}function d(O){f("next",O)}function m(O){f("throw",O)}function w(O,I){O(I),a.shift(),a.length&&f(a[0][0],a[0][1])}}function MO(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,a){e[n]=r[n]?function(c){return(t=!t)?{value:xc(r[n](c)),done:n==="return"}:a?a(c):c}:a}}function IO(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Td=="function"?Td(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(c){return new Promise(function(f,g){c=r[a](c),n(f,g,c.done,c.value)})}}function n(a,c,f,g){Promise.resolve(g).then(function(d){a({value:d,done:f})},c)}}function CO(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function PO(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function OO(r){return r&&r.__esModule?r:{default:r}}function TO(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function RO(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const NO=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Od},__asyncDelegator:MO,__asyncGenerator:SO,__asyncValues:IO,__await:xc,__awaiter:wO,__classPrivateFieldGet:TO,__classPrivateFieldSet:RO,__createBinding:DO,__decorate:vO,__exportStar:EO,__extends:gO,__generator:_O,__importDefault:OO,__importStar:PO,__makeTemplateObject:CO,__metadata:yO,__param:mO,__read:v2,__rest:bO,__spread:AO,__spreadArrays:xO,__values:Td},Symbol.toStringTag,{value:"Module"})),BO=tv(NO);var cs={},sb;function $O(){if(sb)return cs;sb=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.isBrowserCryptoAvailable=cs.getSubtleCrypto=cs.getBrowerCrypto=void 0;function r(){return(globalThis==null?void 0:globalThis.crypto)||(globalThis==null?void 0:globalThis.msCrypto)||{}}cs.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}cs.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return cs.isBrowserCryptoAvailable=t,cs}var us={},ab;function UO(){if(ab)return us;ab=1;var r={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};Object.defineProperty(us,"__esModule",{value:!0}),us.isBrowser=us.isNode=us.isReactNative=void 0;function e(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}us.isReactNative=e;function t(){return typeof r<"u"&&typeof r.versions<"u"&&typeof r.versions.node<"u"}us.isNode=t;function i(){return!e()&&!t()}return us.isBrowser=i,us}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=BO;e.__exportStar($O(),r),e.__exportStar(UO(),r)})(b2);function Bs(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function pa(r=6){return BigInt(Bs(r))}function Fs(r,e,t){return{id:t||Bs(),jsonrpc:"2.0",method:r,params:e}}function rh(r,e){return{id:r,jsonrpc:"2.0",result:e}}function ih(r,e,t){return{id:r,jsonrpc:"2.0",error:qO(e)}}function qO(r,e){return typeof r>"u"?nb(d2):(typeof r=="string"&&(r=Object.assign(Object.assign({},nb(p0)),{message:r})),dO(r.code)&&(r=pO(r.code)),r)}class LO{}class FO extends LO{constructor(){super()}}class zO extends FO{constructor(e){super()}}const jO="^https?:",kO="^wss?:";function HO(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function m2(r,e){const t=HO(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function ob(r){return m2(r,jO)}function cb(r){return m2(r,kO)}function KO(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function y2(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function g0(r){return y2(r)&&"method"in r}function nh(r){return y2(r)&&(Pn(r)||ji(r))}function Pn(r){return"result"in r}function ji(r){return"error"in r}let mn=class extends zO{constructor(e){super(e),this.events=new Vi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Fs(e.method,e.params||[],e.id||pa().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(a){n(a)}this.events.on(`${e.id}`,a=>{ji(a)?n(a.error):i(a.result)});try{await this.connection.send(e,t)}catch(a){n(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),nh(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const VO=()=>typeof WebSocket<"u"?WebSocket:typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"?globalThis.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),GO=()=>typeof WebSocket<"u"||typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",ub=r=>r.split("?")[0],fb=10,JO=VO();let WO=class{constructor(e){if(this.url=e,this.events=new Vi.EventEmitter,this.registering=!1,!cb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ys(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!cb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),n(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=new URLSearchParams(e).get("origin"),a=b2.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!KO(e)},c=new JO(e,[],a);GO()?c.onerror=f=>{const g=f;i(this.emitError(g.error))}:c.on("error",f=>{i(this.emitError(f))}),c.onopen=()=>{this.onOpen(c),t(c)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?ya(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),a=ih(e,n);this.events.emit("payload",a)}parseError(e,t=this.url){return g2(e,ub(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>fb&&this.events.setMaxListeners(fb)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${ub(this.url)}`));return this.events.emit("register_error",t),t}};var Cf={exports:{}};Cf.exports;(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,a=2,c=9007199254740991,f="[object Arguments]",g="[object Array]",d="[object AsyncFunction]",m="[object Boolean]",w="[object Date]",O="[object Error]",I="[object Function]",P="[object GeneratorFunction]",q="[object Map]",K="[object Number]",Y="[object Null]",z="[object Object]",W="[object Promise]",B="[object Proxy]",j="[object RegExp]",k="[object Set]",_="[object String]",N="[object Symbol]",se="[object Undefined]",le="[object WeakMap]",U="[object ArrayBuffer]",y="[object DataView]",u="[object Float32Array]",h="[object Float64Array]",v="[object Int8Array]",E="[object Int16Array]",S="[object Int32Array]",M="[object Uint8Array]",x="[object Uint8ClampedArray]",p="[object Uint16Array]",b="[object Uint32Array]",R=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,C={};C[u]=C[h]=C[v]=C[E]=C[S]=C[M]=C[x]=C[p]=C[b]=!0,C[f]=C[g]=C[U]=C[m]=C[y]=C[w]=C[O]=C[I]=C[q]=C[K]=C[z]=C[j]=C[k]=C[_]=C[le]=!1;var ee=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,L=typeof self=="object"&&self&&self.Object===Object&&self,V=ee||L||Function("return this")(),G=e&&!e.nodeType&&e,D=G&&!0&&r&&!r.nodeType&&r,H=D&&D.exports===G,ne=H&&ee.process,ce=function(){try{return ne&&ne.binding&&ne.binding("util")}catch{}}(),fe=ce&&ce.isTypedArray;function ye(J,te){for(var pe=-1,Le=J==null?0:J.length,jt=0,pt=[];++pe-1}function Ur(J,te){var pe=this.__data__,Le=Vs(pe,J);return Le<0?(++this.size,pe.push([J,te])):pe[Le][1]=te,this}vt.prototype.clear=Rr,vt.prototype.delete=Nr,vt.prototype.get=Br,vt.prototype.has=$r,vt.prototype.set=Ur;function er(J){var te=-1,pe=J==null?0:J.length;for(this.clear();++tefr))return!1;var kt=pt.get(J);if(kt&&pt.get(te))return kt==te;var sr=-1,ti=!0,hr=pe&a?new ei:void 0;for(pt.set(J,te),pt.set(te,J);++sr-1&&J%1==0&&J-1&&J%1==0&&J<=c}function iu(J){var te=typeof J;return J!=null&&(te=="object"||te=="function")}function Ws(J){return J!=null&&typeof J=="object"}var nu=fe?Ce(fe):Kc;function lh(J){return fh(J)?kc(J):Vc(J)}function zt(){return[]}function Ft(){return!1}r.exports=hh})(Cf,Cf.exports);var YO=Cf.exports;const QO=Fd(YO),w2="wc",_2=2,b0="core",Vn=`${w2}@2:${b0}:`,XO={name:b0,logger:"error"},ZO={database:":memory:"},eT="crypto",hb="client_ed25519_seed",tT=Ae.ONE_DAY,rT="keychain",iT="0.3",nT="messages",sT="0.3",aT=Ae.SIX_HOURS,oT="publisher",D2="irn",cT="error",E2="wss://relay.walletconnect.org",uT="relayer",Jr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},fT="_subscription",Li={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},hT=.1,Rd="2.17.0",Kt={link_mode:"link_mode",relay:"relay"},lT="0.3",dT="WALLETCONNECT_CLIENT_ID",lb="WALLETCONNECT_LINK_MODE_APPS",On={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},pT="subscription",gT="0.3",bT=Ae.FIVE_SECONDS*1e3,vT="pairing",mT="0.3",ic={wc_pairingDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:0}}},la={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},un={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},yT="history",wT="0.3",_T="expirer",Fi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},DT="0.3",ET="verify-api",AT="https://verify.walletconnect.com",A2="https://verify.walletconnect.org",bc=A2,xT=`${bc}/v3`,ST=[AT,A2],MT="echo",IT="https://echo.walletconnect.com",Mn={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},fs={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},fn={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ca={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ua={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},nc={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},CT=.1,PT="event-client",OT=86400,TT="https://pulse.walletconnect.org/batch";function RT(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,B=new Uint8Array(W);Y!==z;){for(var j=P[Y],k=0,_=W-1;(j!==0||k>>0,B[_]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");K=k,Y++}for(var N=W-K;N!==W&&B[N]===0;)N++;for(var se=g.repeat(q);N>>0,W=new Uint8Array(z);P[q];){var B=t[P.charCodeAt(q)];if(B===255)return;for(var j=0,k=z-1;(B!==0||j>>0,W[k]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");Y=j,q++}if(P[q]!==" "){for(var _=z-Y;_!==z&&W[_]===0;)_++;for(var N=new Uint8Array(K+(z-_)),se=K;_!==z;)N[se++]=W[_++];return N}}}function I(P){var q=O(P);if(q)return q;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:O,decode:I}}var NT=RT,BT=NT;const x2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},$T=r=>new TextEncoder().encode(r),UT=r=>new TextDecoder().decode(r);class qT{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class LT{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return S2(this,e)}}class FT{constructor(e){this.decoders=e}or(e){return S2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const S2=(r,e)=>new FT({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class zT{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new qT(e,t,i),this.decoder=new LT(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const sh=({name:r,prefix:e,encode:t,decode:i})=>new zT(r,e,t,i),zc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=BT(t,e);return sh({prefix:r,name:e,encode:i,decode:a=>x2(n(a))})},jT=(r,e,t,i)=>{const n={};for(let m=0;m=8&&(f-=8,c[d++]=255&g>>f)}if(f>=t||255&g<<8-f)throw new SyntaxError("Unexpected end of data");return c},kT=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<t;)c-=t,a+=e[n&f>>c];if(c&&(a+=e[n&f<sh({prefix:e,name:r,encode(n){return kT(n,i,t)},decode(n){return jT(n,i,t,r)}}),HT=sh({prefix:"\0",name:"identity",encode:r=>UT(r),decode:r=>$T(r)});var KT=Object.freeze({__proto__:null,identity:HT});const VT=Tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var GT=Object.freeze({__proto__:null,base2:VT});const JT=Tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var WT=Object.freeze({__proto__:null,base8:JT});const YT=zc({prefix:"9",name:"base10",alphabet:"0123456789"});var QT=Object.freeze({__proto__:null,base10:YT});const XT=Tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ZT=Tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var eR=Object.freeze({__proto__:null,base16:XT,base16upper:ZT});const tR=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rR=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iR=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nR=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sR=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aR=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oR=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cR=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uR=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fR=Object.freeze({__proto__:null,base32:tR,base32upper:rR,base32pad:iR,base32padupper:nR,base32hex:sR,base32hexupper:aR,base32hexpad:oR,base32hexpadupper:cR,base32z:uR});const hR=zc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lR=zc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var dR=Object.freeze({__proto__:null,base36:hR,base36upper:lR});const pR=zc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gR=zc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var bR=Object.freeze({__proto__:null,base58btc:pR,base58flickr:gR});const vR=Tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mR=Tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yR=Tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wR=Tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _R=Object.freeze({__proto__:null,base64:vR,base64pad:mR,base64url:yR,base64urlpad:wR});const M2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),DR=M2.reduce((r,e,t)=>(r[t]=e,r),[]),ER=M2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function AR(r){return r.reduce((e,t)=>(e+=DR[t],e),"")}function xR(r){const e=[];for(const t of r){const i=ER[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const SR=sh({prefix:"🚀",name:"base256emoji",encode:AR,decode:xR});var MR=Object.freeze({__proto__:null,base256emoji:SR}),IR=I2,db=128,CR=127,PR=~CR,OR=Math.pow(2,31);function I2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=OR;)e[t++]=r&255|db,r/=128;for(;r&PR;)e[t++]=r&255|db,r>>>=7;return e[t]=r|0,I2.bytes=t-i+1,e}var TR=Nd,RR=128,pb=127;function Nd(r,i){var t=0,i=i||0,n=0,a=i,c,f=r.length;do{if(a>=f)throw Nd.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=n<28?(c&pb)<=RR);return Nd.bytes=a-i,t}var NR=Math.pow(2,7),BR=Math.pow(2,14),$R=Math.pow(2,21),UR=Math.pow(2,28),qR=Math.pow(2,35),LR=Math.pow(2,42),FR=Math.pow(2,49),zR=Math.pow(2,56),jR=Math.pow(2,63),kR=function(r){return r(C2.encode(r,e,t),e),bb=r=>C2.encodingLength(r),Bd=(r,e)=>{const t=e.byteLength,i=bb(r),n=i+bb(t),a=new Uint8Array(n+t);return gb(r,a,0),gb(t,a,i),a.set(e,n),new KR(r,t,e,a)};class KR{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const P2=({name:r,code:e,encode:t})=>new VR(r,e,t);class VR{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Bd(this.code,t):t.then(i=>Bd(this.code,i))}else throw Error("Unknown type, must be binary type")}}const O2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),GR=P2({name:"sha2-256",code:18,encode:O2("SHA-256")}),JR=P2({name:"sha2-512",code:19,encode:O2("SHA-512")});var WR=Object.freeze({__proto__:null,sha256:GR,sha512:JR});const T2=0,YR="identity",R2=x2,QR=r=>Bd(T2,R2(r)),XR={code:T2,name:YR,encode:R2,digest:QR};var ZR=Object.freeze({__proto__:null,identity:XR});new TextEncoder,new TextDecoder;const vb={...KT,...GT,...WT,...QT,...eR,...fR,...dR,...bR,..._R,...MR};({...WR,...ZR});function eN(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function N2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const mb=N2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Xl=N2("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);const e=eN(r.length);for(let t=0;t{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:a}=De("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(a)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,u3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?f3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class nN{constructor(e,t,i){this.core=e,this.logger=t,this.name=eT,this.randomSessionIdentifier=Sd(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),a=X1(n);return s3(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=jM();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const a=await this.getClientSeed(),c=X1(a),f=this.randomSessionIdentifier;return await EA(f,n,tT,c)},this.generateSharedKey=(n,a,c)=>{this.isInitialized();const f=this.getPrivateKey(n),g=kM(f,a);return this.setSymKey(g,c)},this.setSymKey=async(n,a)=>{this.isInitialized();const c=a||uf(n);return await this.keychain.set(c,n),c},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,a,c)=>{this.isInitialized();const f=t2(c),g=ys(a);if(Bg(f))return KM(g,c==null?void 0:c.encoding);if(Ng(f)){const O=f.senderPublicKey,I=f.receiverPublicKey;n=await this.generateSharedKey(O,I)}const d=this.getSymKey(n),{type:m,senderPublicKey:w}=f;return HM({type:m,symKey:d,message:g,senderPublicKey:w,encoding:c==null?void 0:c.encoding})},this.decode=async(n,a,c)=>{this.isInitialized();const f=JM(a,c);if(Bg(f)){const g=GM(a,c==null?void 0:c.encoding);return ya(g)}if(Ng(f)){const g=f.receiverPublicKey,d=f.senderPublicKey;n=await this.generateSharedKey(g,d)}try{const g=this.getSymKey(n),d=VM({symKey:g,encoded:a,encoding:c==null?void 0:c.encoding});return ya(d)}catch(g){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(g)}},this.getPayloadType=(n,a=Ls)=>{const c=_c({encoded:n,encoding:a});return _a(c.type)},this.getPayloadSenderPublicKey=(n,a=Ls)=>{const c=_c({encoded:n,encoding:a});return c.senderPublicKey?oO(c.senderPublicKey,Yr):void 0},this.core=e,this.logger=Qr(t,this.name),this.keychain=i||new iN(this.core,this.logger)}get context(){return pi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(hb)}catch{e=Sd(),await this.keychain.set(hb,e)}return rN(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class sN extends XC{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=nT,this.version=sT,this.initialized=!1,this.storagePrefix=Vn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const a=ls(n);let c=this.messages.get(i);return typeof c>"u"&&(c={}),typeof c[a]<"u"||(c[a]=n,this.messages.set(i,c),await this.persist()),a},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const a=this.get(i),c=ls(n);return typeof a[c]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Qr(e,this.name),this.core=t}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,u3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?f3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class aN extends ZC{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Vi.EventEmitter,this.name=oT,this.queue=new Map,this.publishTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.failedPublishTimeout=Ae.toMiliseconds(Ae.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,a)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:a}});const f=(a==null?void 0:a.ttl)||aT,g=Md(a),d=(a==null?void 0:a.prompt)||!1,m=(a==null?void 0:a.tag)||0,w=(a==null?void 0:a.id)||pa().toString(),O={topic:i,message:n,opts:{ttl:f,relay:g,prompt:d,tag:m,id:w,attestation:a==null?void 0:a.attestation}},I=`Failed to publish payload, please try again. id:${w} tag:${m}`,P=Date.now();let q,K=1;try{for(;q===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(I);this.logger.trace({id:w,attempts:K},`publisher.publish - attempt ${K}`),q=await await io(this.rpcPublish(i,n,f,g,d,m,w,a==null?void 0:a.attestation).catch(Y=>this.logger.warn(Y)),this.publishTimeout,I),K++,q||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(Jr.publish,O),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:a}})}catch(Y){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Y),(c=a==null?void 0:a.internal)!=null&&c.throwOnFailedPublish)throw Y;this.queue.set(w,O)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=Qr(t,this.name),this.registerEventListeners()}get context(){return pi(this.logger)}rpcPublish(e,t,i,n,a,c,f,g){var d,m,w,O;const I={method:uc(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:a,tag:c,attestation:g},id:f};return fi((d=I.params)==null?void 0:d.prompt)&&((m=I.params)==null||delete m.prompt),fi((w=I.params)==null?void 0:w.tag)&&((O=I.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I}),this.relayer.request(I)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(Mo.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Jr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Jr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class oN{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(a=>a!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var cN=Object.defineProperty,uN=Object.defineProperties,fN=Object.getOwnPropertyDescriptors,yb=Object.getOwnPropertySymbols,hN=Object.prototype.hasOwnProperty,lN=Object.prototype.propertyIsEnumerable,wb=(r,e,t)=>e in r?cN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sc=(r,e)=>{for(var t in e||(e={}))hN.call(e,t)&&wb(r,t,e[t]);if(yb)for(var t of yb(e))lN.call(e,t)&&wb(r,t,e[t]);return r},Zl=(r,e)=>uN(r,fN(e));class dN extends rP{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new oN,this.events=new Vi.EventEmitter,this.name=pT,this.version=gT,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Vn,this.subscribeTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const a=Md(n),c={topic:i,relay:a,transportType:n==null?void 0:n.transportType};this.pending.set(i,c);const f=await this.rpcSubscribe(i,a,n==null?void 0:n.transportType);return typeof f=="string"&&(this.onSubscribe(f,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((a,c)=>{const f=new Ae.Watch;f.start(n);const g=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(g),f.stop(n),a(!0)),f.elapsed(n)>=bT&&(clearInterval(g),f.stop(n),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qr(t,this.name),this.clientId=""}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=Md(i);await this.rpcUnsubscribe(e,t,n);const a=Lt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i=Kt.relay){i===Kt.relay&&await this.restartToComplete();const n={method:uc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{const a=ls(e+this.clientId);return i===Kt.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(c=>this.logger.warn(c))},Ae.toMiliseconds(Ae.ONE_SECOND)),a):await await io(this.relayer.request(n).catch(c=>this.logger.warn(c)),this.subscribeTimeout)?a:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Jr.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:uc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await io(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:uc(t.protocol).batchFetchMessages,params:{topics:e.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await io(this.relayer.request(i).catch(a=>this.logger.warn(a)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jr.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:uc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,Zl(sc({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,sc({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,sc({},t)),this.topicMap.set(t.topic,e),this.events.emit(On.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(On.deleted,Zl(sc({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(On.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Kn(t)&&this.onBatchSubscribe(t.map((i,n)=>Zl(sc({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Mo.pulse,async()=>{await this.checkPending()}),this.events.on(On.created,async e=>{const t=On.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(On.deleted,async e=>{const t=On.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var pN=Object.defineProperty,_b=Object.getOwnPropertySymbols,gN=Object.prototype.hasOwnProperty,bN=Object.prototype.propertyIsEnumerable,Db=(r,e,t)=>e in r?pN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vN=(r,e)=>{for(var t in e||(e={}))gN.call(e,t)&&Db(r,t,e[t]);if(_b)for(var t of _b(e))bN.call(e,t)&&Db(r,t,e[t]);return r};class mN extends eP{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Vi.EventEmitter,this.name=uT,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ae.toMiliseconds(Ae.THIRTY_SECONDS+Ae.ONE_SECOND),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const a=t.id||pa().toString();await this.toEstablishConnection();try{const c=this.provider.request(t);this.requestsInFlight.set(a,{promise:c,request:t}),this.logger.trace({id:a,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const f=await new Promise(async(g,d)=>{const m=()=>{d(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(Li.disconnect,m);const w=await c;this.provider.off(Li.disconnect,m),g(w)});return this.logger.trace({id:a,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - published"),f}catch(c){throw this.logger.debug(`Failed to Publish Request: ${a}`),c}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(wf())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Jr.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Jr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Li.payload,this.onPayloadHandler),this.provider.on(Li.connect,this.onConnectHandler),this.provider.on(Li.disconnect,this.onDisconnectHandler),this.provider.on(Li.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qr(e.logger,this.name):qc(eh({level:e.logger||cT})),this.messages=new sN(this.logger,e.core),this.subscriber=new dN(this,this.logger),this.publisher=new aN(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||E2,this.projectId=e.projectId,this.bundleId=TA(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return pi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Kt.relay})}async subscribe(e,t){var i;this.isInitialized(),(t==null?void 0:t.transportType)==="relay"&&await this.toEstablishConnection();let n=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",a;const c=f=>{f.topic===e&&(this.subscriber.off(On.created,c),a())};return await Promise.all([new Promise(f=>{a=f,this.subscriber.on(On.created,c)}),new Promise(async f=>{n=await this.subscriber.subscribe(e,t)||n,f()})]),n}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await io(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const n=()=>{this.provider.off(Li.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Li.disconnect,n),await io(this.provider.connect(),Ae.toMiliseconds(Ae.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{i(a)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(a=>{this.logger.error(a),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Vg())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=br(Ae.FIVE_MINUTES),a={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,a)}this.events.emit(Jr.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,n,a;if(wf())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((a=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new mn(new WO($A({sdkVersion:Rd,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g0(e)){if(!e.method.endsWith(fT))return;const t=e.params,{topic:i,message:n,publishedAt:a,attestation:c}=t.data,f={topic:i,message:n,publishedAt:a,transportType:Kt.relay,attestation:c};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(vN({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else nh(e)&&this.events.emit(Jr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Jr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=rh(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Li.payload,this.onPayloadHandler),this.provider.off(Li.connect,this.onConnectHandler),this.provider.off(Li.disconnect,this.onDisconnectHandler),this.provider.off(Li.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Vg();zI(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Jr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ae.toMiliseconds(hT))))}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var yN=Object.defineProperty,Eb=Object.getOwnPropertySymbols,wN=Object.prototype.hasOwnProperty,_N=Object.prototype.propertyIsEnumerable,Ab=(r,e,t)=>e in r?yN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xb=(r,e)=>{for(var t in e||(e={}))wN.call(e,t)&&Ab(r,t,e[t]);if(Eb)for(var t of Eb(e))_N.call(e,t)&&Ab(r,t,e[t]);return r};class Ia extends tP{constructor(e,t,i,n=Vn,a=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=lT,this.cached=[],this.initialized=!1,this.storagePrefix=Vn,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!fi(c)?this.map.set(this.getKey(c),c):mI(c)?this.map.set(c.id,c):yI(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,f)=>{this.isInitialized(),this.map.has(c)?await this.update(c,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:f}),this.map.set(c,f),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(f=>Object.keys(c).every(g=>QO(f[g],c[g]))):this.values),this.update=async(c,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:f});const g=xb(xb({},this.getData(c)),f);this.map.set(c,g),await this.persist()},this.delete=async(c,f)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:f}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=Qr(t,this.name),this.storagePrefix=n,this.getKey=a}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=De("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class DN{constructor(e,t){this.core=e,this.logger=t,this.name=vT,this.version=mT,this.events=new zd,this.initialized=!1,this.storagePrefix=Vn,this.ignoredPayloadTypes=[bs],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Sd(),a=await this.core.crypto.setSymKey(n),c=br(Ae.FIVE_MINUTES),f={protocol:D2},g={topic:a,expiry:c,relay:f,active:!1,methods:i==null?void 0:i.methods},d=Fg({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:n,relay:f,expiryTimestamp:c,methods:i==null?void 0:i.methods});return this.events.emit(la.create,g),this.core.expirer.set(a,c),await this.pairings.set(a,g),await this.core.relayer.subscribe(a,{transportType:i==null?void 0:i.transportType}),{topic:a,uri:d}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[Mn.pairing_started]}});this.isValidPair(i,n);const{topic:a,symKey:c,relay:f,expiryTimestamp:g,methods:d}=Lg(i.uri);n.props.properties.topic=a,n.addTrace(Mn.pairing_uri_validation_success),n.addTrace(Mn.pairing_uri_not_expired);let m;if(this.pairings.keys.includes(a)){if(m=this.pairings.get(a),n.addTrace(Mn.existing_pairing),m.active)throw n.setError(fs.active_pairing_already_exists),new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);n.addTrace(Mn.pairing_not_expired)}const w=g||br(Ae.FIVE_MINUTES),O={topic:a,relay:f,expiry:w,active:!1,methods:d};this.core.expirer.set(a,w),await this.pairings.set(a,O),n.addTrace(Mn.store_new_pairing),i.activatePairing&&await this.activate({topic:a}),this.events.emit(la.create,O),n.addTrace(Mn.emit_inactive_pairing),this.core.crypto.keychain.has(a)||await this.core.crypto.setSymKey(c,a),n.addTrace(Mn.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(fs.no_internet_connection)}try{await this.core.relayer.subscribe(a,{relay:f})}catch(I){throw n.setError(fs.subscribe_pairing_topic_failure),I}return n.addTrace(Mn.subscribe_pairing_topic_success),O},this.activate=async({topic:i})=>{this.isInitialized();const n=br(Ae.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const a=await this.sendRequest(n,"wc_pairingPing",{}),{done:c,resolve:f,reject:g}=fa();this.events.once(xt("pairing_ping",a),({error:d})=>{d?g(d):f()}),await c()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Lt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:a,expiry:c,methods:f}=i,g=this.core.crypto.keychain.get(n);return Fg({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:g,relay:a,expiryTimestamp:c,methods:f})},this.sendRequest=async(i,n,a)=>{const c=Fs(n,a),f=await this.core.crypto.encode(i,c),g=ic[n].req;return this.core.history.set(i,c),this.core.relayer.publish(i,f,g),c.id},this.sendResult=async(i,n,a)=>{const c=rh(i,a),f=await this.core.crypto.encode(n,c),g=await this.core.history.get(n,i),d=ic[g.request.method].res;await this.core.relayer.publish(n,f,d),await this.core.history.resolve(c)},this.sendError=async(i,n,a)=>{const c=ih(i,a),f=await this.core.crypto.encode(n,c),g=await this.core.history.get(n,i),d=ic[g.request.method]?ic[g.request.method].res:ic.unregistered_method.res;await this.core.relayer.publish(n,f,d),await this.core.history.resolve(c)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Lt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Rs(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:a}=i;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(n,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,a);default:return this.onUnknownRpcMethodRequest(n,a)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:a}=i,c=(await this.core.history.get(n,a.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(n,a);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(i,n)=>{const{id:a}=n;try{this.isValidPing({topic:i}),await this.sendResult(a,i,!0),this.events.emit(la.ping,{id:a,topic:i})}catch(c){await this.sendError(a,i,c),this.logger.error(c)}},this.onPairingPingResponse=(i,n)=>{const{id:a}=n;setTimeout(()=>{Pn(n)?this.events.emit(xt("pairing_ping",a),{}):ji(n)&&this.events.emit(xt("pairing_ping",a),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(la.delete,{id:a,topic:i})}catch(c){await this.sendError(a,i,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:a,method:c}=n;try{if(this.registeredMethods.includes(c))return;const f=Lt("WC_METHOD_UNSUPPORTED",c);await this.sendError(a,i,f),this.logger.error(f)}catch(f){await this.sendError(a,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Lt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var a;if(!ci(i)){const{message:f}=De("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(fs.malformed_pairing_uri),new Error(f)}if(!vI(i.uri)){const{message:f}=De("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(fs.malformed_pairing_uri),new Error(f)}const c=Lg(i==null?void 0:i.uri);if(!((a=c==null?void 0:c.relay)!=null&&a.protocol)){const{message:f}=De("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(fs.malformed_pairing_uri),new Error(f)}if(!(c!=null&&c.symKey)){const{message:f}=De("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(fs.malformed_pairing_uri),new Error(f)}if(c!=null&&c.expiryTimestamp&&Ae.toMiliseconds(c==null?void 0:c.expiryTimestamp){if(!ci(i)){const{message:a}=De("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!ci(i)){const{message:a}=De("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!ur(i,!1)){const{message:n}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Rs(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=De("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=Qr(t,this.name),this.pairings=new Ia(this.core,this.logger,this.name,this.storagePrefix)}get context(){return pi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Jr.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===Kt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const a=await this.core.crypto.decode(t,i);try{g0(a)?(this.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a})):nh(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a}),this.core.history.delete(t,a.id))}catch(c){this.logger.error(c)}})}registerExpirerEvents(){this.core.expirer.on(Fi.expired,async e=>{const{topic:t}=l3(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(la.expire,{topic:t}))})}}class EN extends QC{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Vi.EventEmitter,this.name=yT,this.version=wT,this.cached=[],this.initialized=!1,this.storagePrefix=Vn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:a}),this.records.has(n.id))return;const c={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:a,expiry:br(Ae.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(un.created,c)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ji(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(un.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(a=>{if(a.topic===i){if(typeof n<"u"&&a.id!==n)return;this.records.delete(a.id),this.events.emit(un.deleted,a)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Fs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(un.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(un.created,e=>{const t=un.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(un.updated,e=>{const t=un.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(un.deleted,e=>{const t=un.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(Mo.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Ae.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(un.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}class AN extends iP{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Vi.EventEmitter,this.name=_T,this.version=DT,this.cached=[],this.initialized=!1,this.storagePrefix=Vn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const a=this.formatTarget(i),c={target:a,expiry:n};this.expirations.set(a,c),this.checkExpiry(a,c),this.events.emit(Fi.created,{target:a,expiration:c})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),a=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Fi.deleted,{target:n,expiration:a})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Qr(t,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return UA(e);if(typeof e=="number")return qA(e);const{message:t}=De("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Fi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Ae.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Fi.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Mo.pulse,()=>this.checkExpirations()),this.events.on(Fi.created,e=>{const t=Fi.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Fi.expired,e=>{const t=Fi.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Fi.deleted,e=>{const t=Fi.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.getLocalStorage=Qt.getLocalStorageOrThrow=Qt.getCrypto=Qt.getCryptoOrThrow=Qt.getLocation=Qt.getLocationOrThrow=Qt.getNavigator=Qt.getNavigatorOrThrow=B2=Qt.getDocument=Qt.getDocumentOrThrow=Qt.getFromWindowOrThrow=Qt.getFromWindow=void 0;function Ca(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Qt.getFromWindow=Ca;function Io(r){const e=Ca(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Qt.getFromWindowOrThrow=Io;function xN(){return Io("document")}Qt.getDocumentOrThrow=xN;function SN(){return Ca("document")}var B2=Qt.getDocument=SN;function MN(){return Io("navigator")}Qt.getNavigatorOrThrow=MN;function IN(){return Ca("navigator")}Qt.getNavigator=IN;function CN(){return Io("location")}Qt.getLocationOrThrow=CN;function PN(){return Ca("location")}Qt.getLocation=PN;function ON(){return Io("crypto")}Qt.getCryptoOrThrow=ON;function TN(){return Ca("crypto")}Qt.getCrypto=TN;function RN(){return Io("localStorage")}Qt.getLocalStorageOrThrow=RN;function NN(){return Ca("localStorage")}Qt.getLocalStorage=NN;class BN extends nP{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=ET,this.verifyUrlV3=xT,this.storagePrefix=Vn,this.version=_2,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ae.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt){if(!Tc()||this.isDevEnv)return;const a=window.location.origin,{id:c,decryptedId:f}=n,g=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${a}&id=${c}&decryptedId=${f}`;try{const d=B2(),m=this.startAbortTimer(Ae.ONE_SECOND*5),w=await new Promise((O,I)=>{const P=()=>{window.removeEventListener("message",K),d.body.removeChild(q),I("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const q=d.createElement("iframe");q.src=g,q.style.display="none",q.addEventListener("error",P,{signal:this.abortController.signal});const K=Y=>{if(Y.data&&typeof Y.data=="string")try{const z=JSON.parse(Y.data);if(z.type==="verify_attestation"){if(yd(z.attestation).payload.id!==c)return;clearInterval(m),d.body.removeChild(q),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",K),O(z.attestation===null?"":z.attestation)}}catch(z){this.logger.warn(z)}};d.body.appendChild(q),window.addEventListener("message",K,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(d){this.logger.warn(d)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:a,hash:c,encryptedId:f}=n;if(a===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(a){if(yd(a).payload.id!==f)return;const d=await this.isValidJwtAttestation(a);if(d){if(!d.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return d}}if(!c)return;const g=this.getVerifyUrl(n==null?void 0:n.verifyUrl);return this.fetchAttestation(c,g)},this.fetchAttestation=async(n,a)=>{this.logger.debug(`resolving attestation: ${n} from url: ${a}`);const c=this.startAbortTimer(Ae.ONE_SECOND*5),f=await fetch(`${a}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(c),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let a=n||bc;return ST.includes(a)||(this.logger.info(`verify url: ${a}, not included in trusted list, assigning default: ${bc}`),a=bc),a},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(Ae.FIVE_SECONDS),a=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await a.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const a=await this.getPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const c=await this.fetchAndPersistPublicKey();try{if(c)return this.validateAttestation(n,c)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async a=>{const c=await this.fetchPublicKey();c&&(await this.persistPublicKey(c),a(c))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,a)=>{const c=XM(n,a.publicKey),f={hasExpired:Ae.toMiliseconds(c.exp)this.abortController.abort(),Ae.toMiliseconds(e))}}class $N extends sP{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=MT,this.registerDeviceToken=async i=>{const{clientId:n,token:a,notificationType:c,enableEncrypted:f=!1}=i,g=`${IT}/${this.projectId}/clients`;await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:c,token:a,always_raw:f})})},this.logger=Qr(t,this.context)}}var UN=Object.defineProperty,Sb=Object.getOwnPropertySymbols,qN=Object.prototype.hasOwnProperty,LN=Object.prototype.propertyIsEnumerable,Mb=(r,e,t)=>e in r?UN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ac=(r,e)=>{for(var t in e||(e={}))qN.call(e,t)&&Mb(r,t,e[t]);if(Sb)for(var t of Sb(e))LN.call(e,t)&&Mb(r,t,e[t]);return r};class FN extends aP{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=PT,this.storagePrefix=Vn,this.storageVersion=CT,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i0())try{const n={eventId:ng(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:c3(this.core.relayer.protocol,this.core.relayer.version,Rd)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:a="ERROR",type:c="",properties:{topic:f,trace:g}}=n,d=ng(),m=this.core.projectId||"",w=Date.now(),O=ac({eventId:d,timestamp:w,props:{event:a,type:c,properties:{topic:f,trace:g}},bundleId:m,domain:this.getAppDomain()},this.setMethods(d));return this.telemetryEnabled&&(this.events.set(d,O),this.shouldPersist=!0),O},this.getEvent=n=>{const{eventId:a,topic:c}=n;if(a)return this.events.get(a);const f=Array.from(this.events.values()).find(g=>g.props.properties.topic===c);if(f)return ac(ac({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:a}=n;this.events.delete(a),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Mo.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{Ae.fromMiliseconds(Date.now())-Ae.fromMiliseconds(n.timestamp)>OT&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:a=>this.addTrace(n,a),setError:a=>this.setError(n,a)}),this.addTrace=(n,a)=>{const c=this.events.get(n);c&&(c.props.properties.trace.push(a),this.events.set(n,c),this.shouldPersist=!0)},this.setError=(n,a)=>{const c=this.events.get(n);c&&(c.props.type=a,c.timestamp=Date.now(),this.events.set(n,c),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(a=>{this.events.set(a.eventId,ac(ac({},a),this.setMethods(a.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[a,c]of this.events)c.props.type&&n.push(c);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const a of n)this.events.delete(a.eventId),this.shouldPersist=!0}catch(a){this.logger.warn(a)}},this.sendEvent=async n=>{const a=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${TT}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Rd}${a}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>o3().url,this.logger=Qr(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var zN=Object.defineProperty,Ib=Object.getOwnPropertySymbols,jN=Object.prototype.hasOwnProperty,kN=Object.prototype.propertyIsEnumerable,Cb=(r,e,t)=>e in r?zN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pb=(r,e)=>{for(var t in e||(e={}))jN.call(e,t)&&Cb(r,t,e[t]);if(Ib)for(var t of Ib(e))kN.call(e,t)&&Cb(r,t,e[t]);return r};class v0 extends YC{constructor(e){var t;super(e),this.protocol=w2,this.version=_2,this.name=b0,this.events=new Vi.EventEmitter,this.initialized=!1,this.on=(c,f)=>this.events.on(c,f),this.once=(c,f)=>this.events.once(c,f),this.off=(c,f)=>this.events.off(c,f),this.removeListener=(c,f)=>this.events.removeListener(c,f),this.dispatchEnvelope=({topic:c,message:f,sessionExists:g})=>{if(!c||!f)return;const d={topic:c,message:f,publishedAt:Date.now(),transportType:Kt.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:g})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||E2,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=eh({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:XO.logger}),{logger:n,chunkLoggerController:a}=WC({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=a,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,f;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Qr(n,this.name),this.heartbeat=new KI,this.crypto=new nN(this,this.logger,e==null?void 0:e.keychain),this.history=new EN(this,this.logger),this.expirer=new AN(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new _C(Pb(Pb({},ZO),e==null?void 0:e.storageOptions)),this.relayer=new mN({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new DN(this,this.logger),this.verify=new BN(this,this.logger,this.storage),this.echoClient=new $N(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new FN(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const t=new v0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(dT,i),t}get context(){return pi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(lb,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(lb)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const HN=v0,$2="wc",U2=2,q2="client",m0=`${$2}@${U2}:${q2}:`,ed={name:q2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},Ob="WALLETCONNECT_DEEPLINK_CHOICE",KN="proposal",L2="Proposal expired",VN="session",Qa=Ae.SEVEN_DAYS,GN="engine",wr={wc_sessionPropose:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ae.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ae.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1119}}},td={min:Ae.FIVE_MINUTES,max:Ae.SEVEN_DAYS},Sn={idle:"IDLE",active:"ACTIVE"},JN="request",WN=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],YN="wc",QN="auth",XN="authKeys",ZN="pairingTopics",eB="requests",ah=`${YN}@${1.5}:${QN}:`,lf=`${ah}:PUB_KEY`;var tB=Object.defineProperty,rB=Object.defineProperties,iB=Object.getOwnPropertyDescriptors,Tb=Object.getOwnPropertySymbols,nB=Object.prototype.hasOwnProperty,sB=Object.prototype.propertyIsEnumerable,Rb=(r,e,t)=>e in r?tB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rr=(r,e)=>{for(var t in e||(e={}))nB.call(e,t)&&Rb(r,t,e[t]);if(Tb)for(var t of Tb(e))sB.call(e,t)&&Rb(r,t,e[t]);return r},hn=(r,e)=>rB(r,iB(e));class aB extends cP{constructor(e){super(e),this.name=GN,this.events=new zd,this.initialized=!1,this.requestQueue={state:Sn.idle,queue:[]},this.sessionRequestQueue={state:Sn.idle,queue:[]},this.requestQueueDelay=Ae.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(wr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=hn(rr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:f,relays:g}=i;let d=n,m,w=!1;try{d&&(w=this.client.core.pairing.pairings.get(d).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),B}if(!d||!w){const{topic:B,uri:j}=await this.client.core.pairing.create();d=B,m=j}if(!d){const{message:B}=De("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(B)}const O=await this.client.core.crypto.generateKeyPair(),I=wr.wc_sessionPropose.req.ttl||Ae.FIVE_MINUTES,P=br(I),q=rr({requiredNamespaces:a,optionalNamespaces:c,relays:g??[{protocol:D2}],proposer:{publicKey:O,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:d},f&&{sessionProperties:f}),{reject:K,resolve:Y,done:z}=fa(I,L2);this.events.once(xt("session_connect"),async({error:B,session:j})=>{if(B)K(B);else if(j){j.self.publicKey=O;const k=hn(rr({},j),{pairingTopic:q.pairingTopic,requiredNamespaces:q.requiredNamespaces,optionalNamespaces:q.optionalNamespaces,transportType:Kt.relay});await this.client.session.set(j.topic,k),await this.setExpiry(j.topic,j.expiry),d&&await this.client.core.pairing.updateMetadata({topic:d,metadata:j.peer.metadata}),this.cleanupDuplicatePairings(k),Y(k)}});const W=await this.sendRequest({topic:d,method:"wc_sessionPropose",params:q,throwOnFailedPublish:!0});return await this.setProposal(W,rr({id:W},q)),{uri:m,approval:z}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,a;const c=this.client.core.eventClient.createEvent({properties:{topic:(i=t==null?void 0:t.id)==null?void 0:i.toString(),trace:[fn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(N){throw c.setError(ca.no_internet_connection),N}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(N){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),c.setError(ca.proposal_not_found),N}try{await this.isValidApprove(t)}catch(N){throw this.client.logger.error("approve() -> isValidApprove() failed"),c.setError(ca.session_approve_namespace_validation_failure),N}const{id:f,relayProtocol:g,namespaces:d,sessionProperties:m,sessionConfig:w}=t,O=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:c.eventId});const{pairingTopic:I,proposer:P,requiredNamespaces:q,optionalNamespaces:K}=O;let Y=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:I});Y||(Y=(a=this.client.core.eventClient)==null?void 0:a.createEvent({type:fn.session_approve_started,properties:{topic:I,trace:[fn.session_approve_started,fn.session_namespaces_validation_success]}}));const z=await this.client.core.crypto.generateKeyPair(),W=P.publicKey,B=await this.client.core.crypto.generateSharedKey(z,W),j=rr(rr({relay:{protocol:g??"irn"},namespaces:d,controller:{publicKey:z,metadata:this.client.metadata},expiry:br(Qa)},m&&{sessionProperties:m}),w&&{sessionConfig:w}),k=Kt.relay;Y.addTrace(fn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(B,{transportType:k})}catch(N){throw Y.setError(ca.subscribe_session_topic_failure),N}Y.addTrace(fn.subscribe_session_topic_success);const _=hn(rr({},j),{topic:B,requiredNamespaces:q,optionalNamespaces:K,pairingTopic:I,acknowledged:!1,self:j.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:z,transportType:Kt.relay});await this.client.session.set(B,_),Y.addTrace(fn.store_session);try{Y.addTrace(fn.publishing_session_settle),await this.sendRequest({topic:B,method:"wc_sessionSettle",params:j,throwOnFailedPublish:!0}).catch(N=>{throw Y==null||Y.setError(ca.session_settle_publish_failure),N}),Y.addTrace(fn.session_settle_publish_success),Y.addTrace(fn.publishing_session_approve),await this.sendResult({id:f,topic:I,result:{relay:{protocol:g??"irn"},responderPublicKey:z},throwOnFailedPublish:!0}).catch(N=>{throw Y==null||Y.setError(ca.session_approve_publish_failure),N}),Y.addTrace(fn.session_approve_publish_success)}catch(N){throw this.client.logger.error(N),this.client.session.delete(B,Lt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(B),N}return this.client.core.eventClient.deleteEvent({eventId:Y.eventId}),await this.client.core.pairing.updateMetadata({topic:I,metadata:P.metadata}),await this.client.proposal.delete(f,Lt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:I}),await this.setExpiry(B,br(Qa)),{topic:B,acknowledged:()=>Promise.resolve(this.client.session.get(B))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:i,reason:n}=t;let a;try{a=this.client.proposal.get(i).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),c}a&&(await this.sendError({id:i,topic:a,error:n,rpcOpts:wr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Lt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:a,resolve:c,reject:f}=fa(),g=Bs(),d=pa().toString(),m=this.client.session.get(i).namespaces;return this.events.once(xt("session_update",g),({error:w})=>{w?f(w):c()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:g,relayRpcId:d}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:m}),f(w)}),{acknowledged:a}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(g){throw this.client.logger.error("extend() -> isValidExtend() failed"),g}const{topic:i}=t,n=Bs(),{done:a,resolve:c,reject:f}=fa();return this.events.once(xt("session_extend",n),({error:g})=>{g?f(g):c()}),await this.setExpiry(i,br(Qa)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(g=>{f(g)}),{acknowledged:a}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:i,request:n,topic:a,expiry:c=wr.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(a);(f==null?void 0:f.transportType)===Kt.relay&&await this.confirmOnlineStateOrThrow();const g=Bs(),d=pa().toString(),{done:m,resolve:w,reject:O}=fa(c,"Request expired. Please try again.");this.events.once(xt("session_request",g),({error:P,result:q})=>{P?O(P):w(q)});const I=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return I?(await this.sendRequest({clientRpcId:g,relayRpcId:d,topic:a,method:"wc_sessionRequest",params:{request:hn(rr({},n),{expiryTimestamp:br(c)}),chainId:i},expiry:c,throwOnFailedPublish:!0,appLink:I}).catch(P=>O(P)),this.client.events.emit("session_request_sent",{topic:a,request:n,chainId:i,id:g}),await m()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:g,relayRpcId:d,topic:a,method:"wc_sessionRequest",params:{request:hn(rr({},n),{expiryTimestamp:br(c)}),chainId:i},expiry:c,throwOnFailedPublish:!0}).catch(q=>O(q)),this.client.events.emit("session_request_sent",{topic:a,request:n,chainId:i,id:g}),P()}),new Promise(async P=>{var q;if(!((q=f.sessionConfig)!=null&&q.disableDeepLink)){const K=await zA(this.client.core.storage,Ob);await LA({id:g,topic:a,wcDeepLink:K})}P()}),m()]).then(P=>P[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:a}=n,c=this.client.session.get(i);c.transportType===Kt.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);Pn(n)?await this.sendResult({id:a,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):ji(n)&&await this.sendError({id:a,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Bs(),a=pa().toString(),{done:c,resolve:f,reject:g}=fa();this.events.once(xt("session_ping",n),({error:d})=>{d?g(d):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:a}),c()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:a}=t,c=pa().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:a},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Lt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=De("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>gI(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const a=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),c=a?Kt.link_mode:Kt.relay;c===Kt.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:g="",uri:d,domain:m,nonce:w,type:O,exp:I,nbf:P,methods:q=[],expiry:K}=t,Y=[...t.resources||[]],{topic:z,uri:W}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:c});this.client.logger.info({message:"Generated new pairing",pairing:{topic:z,uri:W}});const B=await this.client.core.crypto.generateKeyPair(),j=uf(B);if(await Promise.all([this.client.auth.authKeys.set(lf,{responseTopic:j,publicKey:B}),this.client.auth.pairingTopics.set(j,{topic:j,pairingTopic:z})]),await this.client.core.relayer.subscribe(j,{transportType:c}),this.client.logger.info(`sending request to new pairing topic: ${z}`),q.length>0){const{namespace:M}=hc(f[0]);let x=$M(M,"request",q);cf(Y)&&(x=qM(x,Y.pop())),Y.push(x)}const k=K&&K>wr.wc_sessionAuthenticate.req.ttl?K:wr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:O??"caip122",chains:f,statement:g,aud:d,domain:m,version:"1",nonce:w,iat:new Date().toISOString(),exp:I,nbf:P,resources:Y},requester:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:br(k)},N={eip155:{chains:f,methods:[...new Set(["personal_sign",...q])],events:["chainChanged","accountsChanged"]}},se={requiredNamespaces:{},optionalNamespaces:N,relays:[{protocol:"irn"}],pairingTopic:z,proposer:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:br(wr.wc_sessionPropose.req.ttl)},{done:le,resolve:U,reject:y}=fa(k,"Request expired"),u=async({error:M,session:x})=>{if(this.events.off(xt("session_request",v),h),M)y(M);else if(x){x.self.publicKey=B,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),z&&await this.client.core.pairing.updateMetadata({topic:z,metadata:x.peer.metadata});const p=this.client.session.get(x.topic);await this.deleteProposal(E),U({session:p})}},h=async M=>{var x,p,b;if(await this.deletePendingAuthRequest(v,{message:"fulfilled",code:0}),M.error){const V=Lt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return M.error.code===V.code?void 0:(this.events.off(xt("session_connect"),u),y(M.error.message))}await this.deleteProposal(E),this.events.off(xt("session_connect"),u);const{cacaos:R,responder:Z}=M.result,ae=[],C=[];for(const V of R){await Pg({cacao:V,projectId:this.client.core.projectId})||(this.client.logger.error(V,"Signature verification failed"),y(Lt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:G}=V,D=cf(G.resources),H=[Cg(G.iss)],ne=xf(G.iss);if(D){const ce=Og(D),fe=Tg(D);ae.push(...ce),H.push(...fe)}for(const ce of H)C.push(`${ce}:${ne}`)}const ee=await this.client.core.crypto.generateSharedKey(B,Z.publicKey);let L;ae.length>0&&(L={topic:ee,acknowledged:!0,self:{publicKey:B,metadata:this.client.metadata},peer:Z,controller:Z.publicKey,expiry:br(Qa),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:z,namespaces:zg([...new Set(ae)],[...new Set(C)]),transportType:c},await this.client.core.relayer.subscribe(ee,{transportType:c}),await this.client.session.set(ee,L),z&&await this.client.core.pairing.updateMetadata({topic:z,metadata:Z.metadata}),L=this.client.session.get(ee)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(p=Z.metadata.redirect)!=null&&p.linkMode&&(b=Z.metadata.redirect)!=null&&b.universal&&i&&(this.client.core.addLinkModeSupportedApp(Z.metadata.redirect.universal),this.client.session.update(ee,{transportType:Kt.link_mode})),U({auths:R,session:L})},v=Bs(),E=Bs();this.events.once(xt("session_connect"),u),this.events.once(xt("session_request",v),h);let S;try{if(a){const M=Fs("wc_sessionAuthenticate",_,v);this.client.core.history.set(z,M);const x=await this.client.core.crypto.encode("",M,{type:$c,encoding:tc});S=Yu(i,z,x)}else await Promise.all([this.sendRequest({topic:z,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:v}),this.sendRequest({topic:z,method:"wc_sessionPropose",params:se,expiry:wr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:E})])}catch(M){throw this.events.off(xt("session_connect"),u),this.events.off(xt("session_request",v),h),M}return await this.setProposal(E,rr({id:E},se)),await this.setAuthRequest(v,{request:hn(rr({},_),{verifyContext:{}}),pairingTopic:z,transportType:c}),{uri:S??W,response:le}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,a=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[ua.authenticated_session_approve_started]}});try{this.isInitialized()}catch(K){throw a.setError(nc.no_internet_connection),K}const c=this.getPendingAuthRequest(i);if(!c)throw a.setError(nc.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=c.transportType||Kt.relay;f===Kt.relay&&await this.confirmOnlineStateOrThrow();const g=c.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),m=uf(g),w={type:bs,receiverPublicKey:g,senderPublicKey:d},O=[],I=[];for(const K of n){if(!await Pg({cacao:K,projectId:this.client.core.projectId})){a.setError(nc.invalid_cacao);const j=Lt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:m,error:j,encodeOpts:w}),new Error(j.message)}a.addTrace(ua.cacaos_verified);const{p:Y}=K,z=cf(Y.resources),W=[Cg(Y.iss)],B=xf(Y.iss);if(z){const j=Og(z),k=Tg(z);O.push(...j),W.push(...k)}for(const j of W)I.push(`${j}:${B}`)}const P=await this.client.core.crypto.generateSharedKey(d,g);a.addTrace(ua.create_authenticated_session_topic);let q;if((O==null?void 0:O.length)>0){q={topic:P,acknowledged:!0,self:{publicKey:d,metadata:this.client.metadata},peer:{publicKey:g,metadata:c.requester.metadata},controller:g,expiry:br(Qa),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:c.pairingTopic,namespaces:zg([...new Set(O)],[...new Set(I)]),transportType:f},a.addTrace(ua.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:f})}catch(K){throw a.setError(nc.subscribe_authenticated_session_topic_failure),K}a.addTrace(ua.subscribe_authenticated_session_topic_success),await this.client.session.set(P,q),a.addTrace(ua.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:c.pairingTopic,metadata:c.requester.metadata})}a.addTrace(ua.publishing_authenticated_session_approve);try{await this.sendResult({topic:m,id:i,result:{cacaos:n,responder:{publicKey:d,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(c.requester.metadata,f)})}catch(K){throw a.setError(nc.authenticated_session_approve_publish_failure),K}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:c.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:a.eventId}),{session:q}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,a=this.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);a.transportType===Kt.relay&&await this.confirmOnlineStateOrThrow();const c=a.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),g=uf(c),d={type:bs,receiverPublicKey:c,senderPublicKey:f};await this.sendError({id:i,topic:g,error:n,encodeOpts:d,rpcOpts:wr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(a.requester.metadata,a.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Lt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return W3(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(a=>{var c,f;return((c=a.peerMetadata)==null?void 0:c.url)&&((f=a.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:a=!1,emitEvent:c=!0,id:f=0}=t,{self:g}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Lt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(g.publicKey)&&await this.client.core.crypto.deleteKeyPair(g.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),a||this.client.core.expirer.del(n),this.client.core.storage.removeItem(Ob).catch(d=>this.client.logger.warn(d)),this.getPendingSessionRequests().forEach(d=>{d.topic===n&&this.deletePendingSessionRequest(d.id,Lt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=Sn.idle),c&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),a=this.client.core.eventClient.getEvent({topic:n.pairingTopic});a==null||a.setError(ca.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Lt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),n&&(this.sessionRequestQueue.state=Sn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,br(wr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:a,transportType:c=Kt.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:a,verifyContext:n.verifyContext,transportType:c})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:a,verifyContext:c}=t,f=a.request.expiryTimestamp||br(wr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:a,verifyContext:c})},this.sendRequest=async t=>{const{topic:i,method:n,params:a,expiry:c,relayRpcId:f,clientRpcId:g,throwOnFailedPublish:d,appLink:m}=t,w=Fs(n,a,g);let O;const I=!!m;try{const K=I?tc:Ls;O=await this.client.core.crypto.encode(i,w,{encoding:K})}catch(K){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),K}let P;if(WN.includes(n)){const K=ls(JSON.stringify(w)),Y=ls(O);P=await this.client.core.verify.register({id:Y,decryptedId:K})}const q=wr[n].req;if(q.attestation=P,c&&(q.ttl=c),f&&(q.id=f),this.client.core.history.set(i,w),I){const K=Yu(m,i,O);await globalThis.Linking.openURL(K,this.client.name)}else{const K=wr[n].req;c&&(K.ttl=c),f&&(K.id=f),d?(K.internal=hn(rr({},K.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,O,K)):this.client.core.relayer.publish(i,O,K).catch(Y=>this.client.logger.error(Y))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:a,throwOnFailedPublish:c,encodeOpts:f,appLink:g}=t,d=rh(i,a);let m;const w=g&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const I=w?tc:Ls;m=await this.client.core.crypto.encode(n,d,hn(rr({},f||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),I}let O;try{O=await this.client.core.history.get(n,i)}catch(I){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),I}if(w){const I=Yu(g,n,m);await globalThis.Linking.openURL(I,this.client.name)}else{const I=wr[O.request.method].res;c?(I.internal=hn(rr({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,m,I)):this.client.core.relayer.publish(n,m,I).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(d)},this.sendError=async t=>{const{id:i,topic:n,error:a,encodeOpts:c,rpcOpts:f,appLink:g}=t,d=ih(i,a);let m;const w=g&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const I=w?tc:Ls;m=await this.client.core.crypto.encode(n,d,hn(rr({},c||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),I}let O;try{O=await this.client.core.history.get(n,i)}catch(I){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),I}if(w){const I=Yu(g,n,m);await globalThis.Linking.openURL(I,this.client.name)}else{const I=f||wr[O.request.method].res;this.client.core.relayer.publish(n,m,I)}await this.client.core.history.resolve(d)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let a=!1;Rs(n.expiry)&&(a=!0),this.client.core.crypto.keychain.has(n.topic)||(a=!0),a&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Rs(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Sn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Sn.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=Sn.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:a,transportType:c,encryptedId:f}=t,g=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:g}))switch(g){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:a,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:a,encryptedId:f,transportType:c});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:a,encryptedId:f,transportType:c});default:return this.client.logger.info(`Unsupported request method ${g}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:a}=t,c=(await this.client.core.history.get(i,n.id)).request.method;switch(c){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,a);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${c}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=De("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,a=this.expectedPairingMethodMap.get(i);return!a||a.includes(n)?!1:!!(a.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:a,encryptedId:c}=t,{params:f,id:g}=n;try{const d=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(rr({},n.params));const m=f.expiryTimestamp||br(wr.wc_sessionPropose.req.ttl),w=rr({id:g,pairingTopic:i,expiryTimestamp:m},f);await this.setProposal(g,w);const O=await this.getVerifyContext({attestationId:a,hash:ls(JSON.stringify(n)),encryptedId:c,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),d==null||d.setError(fs.proposal_listener_not_found)),d==null||d.addTrace(Mn.emit_session_proposal),this.client.events.emit("session_proposal",{id:g,params:w,verifyContext:O})}catch(d){await this.sendError({id:g,topic:i,error:d,rpcOpts:wr.wc_sessionPropose.autoReject}),this.client.logger.error(d)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:a}=i;if(Pn(i)){const{result:c}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:c});const f=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const g=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:g});const d=c.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:d});const m=await this.client.core.crypto.generateSharedKey(g,d);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const w=await this.client.core.relayer.subscribe(m,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(ji(i)){await this.client.proposal.delete(a,Lt("USER_DISCONNECTED"));const c=xt("session_connect");if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners, 954`);this.events.emit(xt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:a}=i;try{this.isValidSessionSettleRequest(a);const{relay:c,controller:f,expiry:g,namespaces:d,sessionProperties:m,sessionConfig:w}=i.params,O=hn(rr(rr({topic:t,relay:c,expiry:g,namespaces:d,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},m&&{sessionProperties:m}),w&&{sessionConfig:w}),{transportType:Kt.relay}),I=xt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(xt("session_connect"),{session:O}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(c){await this.sendError({id:n,topic:t,error:c}),this.client.logger.error(c)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;Pn(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(xt("session_approve",n),{})):ji(i)&&(await this.client.session.delete(t,Lt("USER_DISCONNECTED")),this.events.emit(xt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:a}=i;try{const c=`${t}_session_update`,f=rc.get(c);if(f&&this.isRequestOutOfSync(f,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError({id:a,topic:t,error:Lt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(rr({topic:t},n));try{rc.set(c,a),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0})}catch(g){throw rc.delete(c),g}this.client.events.emit("session_update",{id:a,topic:t,params:n})}catch(c){await this.sendError({id:a,topic:t,error:c}),this.client.logger.error(c)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,a=xt("session_update",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Pn(i)?this.events.emit(xt("session_update",n),{}):ji(i)&&this.events.emit(xt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,br(Qa)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,a=xt("session_extend",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Pn(i)?this.events.emit(xt("session_extend",n),{}):ji(i)&&this.events.emit(xt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,a=xt("session_ping",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{Pn(i)?this.events.emit(xt("session_ping",n),{}):ji(i)&&this.events.emit(xt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(a=>{this.client.core.relayer.once(Jr.publish,async()=>{a(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Lt("USER_DISCONNECTED")})]).catch(a=>this.client.logger.error(a))}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async t=>{var i,n,a;const{topic:c,payload:f,attestation:g,encryptedId:d,transportType:m}=t,{id:w,params:O}=f;try{await this.isValidRequest(rr({topic:c},O));const I=this.client.session.get(c),P=await this.getVerifyContext({attestationId:g,hash:ls(JSON.stringify(Fs("wc_sessionRequest",O,w))),encryptedId:d,metadata:I.peer.metadata,transportType:m}),q={id:w,topic:c,params:O,verifyContext:P};await this.setPendingSessionRequest(q),m===Kt.link_mode&&(i=I.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=I.peer.metadata.redirect)==null?void 0:n.universal),(a=this.client.signConfig)!=null&&a.disableRequestQueue?this.emitSessionRequest(q):(this.addSessionRequestToSessionRequestQueue(q),this.processSessionRequestQueue())}catch(I){await this.sendError({id:w,topic:c,error:I}),this.client.logger.error(I)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,a=xt("session_request",n);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Pn(i)?this.events.emit(xt("session_request",n),{result:i.result}):ji(i)&&this.events.emit(xt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:a}=i;try{const c=`${t}_session_event_${a.event.name}`,f=rc.get(c);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(rr({topic:t},a)),this.client.events.emit("session_event",{id:n,topic:t,params:a}),rc.set(c,n)}catch(c){await this.sendError({id:n,topic:t,error:c}),this.client.logger.error(c)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),Pn(i)?this.events.emit(xt("session_request",n),{result:i.result}):ji(i)&&this.events.emit(xt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:a,attestation:c,encryptedId:f,transportType:g}=t;try{const{requester:d,authPayload:m,expiryTimestamp:w}=a.params,O=await this.getVerifyContext({attestationId:c,hash:ls(JSON.stringify(a)),encryptedId:f,metadata:d.metadata,transportType:g}),I={requester:d,pairingTopic:n,id:a.id,authPayload:m,verifyContext:O,expiryTimestamp:w};await this.setAuthRequest(a.id,{request:I,pairingTopic:n,transportType:g}),g===Kt.link_mode&&(i=d.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(d.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:a.params,id:a.id,verifyContext:O})}catch(d){this.client.logger.error(d);const m=a.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),O=this.getAppLinkIfEnabled(a.params.requester.metadata,g),I={type:bs,receiverPublicKey:m,senderPublicKey:w};await this.sendError({id:a.id,topic:n,error:d,encodeOpts:I,rpcOpts:wr.wc_sessionAuthenticate.autoReject,appLink:O})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Sn.idle,this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{const c=a.request.id,f=xt("session_request",c);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(xt("session_request",a.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Sn.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Sn.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Fs("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(g)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:a,sessionProperties:c,relays:f}=t;if(fi(i)||await this.isValidPairingTopic(i),!MI(f)){const{message:g}=De("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(g)}!fi(n)&&Dc(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!fi(a)&&Dc(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),fi(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=SI(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!ci(t))throw new Error(De("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:a,sessionProperties:c}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),g=Vl(n,"approve()");if(g)throw new Error(g.message);const d=Hg(f.requiredNamespaces,n,"approve()");if(d)throw new Error(d.message);if(!ur(a,!0)){const{message:m}=De("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(m)}fi(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async t=>{if(!ci(t)){const{message:a}=De("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!CI(n)){const{message:a}=De("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!ci(t)){const{message:d}=De("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(d)}const{relay:i,controller:n,namespaces:a,expiry:c}=t;if(!i2(i)){const{message:d}=De("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(d)}const f=wI(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const g=Vl(a,"onSessionSettleRequest()");if(g)throw new Error(g.message);if(Rs(c)){const{message:d}=De("EXPIRED","onSessionSettleRequest()");throw new Error(d)}},this.isValidUpdate=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(g)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const a=this.client.session.get(i),c=Vl(n,"update()");if(c)throw new Error(c.message);const f=Hg(a.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!ci(t)){const{message:g}=De("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(g)}const{topic:i,request:n,chainId:a,expiry:c}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!kg(f,a)){const{message:g}=De("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(g)}if(!PI(n)){const{message:g}=De("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(g)}if(!RI(f,a,n.method)){const{message:g}=De("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(g)}if(c&&!UI(c,td)){const{message:g}=De("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${td.min} and ${td.max}`);throw new Error(g)}},this.isValidRespond=async t=>{var i;if(!ci(t)){const{message:c}=De("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:n,response:a}=t;try{await this.isValidSessionTopic(n)}catch(c){throw(i=t==null?void 0:t.response)!=null&&i.id&&this.cleanupAfterResponse(t),c}if(!OI(a)){const{message:c}=De("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!ci(t)){const{message:f}=De("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:a}=t;await this.isValidSessionTopic(i);const{namespaces:c}=this.client.session.get(i);if(!kg(c,a)){const{message:f}=De("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(f)}if(!TI(n)){const{message:f}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!NI(c,a,n.name)){const{message:f}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!ci(t)){const{message:n}=De("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:a,nonce:c}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!ur(n,!1))throw new Error("uri is required parameter");if(!ur(a,!1))throw new Error("domain is required parameter");if(!ur(c,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(g=>hc(g).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=hc(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:a,metadata:c,transportType:f}=t,g={verified:{verifyUrl:c.verifyUrl||bc,validation:"UNKNOWN",origin:c.url||""}};try{if(f===Kt.link_mode){const m=this.getAppLinkIfEnabled(c,f);return g.verified.validation=m&&new URL(m).origin===new URL(c.url).origin?"VALID":"INVALID",g}const d=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:a,verifyUrl:c.verifyUrl});d&&(g.verified.origin=d.origin,g.verified.isScam=d.isScam,g.verified.validation=d.origin===new URL(c.url).origin?"VALID":"INVALID")}catch(d){this.client.logger.warn(d)}return this.client.logger.debug(`Verify context: ${JSON.stringify(g)}`),g},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!ur(n,!1)){const{message:a}=De("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(a)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const a=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(n++>=a)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=De("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,a,c,f,g,d,m,w,O;return!t||i!==Kt.link_mode?!1:((a=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:a.linkMode)===!0&&((f=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:f.universal)!==void 0&&((d=(g=this.client.metadata)==null?void 0:g.redirect)==null?void 0:d.universal)!==""&&((m=t==null?void 0:t.redirect)==null?void 0:m.universal)!==void 0&&((w=t==null?void 0:t.redirect)==null?void 0:w.universal)!==""&&((O=t==null?void 0:t.redirect)==null?void 0:O.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t==null?void 0:t.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=ig(t,"topic")||"",n=decodeURIComponent(ig(t,"wc_ev")||""),a=this.client.session.keys.includes(i);a&&this.client.session.update(i,{transportType:Kt.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:a})},this.registerLinkModeListeners=async()=>{var t;if(i0()||_o()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=globalThis==null?void 0:globalThis.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Jr.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:a}=e,{publicKey:c}=this.client.auth.authKeys.keys.includes(lf)?this.client.auth.authKeys.get(lf):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:c,encoding:a===Kt.link_mode?tc:Ls});try{g0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:a,encryptedId:ls(i)})):nh(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:a}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:a})}catch(g){this.client.logger.error(g)}}registerExpirerEvents(){this.client.core.expirer.on(Fi.expired,async e=>{const{topic:t,id:i}=l3(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,De("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,De("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(la.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(la.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ur(e,!1)){const{message:t}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=De("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!ur(e,!1)){const{message:t}=De("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=De("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=De("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ur(e,!1)){const{message:t}=De("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=De("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!II(e)){const{message:t}=De("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=De("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Rs(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=De("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class oB extends Ia{constructor(e,t){super(e,t,KN,m0),this.core=e,this.logger=t}}class cB extends Ia{constructor(e,t){super(e,t,VN,m0),this.core=e,this.logger=t}}class uB extends Ia{constructor(e,t){super(e,t,JN,m0,i=>i.id),this.core=e,this.logger=t}}class fB extends Ia{constructor(e,t){super(e,t,XN,ah,()=>lf),this.core=e,this.logger=t}}class hB extends Ia{constructor(e,t){super(e,t,ZN,ah),this.core=e,this.logger=t}}class lB extends Ia{constructor(e,t){super(e,t,eB,ah,i=>i.id),this.core=e,this.logger=t}}class dB{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new fB(this.core,this.logger),this.pairingTopics=new hB(this.core,this.logger),this.requests=new lB(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class y0 extends oP{constructor(e){super(e),this.protocol=$2,this.version=U2,this.name=ed.name,this.events=new Vi.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(a){throw this.logger.error(a.message),a}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=(e==null?void 0:e.name)||ed.name,this.metadata=(e==null?void 0:e.metadata)||o3(),this.signConfig=e==null?void 0:e.signConfig;const t=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qc(eh({level:(e==null?void 0:e.logger)||ed.logger}));this.core=(e==null?void 0:e.core)||new HN(e),this.logger=Qr(t,this.name),this.session=new cB(this.core,this.logger),this.proposal=new oB(this.core,this.logger),this.pendingRequest=new uB(this.core,this.logger),this.engine=new aB(this),this.auth=new dB(this.core,this.logger)}static async init(e){const t=new y0(e);return await t.initialize(),t}get context(){return pi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var $d={exports:{}};(function(r,e){var t=typeof self<"u"?self:rv,i=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(c){var f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function g(h){return h&&DataView.prototype.isPrototypeOf(h)}if(f.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(h){return h&&d.indexOf(Object.prototype.toString.call(h))>-1};function w(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function O(h){return typeof h!="string"&&(h=String(h)),h}function I(h){var v={next:function(){var E=h.shift();return{done:E===void 0,value:E}}};return f.iterable&&(v[Symbol.iterator]=function(){return v}),v}function P(h){this.map={},h instanceof P?h.forEach(function(v,E){this.append(E,v)},this):Array.isArray(h)?h.forEach(function(v){this.append(v[0],v[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(v){this.append(v,h[v])},this)}P.prototype.append=function(h,v){h=w(h),v=O(v);var E=this.map[h];this.map[h]=E?E+", "+v:v},P.prototype.delete=function(h){delete this.map[w(h)]},P.prototype.get=function(h){return h=w(h),this.has(h)?this.map[h]:null},P.prototype.has=function(h){return this.map.hasOwnProperty(w(h))},P.prototype.set=function(h,v){this.map[w(h)]=O(v)},P.prototype.forEach=function(h,v){for(var E in this.map)this.map.hasOwnProperty(E)&&h.call(v,this.map[E],E,this)},P.prototype.keys=function(){var h=[];return this.forEach(function(v,E){h.push(E)}),I(h)},P.prototype.values=function(){var h=[];return this.forEach(function(v){h.push(v)}),I(h)},P.prototype.entries=function(){var h=[];return this.forEach(function(v,E){h.push([E,v])}),I(h)},f.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function q(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function K(h){return new Promise(function(v,E){h.onload=function(){v(h.result)},h.onerror=function(){E(h.error)}})}function Y(h){var v=new FileReader,E=K(v);return v.readAsArrayBuffer(h),E}function z(h){var v=new FileReader,E=K(v);return v.readAsText(h),E}function W(h){for(var v=new Uint8Array(h),E=new Array(v.length),S=0;S-1?v:h}function N(h,v){v=v||{};var E=v.body;if(h instanceof N){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,v.headers||(this.headers=new P(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!E&&h._bodyInit!=null&&(E=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new P(v.headers)),this.method=_(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function se(h){var v=new FormData;return h.trim().split("&").forEach(function(E){if(E){var S=E.split("="),M=S.shift().replace(/\+/g," "),x=S.join("=").replace(/\+/g," ");v.append(decodeURIComponent(M),decodeURIComponent(x))}}),v}function le(h){var v=new P,E=h.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(S){var M=S.split(":"),x=M.shift().trim();if(x){var p=M.join(":").trim();v.append(x,p)}}),v}j.call(N.prototype);function U(h,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new P(v.headers),this.url=v.url||"",this._initBody(h)}j.call(U.prototype),U.prototype.clone=function(){return new U(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},U.error=function(){var h=new U(null,{status:0,statusText:""});return h.type="error",h};var y=[301,302,303,307,308];U.redirect=function(h,v){if(y.indexOf(v)===-1)throw new RangeError("Invalid status code");return new U(null,{status:v,headers:{location:h}})},c.DOMException=a.DOMException;try{new c.DOMException}catch{c.DOMException=function(v,E){this.message=v,this.name=E;var S=Error(v);this.stack=S.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function u(h,v){return new Promise(function(E,S){var M=new N(h,v);if(M.signal&&M.signal.aborted)return S(new c.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function p(){x.abort()}x.onload=function(){var b={status:x.status,statusText:x.statusText,headers:le(x.getAllResponseHeaders()||"")};b.url="responseURL"in x?x.responseURL:b.headers.get("X-Request-URL");var R="response"in x?x.response:x.responseText;E(new U(R,b))},x.onerror=function(){S(new TypeError("Network request failed"))},x.ontimeout=function(){S(new TypeError("Network request failed"))},x.onabort=function(){S(new c.DOMException("Aborted","AbortError"))},x.open(M.method,M.url,!0),M.credentials==="include"?x.withCredentials=!0:M.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&f.blob&&(x.responseType="blob"),M.headers.forEach(function(b,R){x.setRequestHeader(R,b)}),M.signal&&(M.signal.addEventListener("abort",p),x.onreadystatechange=function(){x.readyState===4&&M.signal.removeEventListener("abort",p)}),x.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return u.polyfill=!0,a.fetch||(a.fetch=u,a.Headers=P,a.Request=N,a.Response=U),c.Headers=P,c.Request=N,c.Response=U,c.fetch=u,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})($d,$d.exports);var pB=$d.exports;const Nb=Fd(pB);var gB=Object.defineProperty,bB=Object.defineProperties,vB=Object.getOwnPropertyDescriptors,Bb=Object.getOwnPropertySymbols,mB=Object.prototype.hasOwnProperty,yB=Object.prototype.propertyIsEnumerable,$b=(r,e,t)=>e in r?gB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ub=(r,e)=>{for(var t in e||(e={}))mB.call(e,t)&&$b(r,t,e[t]);if(Bb)for(var t of Bb(e))yB.call(e,t)&&$b(r,t,e[t]);return r},qb=(r,e)=>bB(r,vB(e));const wB={Accept:"application/json","Content-Type":"application/json"},_B="POST",Lb={headers:wB,method:_B},Fb=10;class Yn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Vi.EventEmitter,this.isAvailable=!1,this.registering=!1,!ob(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=ys(e),i=await(await Nb(this.url,qb(Ub({},Lb),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!ob(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),n(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ys({id:1,jsonrpc:"2.0",method:"test",params:[]});await Nb(e,qb(Ub({},Lb),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?ya(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),a=ih(e,n);this.events.emit("payload",a)}parseError(e,t=this.url){return g2(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Fb&&this.events.setMaxListeners(Fb)}}const zb="error",DB="wss://relay.walletconnect.org",EB="wc",AB="universal_provider",jb=`${EB}@2:${AB}:`,F2="https://rpc.walletconnect.org/v1/",eo="generic",xB=`${F2}bundler`,yn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var oc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Ud={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -*/(function(r,e){(function(){var t,i="4.17.21",n=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="Invalid `variable` option passed into `_.template`",g="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",w=1,O=2,C=4,P=1,q=2,K=1,Y=2,z=4,W=8,B=16,j=32,k=64,_=128,N=256,se=512,le=30,U="...",y=800,u=16,h=1,v=2,E=3,S=1/0,M=9007199254740991,x=17976931348623157e292,p=NaN,b=4294967295,R=b-1,Z=b>>>1,ae=[["ary",_],["bind",K],["bindKey",Y],["curry",W],["curryRight",B],["flip",se],["partial",j],["partialRight",k],["rearg",N]],I="[object Arguments]",ee="[object Array]",L="[object AsyncFunction]",V="[object Boolean]",G="[object Date]",D="[object DOMException]",H="[object Error]",ne="[object Function]",ce="[object GeneratorFunction]",fe="[object Map]",ye="[object Number]",we="[object Null]",Te="[object Object]",Qe="[object Promise]",Ce="[object Proxy]",Re="[object RegExp]",Se="[object Set]",me="[object String]",Pe="[object Symbol]",Ne="[object Undefined]",be="[object WeakMap]",Oe="[object WeakSet]",xe="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",Me="[object Float64Array]",_e="[object Int8Array]",He="[object Int16Array]",Ve="[object Int32Array]",Ee="[object Uint8Array]",Ke="[object Uint8ClampedArray]",ht="[object Uint16Array]",Ge="[object Uint32Array]",_t=/\b__p \+= '';/g,lt=/\b(__p \+=) '' \+/g,We=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Et=/&(?:amp|lt|gt|quot|#39);/g,St=/[&<>"']/g,Be=RegExp(Et.source),Xe=RegExp(St.source),tt=/<%-([\s\S]+?)%>/g,$e=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,Ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fe=/^\w*$/,ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rt=/[\\^$.*+?()[\]{}|]/g,ze=RegExp(rt.source),it=/^\s+/,st=/\s/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ye=/\{\n\/\* \[wrapped with (.+)\] \*/,ft=/,? & /,je=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rt=/[()=,{}\[\]\/\s]/,Nt=/\\(\\)?/g,at=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,Rr=/^[-+]0x[0-9a-f]+$/i,Nr=/^0b[01]+$/i,Br=/^\[object .+?Constructor\]$/,$r=/^0o[0-7]+$/i,Ur=/^(?:0|[1-9]\d*)$/,er=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xr=/($^)/,Wi=/['\n\r\u2028\u2029\\]/g,Zr="\\ud800-\\udfff",Yi="\\u0300-\\u036f",Qi="\\ufe20-\\ufe2f",ei="\\u20d0-\\u20ff",Mi=Yi+Qi+ei,Ii="\\u2700-\\u27bf",lr="a-z\\xdf-\\xf6\\xf8-\\xff",Xi="\\xac\\xb1\\xd7\\xf7",Zi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",en="\\u2000-\\u206f",Ks=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",zc="A-Z\\xc0-\\xd6\\xd8-\\xde",jc="\\ufe0e\\ufe0f",Vs=Xi+Zi+en+Ks,Io="['’]",Gs="["+Zr+"]",Co="["+Vs+"]",Js="["+Mi+"]",kc="\\d+",ah="["+Ii+"]",Hc="["+lr+"]",Kc="[^"+Zr+Vs+kc+Ii+lr+zc+"]",Pa="\\ud83c[\\udffb-\\udfff]",oh="(?:"+Js+"|"+Pa+")",Vc="[^"+Zr+"]",Oa="(?:\\ud83c[\\udde6-\\uddff]){2}",_s="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+zc+"]",Gc="\\u200d",Jc="(?:"+Hc+"|"+Kc+")",yn="(?:"+gi+"|"+Kc+")",Wc="(?:"+Io+"(?:d|ll|m|re|s|t|ve))?",Yc="(?:"+Io+"(?:D|LL|M|RE|S|T|VE))?",Qc=oh+"?",Xc="["+jc+"]?",ch="(?:"+Gc+"(?:"+[Vc,Oa,_s].join("|")+")"+Xc+Qc+")*",Yn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=Xc+Qc+ch,Ta="(?:"+[ah,Oa,_s].join("|")+")"+eu,uh="(?:"+[Vc+Js+"?",Js,Oa,_s,Gs].join("|")+")",Po=RegExp(Io,"g"),fh=RegExp(Js,"g"),Ra=RegExp(Pa+"(?="+Pa+")|"+uh+eu,"g"),tu=RegExp([gi+"?"+Hc+"+"+Wc+"(?="+[Co,gi,"$"].join("|")+")",yn+"+"+Yc+"(?="+[Co,gi+Jc,"$"].join("|")+")",gi+"?"+Jc+"+"+Wc,gi+"+"+Yc,Zc,Yn,kc,Ta].join("|"),"g"),ru=RegExp("["+Gc+Zr+Mi+jc+"]"),Ws=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,iu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],hh=-1,zt={};zt[qe]=zt[Me]=zt[_e]=zt[He]=zt[Ve]=zt[Ee]=zt[Ke]=zt[ht]=zt[Ge]=!0,zt[I]=zt[ee]=zt[xe]=zt[V]=zt[ve]=zt[G]=zt[H]=zt[ne]=zt[fe]=zt[ye]=zt[Te]=zt[Re]=zt[Se]=zt[me]=zt[be]=!1;var Ft={};Ft[I]=Ft[ee]=Ft[xe]=Ft[ve]=Ft[V]=Ft[G]=Ft[qe]=Ft[Me]=Ft[_e]=Ft[He]=Ft[Ve]=Ft[fe]=Ft[ye]=Ft[Te]=Ft[Re]=Ft[Se]=Ft[me]=Ft[Pe]=Ft[Ee]=Ft[Ke]=Ft[ht]=Ft[Ge]=!0,Ft[H]=Ft[ne]=Ft[be]=!1;var J={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},te={"&":"&","<":"<",">":">",'"':""","'":"'"},pe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jt=parseFloat,pt=parseInt,Wt=typeof ac=="object"&&ac&&ac.Object===Object&&ac,fr=typeof self=="object"&&self&&self.Object===Object&&self,Ot=Wt||fr||Function("return this")(),kt=e&&!e.nodeType&&e,sr=kt&&!0&&r&&!r.nodeType&&r,ti=sr&&sr.exports===kt,hr=ti&&Wt.process,Yt=function(){try{var re=sr&&sr.require&&sr.require("util").types;return re||hr&&hr.binding&&hr.binding("util")}catch{}}(),kr=Yt&&Yt.isArrayBuffer,tn=Yt&&Yt.isDate,Ci=Yt&&Yt.isMap,wn=Yt&&Yt.isRegExp,Oo=Yt&&Yt.isSet,Ys=Yt&&Yt.isTypedArray;function vr(re,ue,oe){switch(oe.length){case 0:return re.call(ue);case 1:return re.call(ue,oe[0]);case 2:return re.call(ue,oe[0],oe[1]);case 3:return re.call(ue,oe[0],oe[1],oe[2])}return re.apply(ue,oe)}function k2(re,ue,oe,ke){for(var dt=-1,Bt=re==null?0:re.length;++dt-1}function lh(re,ue,oe){for(var ke=-1,dt=re==null?0:re.length;++ke-1;);return oe}function I0(re,ue){for(var oe=re.length;oe--&&Na(ue,re[oe],0)>-1;);return oe}function X2(re,ue){for(var oe=re.length,ke=0;oe--;)re[oe]===ue&&++ke;return ke}var Z2=bh(J),em=bh(te);function tm(re){return"\\"+Le[re]}function rm(re,ue){return re==null?t:re[ue]}function Ba(re){return ru.test(re)}function im(re){return Ws.test(re)}function nm(re){for(var ue,oe=[];!(ue=re.next()).done;)oe.push(ue.value);return oe}function wh(re){var ue=-1,oe=Array(re.size);return re.forEach(function(ke,dt){oe[++ue]=[dt,ke]}),oe}function C0(re,ue){return function(oe){return re(ue(oe))}}function As(re,ue){for(var oe=-1,ke=re.length,dt=0,Bt=[];++oe-1}function Km(s,o){var l=this.__data__,A=_u(l,s);return A<0?(++this.size,l.push([s,o])):l[A][1]=o,this}Qn.prototype.clear=zm,Qn.prototype.delete=jm,Qn.prototype.get=km,Qn.prototype.has=Hm,Qn.prototype.set=Km;function Xn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o=o?s:o)),s}function Ri(s,o,l,A,T,F){var Q,X=o&w,ie=o&O,he=o&C;if(l&&(Q=T?l(s,A,T,F):l(s)),Q!==t)return Q;if(!Zt(s))return s;var de=gt(s);if(de){if(Q=Wy(s),!X)return ri(s,Q)}else{var ge=Lr(s),Ie=ge==ne||ge==ce;if(Ps(s))return hp(s,X);if(ge==Te||ge==I||Ie&&!T){if(Q=ie||Ie?{}:Pp(s),!X)return ie?qy(s,oy(Q,s)):Uy(s,z0(Q,s))}else{if(!Ft[ge])return T?s:{};Q=Yy(s,ge,X)}}F||(F=new nn);var Je=F.get(s);if(Je)return Je;F.set(s,Q),s1(s)?s.forEach(function(ct){Q.add(Ri(ct,o,l,ct,s,F))}):i1(s)&&s.forEach(function(ct,At){Q.set(At,Ri(ct,o,l,At,s,F))});var ot=he?ie?Vh:Kh:ie?ni:mr,wt=de?t:ot(s);return Pi(wt||s,function(ct,At){wt&&(At=ct,ct=s[At]),qo(Q,At,Ri(ct,o,l,At,s,F))}),Q}function cy(s){var o=mr(s);return function(l){return j0(l,s,o)}}function j0(s,o,l){var A=l.length;if(s==null)return!A;for(s=Ht(s);A--;){var T=l[A],F=o[T],Q=s[T];if(Q===t&&!(T in s)||!F(Q))return!1}return!0}function k0(s,o,l){if(typeof s!="function")throw new Oi(c);return Ko(function(){s.apply(t,l)},o)}function Lo(s,o,l,A){var T=-1,F=nu,Q=!0,X=s.length,ie=[],he=o.length;if(!X)return ie;l&&(o=Xt(o,bi(l))),A?(F=lh,Q=!1):o.length>=n&&(F=To,Q=!1,o=new Zs(o));e:for(;++TT?0:T+l),A=A===t||A>T?T:yt(A),A<0&&(A+=T),A=l>A?0:o1(A);l0&&l(X)?o>1?xr(X,o-1,l,A,T):Es(T,X):A||(T[T.length]=X)}return T}var Mh=vp(),V0=vp(!0);function _n(s,o){return s&&Mh(s,o,mr)}function Ih(s,o){return s&&V0(s,o,mr)}function Eu(s,o){return Ds(o,function(l){return is(s[l])})}function ta(s,o){o=Is(o,s);for(var l=0,A=o.length;s!=null&&lo}function hy(s,o){return s!=null&&qt.call(s,o)}function ly(s,o){return s!=null&&o in Ht(s)}function dy(s,o,l){return s>=qr(o,l)&&s=120&&de.length>=120)?new Zs(Q&&de):t}de=s[0];var ge=-1,Ie=X[0];e:for(;++ge-1;)X!==s&&pu.call(X,ie,1),pu.call(s,ie,1);return s}function ip(s,o){for(var l=s?o.length:0,A=l-1;l--;){var T=o[l];if(l==A||T!==F){var F=T;rs(T)?pu.call(s,T,1):qh(s,T)}}return s}function Bh(s,o){return s+vu(U0()*(o-s+1))}function Sy(s,o,l,A){for(var T=-1,F=pr(bu((o-s)/(l||1)),0),Q=oe(F);F--;)Q[A?F:++T]=s,s+=l;return Q}function $h(s,o){var l="";if(!s||o<1||o>M)return l;do o%2&&(l+=s),o=vu(o/2),o&&(s+=s);while(o);return l}function Dt(s,o){return Zh(Rp(s,o,si),s+"")}function My(s){return F0(Va(s))}function Iy(s,o){var l=Va(s);return Nu(l,ea(o,0,l.length))}function jo(s,o,l,A){if(!Zt(s))return s;o=Is(o,s);for(var T=-1,F=o.length,Q=F-1,X=s;X!=null&&++TT?0:T+o),l=l>T?T:l,l<0&&(l+=T),T=o>l?0:l-o>>>0,o>>>=0;for(var F=oe(T);++A>>1,Q=s[F];Q!==null&&!mi(Q)&&(l?Q<=o:Q=n){var he=o?null:jy(s);if(he)return au(he);Q=!1,T=To,ie=new Zs}else ie=o?[]:X;e:for(;++A=A?s:Ni(s,o,l)}var fp=ym||function(s){return Ot.clearTimeout(s)};function hp(s,o){if(o)return s.slice();var l=s.length,A=T0?T0(l):new s.constructor(l);return s.copy(A),A}function jh(s){var o=new s.constructor(s.byteLength);return new lu(o).set(new lu(s)),o}function Ry(s,o){var l=o?jh(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function Ny(s){var o=new s.constructor(s.source,vt.exec(s));return o.lastIndex=s.lastIndex,o}function By(s){return Uo?Ht(Uo.call(s)):{}}function lp(s,o){var l=o?jh(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function dp(s,o){if(s!==o){var l=s!==t,A=s===null,T=s===s,F=mi(s),Q=o!==t,X=o===null,ie=o===o,he=mi(o);if(!X&&!he&&!F&&s>o||F&&Q&&ie&&!X&&!he||A&&Q&&ie||!l&&ie||!T)return 1;if(!A&&!F&&!he&&s=X)return ie;var he=l[A];return ie*(he=="desc"?-1:1)}}return s.index-o.index}function pp(s,o,l,A){for(var T=-1,F=s.length,Q=l.length,X=-1,ie=o.length,he=pr(F-Q,0),de=oe(ie+he),ge=!A;++X1?l[T-1]:t,Q=T>2?l[2]:t;for(F=s.length>3&&typeof F=="function"?(T--,F):t,Q&&Kr(l[0],l[1],Q)&&(F=T<3?t:F,T=1),o=Ht(o);++A-1?T[F?o[Q]:Q]:t}}function wp(s){return ts(function(o){var l=o.length,A=l,T=Ti.prototype.thru;for(s&&o.reverse();A--;){var F=o[A];if(typeof F!="function")throw new Oi(c);if(T&&!Q&&Tu(F)=="wrapper")var Q=new Ti([],!0)}for(A=Q?A:l;++A1&&Tt.reverse(),de&&ieX))return!1;var he=F.get(s),de=F.get(o);if(he&&de)return he==o&&de==s;var ge=-1,Ie=!0,Je=l&q?new Zs:t;for(F.set(s,o),F.set(o,s);++ge1?"& ":"")+o[A],o=o.join(l>2?", ":" "),s.replace(Ue,`{ +*/(function(r,e){(function(){var t,i="4.17.21",n=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="Invalid `variable` option passed into `_.template`",g="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",w=1,O=2,I=4,P=1,q=2,K=1,Y=2,z=4,W=8,B=16,j=32,k=64,_=128,N=256,se=512,le=30,U="...",y=800,u=16,h=1,v=2,E=3,S=1/0,M=9007199254740991,x=17976931348623157e292,p=NaN,b=4294967295,R=b-1,Z=b>>>1,ae=[["ary",_],["bind",K],["bindKey",Y],["curry",W],["curryRight",B],["flip",se],["partial",j],["partialRight",k],["rearg",N]],C="[object Arguments]",ee="[object Array]",L="[object AsyncFunction]",V="[object Boolean]",G="[object Date]",D="[object DOMException]",H="[object Error]",ne="[object Function]",ce="[object GeneratorFunction]",fe="[object Map]",ye="[object Number]",we="[object Null]",Te="[object Object]",Qe="[object Promise]",Ce="[object Proxy]",Re="[object RegExp]",Se="[object Set]",me="[object String]",Pe="[object Symbol]",Ne="[object Undefined]",be="[object WeakMap]",Oe="[object WeakSet]",xe="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",Me="[object Float64Array]",_e="[object Int8Array]",He="[object Int16Array]",Ve="[object Int32Array]",Ee="[object Uint8Array]",Ke="[object Uint8ClampedArray]",ht="[object Uint16Array]",Ge="[object Uint32Array]",_t=/\b__p \+= '';/g,lt=/\b(__p \+=) '' \+/g,We=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Et=/&(?:amp|lt|gt|quot|#39);/g,St=/[&<>"']/g,Be=RegExp(Et.source),Xe=RegExp(St.source),tt=/<%-([\s\S]+?)%>/g,$e=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,Ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fe=/^\w*$/,ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rt=/[\\^$.*+?()[\]{}|]/g,ze=RegExp(rt.source),it=/^\s+/,st=/\s/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ye=/\{\n\/\* \[wrapped with (.+)\] \*/,ft=/,? & /,je=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rt=/[()=,{}\[\]\/\s]/,Nt=/\\(\\)?/g,at=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,Rr=/^[-+]0x[0-9a-f]+$/i,Nr=/^0b[01]+$/i,Br=/^\[object .+?Constructor\]$/,$r=/^0o[0-7]+$/i,Ur=/^(?:0|[1-9]\d*)$/,er=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xr=/($^)/,Wi=/['\n\r\u2028\u2029\\]/g,Zr="\\ud800-\\udfff",Yi="\\u0300-\\u036f",Qi="\\ufe20-\\ufe2f",ei="\\u20d0-\\u20ff",Mi=Yi+Qi+ei,Ii="\\u2700-\\u27bf",lr="a-z\\xdf-\\xf6\\xf8-\\xff",Xi="\\xac\\xb1\\xd7\\xf7",Zi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",en="\\u2000-\\u206f",Ks=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",jc="A-Z\\xc0-\\xd6\\xd8-\\xde",kc="\\ufe0e\\ufe0f",Vs=Xi+Zi+en+Ks,Co="['’]",Gs="["+Zr+"]",Po="["+Vs+"]",Js="["+Mi+"]",Hc="\\d+",oh="["+Ii+"]",Kc="["+lr+"]",Vc="[^"+Zr+Vs+Hc+Ii+lr+jc+"]",Oa="\\ud83c[\\udffb-\\udfff]",ch="(?:"+Js+"|"+Oa+")",Gc="[^"+Zr+"]",Ta="(?:\\ud83c[\\udde6-\\uddff]){2}",_s="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+jc+"]",Jc="\\u200d",Wc="(?:"+Kc+"|"+Vc+")",wn="(?:"+gi+"|"+Vc+")",Yc="(?:"+Co+"(?:d|ll|m|re|s|t|ve))?",Qc="(?:"+Co+"(?:D|LL|M|RE|S|T|VE))?",Xc=ch+"?",Zc="["+kc+"]?",uh="(?:"+Jc+"(?:"+[Gc,Ta,_s].join("|")+")"+Zc+Xc+")*",Qn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tu=Zc+Xc+uh,Ra="(?:"+[oh,Ta,_s].join("|")+")"+tu,fh="(?:"+[Gc+Js+"?",Js,Ta,_s,Gs].join("|")+")",Oo=RegExp(Co,"g"),hh=RegExp(Js,"g"),Na=RegExp(Oa+"(?="+Oa+")|"+fh+tu,"g"),ru=RegExp([gi+"?"+Kc+"+"+Yc+"(?="+[Po,gi,"$"].join("|")+")",wn+"+"+Qc+"(?="+[Po,gi+Wc,"$"].join("|")+")",gi+"?"+Wc+"+"+Yc,gi+"+"+Qc,eu,Qn,Hc,Ra].join("|"),"g"),iu=RegExp("["+Jc+Zr+Mi+kc+"]"),Ws=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],lh=-1,zt={};zt[qe]=zt[Me]=zt[_e]=zt[He]=zt[Ve]=zt[Ee]=zt[Ke]=zt[ht]=zt[Ge]=!0,zt[C]=zt[ee]=zt[xe]=zt[V]=zt[ve]=zt[G]=zt[H]=zt[ne]=zt[fe]=zt[ye]=zt[Te]=zt[Re]=zt[Se]=zt[me]=zt[be]=!1;var Ft={};Ft[C]=Ft[ee]=Ft[xe]=Ft[ve]=Ft[V]=Ft[G]=Ft[qe]=Ft[Me]=Ft[_e]=Ft[He]=Ft[Ve]=Ft[fe]=Ft[ye]=Ft[Te]=Ft[Re]=Ft[Se]=Ft[me]=Ft[Pe]=Ft[Ee]=Ft[Ke]=Ft[ht]=Ft[Ge]=!0,Ft[H]=Ft[ne]=Ft[be]=!1;var J={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},te={"&":"&","<":"<",">":">",'"':""","'":"'"},pe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jt=parseFloat,pt=parseInt,Wt=typeof oc=="object"&&oc&&oc.Object===Object&&oc,fr=typeof self=="object"&&self&&self.Object===Object&&self,Ot=Wt||fr||Function("return this")(),kt=e&&!e.nodeType&&e,sr=kt&&!0&&r&&!r.nodeType&&r,ti=sr&&sr.exports===kt,hr=ti&&Wt.process,Yt=function(){try{var re=sr&&sr.require&&sr.require("util").types;return re||hr&&hr.binding&&hr.binding("util")}catch{}}(),kr=Yt&&Yt.isArrayBuffer,tn=Yt&&Yt.isDate,Ci=Yt&&Yt.isMap,_n=Yt&&Yt.isRegExp,To=Yt&&Yt.isSet,Ys=Yt&&Yt.isTypedArray;function vr(re,ue,oe){switch(oe.length){case 0:return re.call(ue);case 1:return re.call(ue,oe[0]);case 2:return re.call(ue,oe[0],oe[1]);case 3:return re.call(ue,oe[0],oe[1],oe[2])}return re.apply(ue,oe)}function k2(re,ue,oe,ke){for(var dt=-1,Bt=re==null?0:re.length;++dt-1}function dh(re,ue,oe){for(var ke=-1,dt=re==null?0:re.length;++ke-1;);return oe}function C0(re,ue){for(var oe=re.length;oe--&&Ba(ue,re[oe],0)>-1;);return oe}function X2(re,ue){for(var oe=re.length,ke=0;oe--;)re[oe]===ue&&++ke;return ke}var Z2=vh(J),em=vh(te);function tm(re){return"\\"+Le[re]}function rm(re,ue){return re==null?t:re[ue]}function $a(re){return iu.test(re)}function im(re){return Ws.test(re)}function nm(re){for(var ue,oe=[];!(ue=re.next()).done;)oe.push(ue.value);return oe}function _h(re){var ue=-1,oe=Array(re.size);return re.forEach(function(ke,dt){oe[++ue]=[dt,ke]}),oe}function P0(re,ue){return function(oe){return re(ue(oe))}}function As(re,ue){for(var oe=-1,ke=re.length,dt=0,Bt=[];++oe-1}function Km(s,o){var l=this.__data__,A=Du(l,s);return A<0?(++this.size,l.push([s,o])):l[A][1]=o,this}Xn.prototype.clear=zm,Xn.prototype.delete=jm,Xn.prototype.get=km,Xn.prototype.has=Hm,Xn.prototype.set=Km;function Zn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o=o?s:o)),s}function Ri(s,o,l,A,T,F){var Q,X=o&w,ie=o&O,he=o&I;if(l&&(Q=T?l(s,A,T,F):l(s)),Q!==t)return Q;if(!Zt(s))return s;var de=gt(s);if(de){if(Q=Wy(s),!X)return ri(s,Q)}else{var ge=Lr(s),Ie=ge==ne||ge==ce;if(Ps(s))return lp(s,X);if(ge==Te||ge==C||Ie&&!T){if(Q=ie||Ie?{}:Op(s),!X)return ie?qy(s,oy(Q,s)):Uy(s,j0(Q,s))}else{if(!Ft[ge])return T?s:{};Q=Yy(s,ge,X)}}F||(F=new nn);var Je=F.get(s);if(Je)return Je;F.set(s,Q),a1(s)?s.forEach(function(ct){Q.add(Ri(ct,o,l,ct,s,F))}):n1(s)&&s.forEach(function(ct,At){Q.set(At,Ri(ct,o,l,At,s,F))});var ot=he?ie?Gh:Vh:ie?ni:mr,wt=de?t:ot(s);return Pi(wt||s,function(ct,At){wt&&(At=ct,ct=s[At]),Lo(Q,At,Ri(ct,o,l,At,s,F))}),Q}function cy(s){var o=mr(s);return function(l){return k0(l,s,o)}}function k0(s,o,l){var A=l.length;if(s==null)return!A;for(s=Ht(s);A--;){var T=l[A],F=o[T],Q=s[T];if(Q===t&&!(T in s)||!F(Q))return!1}return!0}function H0(s,o,l){if(typeof s!="function")throw new Oi(c);return Vo(function(){s.apply(t,l)},o)}function Fo(s,o,l,A){var T=-1,F=su,Q=!0,X=s.length,ie=[],he=o.length;if(!X)return ie;l&&(o=Xt(o,bi(l))),A?(F=dh,Q=!1):o.length>=n&&(F=Ro,Q=!1,o=new Zs(o));e:for(;++TT?0:T+l),A=A===t||A>T?T:yt(A),A<0&&(A+=T),A=l>A?0:c1(A);l0&&l(X)?o>1?xr(X,o-1,l,A,T):Es(T,X):A||(T[T.length]=X)}return T}var Ih=mp(),G0=mp(!0);function Dn(s,o){return s&&Ih(s,o,mr)}function Ch(s,o){return s&&G0(s,o,mr)}function Au(s,o){return Ds(o,function(l){return ns(s[l])})}function ta(s,o){o=Is(o,s);for(var l=0,A=o.length;s!=null&&lo}function hy(s,o){return s!=null&&qt.call(s,o)}function ly(s,o){return s!=null&&o in Ht(s)}function dy(s,o,l){return s>=qr(o,l)&&s=120&&de.length>=120)?new Zs(Q&&de):t}de=s[0];var ge=-1,Ie=X[0];e:for(;++ge-1;)X!==s&&gu.call(X,ie,1),gu.call(s,ie,1);return s}function np(s,o){for(var l=s?o.length:0,A=l-1;l--;){var T=o[l];if(l==A||T!==F){var F=T;is(T)?gu.call(s,T,1):Lh(s,T)}}return s}function $h(s,o){return s+mu(q0()*(o-s+1))}function Sy(s,o,l,A){for(var T=-1,F=pr(vu((o-s)/(l||1)),0),Q=oe(F);F--;)Q[A?F:++T]=s,s+=l;return Q}function Uh(s,o){var l="";if(!s||o<1||o>M)return l;do o%2&&(l+=s),o=mu(o/2),o&&(s+=s);while(o);return l}function Dt(s,o){return el(Np(s,o,si),s+"")}function My(s){return z0(Ga(s))}function Iy(s,o){var l=Ga(s);return Bu(l,ea(o,0,l.length))}function ko(s,o,l,A){if(!Zt(s))return s;o=Is(o,s);for(var T=-1,F=o.length,Q=F-1,X=s;X!=null&&++TT?0:T+o),l=l>T?T:l,l<0&&(l+=T),T=o>l?0:l-o>>>0,o>>>=0;for(var F=oe(T);++A>>1,Q=s[F];Q!==null&&!mi(Q)&&(l?Q<=o:Q=n){var he=o?null:jy(s);if(he)return ou(he);Q=!1,T=Ro,ie=new Zs}else ie=o?[]:X;e:for(;++A=A?s:Ni(s,o,l)}var hp=ym||function(s){return Ot.clearTimeout(s)};function lp(s,o){if(o)return s.slice();var l=s.length,A=R0?R0(l):new s.constructor(l);return s.copy(A),A}function kh(s){var o=new s.constructor(s.byteLength);return new du(o).set(new du(s)),o}function Ry(s,o){var l=o?kh(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function Ny(s){var o=new s.constructor(s.source,vt.exec(s));return o.lastIndex=s.lastIndex,o}function By(s){return qo?Ht(qo.call(s)):{}}function dp(s,o){var l=o?kh(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function pp(s,o){if(s!==o){var l=s!==t,A=s===null,T=s===s,F=mi(s),Q=o!==t,X=o===null,ie=o===o,he=mi(o);if(!X&&!he&&!F&&s>o||F&&Q&&ie&&!X&&!he||A&&Q&&ie||!l&&ie||!T)return 1;if(!A&&!F&&!he&&s=X)return ie;var he=l[A];return ie*(he=="desc"?-1:1)}}return s.index-o.index}function gp(s,o,l,A){for(var T=-1,F=s.length,Q=l.length,X=-1,ie=o.length,he=pr(F-Q,0),de=oe(ie+he),ge=!A;++X1?l[T-1]:t,Q=T>2?l[2]:t;for(F=s.length>3&&typeof F=="function"?(T--,F):t,Q&&Kr(l[0],l[1],Q)&&(F=T<3?t:F,T=1),o=Ht(o);++A-1?T[F?o[Q]:Q]:t}}function _p(s){return rs(function(o){var l=o.length,A=l,T=Ti.prototype.thru;for(s&&o.reverse();A--;){var F=o[A];if(typeof F!="function")throw new Oi(c);if(T&&!Q&&Ru(F)=="wrapper")var Q=new Ti([],!0)}for(A=Q?A:l;++A1&&Tt.reverse(),de&&ieX))return!1;var he=F.get(s),de=F.get(o);if(he&&de)return he==o&&de==s;var ge=-1,Ie=!0,Je=l&q?new Zs:t;for(F.set(s,o),F.set(o,s);++ge1?"& ":"")+o[A],o=o.join(l>2?", ":" "),s.replace(Ue,`{ /* [wrapped with `+o+`] */ -`)}function Xy(s){return gt(s)||na(s)||!!(B0&&s&&s[B0])}function rs(s,o){var l=typeof s;return o=o??M,!!o&&(l=="number"||l!="symbol"&&Ur.test(s))&&s>-1&&s%1==0&&s0){if(++o>=y)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Nu(s,o){var l=-1,A=s.length,T=A-1;for(o=o===t?A:o;++l1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,Kp(s,l)});function Vp(s){var o=$(s);return o.__chain__=!0,o}function u8(s,o){return o(s),s}function Bu(s,o){return o(s)}var f8=ts(function(s){var o=s.length,l=o?s[0]:0,A=this.__wrapped__,T=function(F){return Sh(F,s)};return o>1||this.__actions__.length||!(A instanceof Mt)||!rs(l)?this.thru(T):(A=A.slice(l,+l+(o?1:0)),A.__actions__.push({func:Bu,args:[T],thisArg:t}),new Ti(A,this.__chain__).thru(function(F){return o&&!F.length&&F.push(t),F}))});function h8(){return Vp(this)}function l8(){return new Ti(this.value(),this.__chain__)}function d8(){this.__values__===t&&(this.__values__=a1(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function p8(){return this}function g8(s){for(var o,l=this;l instanceof wu;){var A=Lp(l);A.__index__=0,A.__values__=t,o?T.__wrapped__=A:o=A;var T=A;l=l.__wrapped__}return T.__wrapped__=s,o}function b8(){var s=this.__wrapped__;if(s instanceof Mt){var o=s;return this.__actions__.length&&(o=new Mt(this)),o=o.reverse(),o.__actions__.push({func:Bu,args:[el],thisArg:t}),new Ti(o,this.__chain__)}return this.thru(el)}function v8(){return cp(this.__wrapped__,this.__actions__)}var m8=Mu(function(s,o,l){qt.call(s,l)?++s[l]:Zn(s,l,1)});function y8(s,o,l){var A=gt(s)?_0:uy;return l&&Kr(s,o,l)&&(o=t),A(s,nt(o,3))}function w8(s,o){var l=gt(s)?Ds:K0;return l(s,nt(o,3))}var _8=yp(Fp),D8=yp(zp);function E8(s,o){return xr($u(s,o),1)}function A8(s,o){return xr($u(s,o),S)}function x8(s,o,l){return l=l===t?1:yt(l),xr($u(s,o),l)}function Gp(s,o){var l=gt(s)?Pi:Ss;return l(s,nt(o,3))}function Jp(s,o){var l=gt(s)?H2:H0;return l(s,nt(o,3))}var S8=Mu(function(s,o,l){qt.call(s,l)?s[l].push(o):Zn(s,l,[o])});function M8(s,o,l,A){s=ii(s)?s:Va(s),l=l&&!A?yt(l):0;var T=s.length;return l<0&&(l=pr(T+l,0)),zu(s)?l<=T&&s.indexOf(o,l)>-1:!!T&&Na(s,o,l)>-1}var I8=Dt(function(s,o,l){var A=-1,T=typeof o=="function",F=ii(s)?oe(s.length):[];return Ss(s,function(Q){F[++A]=T?vr(o,Q,l):Fo(Q,o,l)}),F}),C8=Mu(function(s,o,l){Zn(s,l,o)});function $u(s,o){var l=gt(s)?Xt:Q0;return l(s,nt(o,3))}function P8(s,o,l,A){return s==null?[]:(gt(o)||(o=o==null?[]:[o]),l=A?t:l,gt(l)||(l=l==null?[]:[l]),tp(s,o,l))}var O8=Mu(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function T8(s,o,l){var A=gt(s)?dh:x0,T=arguments.length<3;return A(s,nt(o,4),l,T,Ss)}function R8(s,o,l){var A=gt(s)?K2:x0,T=arguments.length<3;return A(s,nt(o,4),l,T,H0)}function N8(s,o){var l=gt(s)?Ds:K0;return l(s,Lu(nt(o,3)))}function B8(s){var o=gt(s)?F0:My;return o(s)}function $8(s,o,l){(l?Kr(s,o,l):o===t)?o=1:o=yt(o);var A=gt(s)?ny:Iy;return A(s,o)}function U8(s){var o=gt(s)?sy:Py;return o(s)}function q8(s){if(s==null)return 0;if(ii(s))return zu(s)?$a(s):s.length;var o=Lr(s);return o==fe||o==Se?s.size:Th(s).length}function L8(s,o,l){var A=gt(s)?ph:Oy;return l&&Kr(s,o,l)&&(o=t),A(s,nt(o,3))}var F8=Dt(function(s,o){if(s==null)return[];var l=o.length;return l>1&&Kr(s,o[0],o[1])?o=[]:l>2&&Kr(o[0],o[1],o[2])&&(o=[o[0]]),tp(s,xr(o,1),[])}),Uu=wm||function(){return Ot.Date.now()};function z8(s,o){if(typeof o!="function")throw new Oi(c);return s=yt(s),function(){if(--s<1)return o.apply(this,arguments)}}function Wp(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,es(s,_,t,t,t,t,o)}function Yp(s,o){var l;if(typeof o!="function")throw new Oi(c);return s=yt(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var rl=Dt(function(s,o,l){var A=K;if(l.length){var T=As(l,Ha(rl));A|=j}return es(s,A,o,l,T)}),Qp=Dt(function(s,o,l){var A=K|Y;if(l.length){var T=As(l,Ha(Qp));A|=j}return es(o,A,s,l,T)});function Xp(s,o,l){o=l?t:o;var A=es(s,W,t,t,t,t,t,o);return A.placeholder=Xp.placeholder,A}function Zp(s,o,l){o=l?t:o;var A=es(s,B,t,t,t,t,t,o);return A.placeholder=Zp.placeholder,A}function e1(s,o,l){var A,T,F,Q,X,ie,he=0,de=!1,ge=!1,Ie=!0;if(typeof s!="function")throw new Oi(c);o=$i(o)||0,Zt(l)&&(de=!!l.leading,ge="maxWait"in l,F=ge?pr($i(l.maxWait)||0,o):F,Ie="trailing"in l?!!l.trailing:Ie);function Je(or){var an=A,ss=T;return A=T=t,he=or,Q=s.apply(ss,an),Q}function ot(or){return he=or,X=Ko(At,o),de?Je(or):Q}function wt(or){var an=or-ie,ss=or-he,y1=o-an;return ge?qr(y1,F-ss):y1}function ct(or){var an=or-ie,ss=or-he;return ie===t||an>=o||an<0||ge&&ss>=F}function At(){var or=Uu();if(ct(or))return Tt(or);X=Ko(At,wt(or))}function Tt(or){return X=t,Ie&&A?Je(or):(A=T=t,Q)}function yi(){X!==t&&fp(X),he=0,A=ie=T=X=t}function Vr(){return X===t?Q:Tt(Uu())}function wi(){var or=Uu(),an=ct(or);if(A=arguments,T=this,ie=or,an){if(X===t)return ot(ie);if(ge)return fp(X),X=Ko(At,o),Je(ie)}return X===t&&(X=Ko(At,o)),Q}return wi.cancel=yi,wi.flush=Vr,wi}var j8=Dt(function(s,o){return k0(s,1,o)}),k8=Dt(function(s,o,l){return k0(s,$i(o)||0,l)});function H8(s){return es(s,se)}function qu(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new Oi(c);var l=function(){var A=arguments,T=o?o.apply(this,A):A[0],F=l.cache;if(F.has(T))return F.get(T);var Q=s.apply(this,A);return l.cache=F.set(T,Q)||F,Q};return l.cache=new(qu.Cache||Xn),l}qu.Cache=Xn;function Lu(s){if(typeof s!="function")throw new Oi(c);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function K8(s){return Yp(2,s)}var V8=Ty(function(s,o){o=o.length==1&>(o[0])?Xt(o[0],bi(nt())):Xt(xr(o,1),bi(nt()));var l=o.length;return Dt(function(A){for(var T=-1,F=qr(A.length,l);++T=o}),na=J0(function(){return arguments}())?J0:function(s){return tr(s)&&qt.call(s,"callee")&&!N0.call(s,"callee")},gt=oe.isArray,ow=kr?bi(kr):gy;function ii(s){return s!=null&&Fu(s.length)&&!is(s)}function ar(s){return tr(s)&&ii(s)}function cw(s){return s===!0||s===!1||tr(s)&&Hr(s)==V}var Ps=Dm||pl,uw=tn?bi(tn):by;function fw(s){return tr(s)&&s.nodeType===1&&!Vo(s)}function hw(s){if(s==null)return!0;if(ii(s)&&(gt(s)||typeof s=="string"||typeof s.splice=="function"||Ps(s)||Ka(s)||na(s)))return!s.length;var o=Lr(s);if(o==fe||o==Se)return!s.size;if(Ho(s))return!Th(s).length;for(var l in s)if(qt.call(s,l))return!1;return!0}function lw(s,o){return zo(s,o)}function dw(s,o,l){l=typeof l=="function"?l:t;var A=l?l(s,o):t;return A===t?zo(s,o,t,l):!!A}function nl(s){if(!tr(s))return!1;var o=Hr(s);return o==H||o==D||typeof s.message=="string"&&typeof s.name=="string"&&!Vo(s)}function pw(s){return typeof s=="number"&&$0(s)}function is(s){if(!Zt(s))return!1;var o=Hr(s);return o==ne||o==ce||o==L||o==Ce}function r1(s){return typeof s=="number"&&s==yt(s)}function Fu(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=M}function Zt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function tr(s){return s!=null&&typeof s=="object"}var i1=Ci?bi(Ci):my;function gw(s,o){return s===o||Oh(s,o,Jh(o))}function bw(s,o,l){return l=typeof l=="function"?l:t,Oh(s,o,Jh(o),l)}function vw(s){return n1(s)&&s!=+s}function mw(s){if(t6(s))throw new dt(a);return W0(s)}function yw(s){return s===null}function ww(s){return s==null}function n1(s){return typeof s=="number"||tr(s)&&Hr(s)==ye}function Vo(s){if(!tr(s)||Hr(s)!=Te)return!1;var o=du(s);if(o===null)return!0;var l=qt.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&uu.call(l)==bm}var sl=wn?bi(wn):yy;function _w(s){return r1(s)&&s>=-M&&s<=M}var s1=Oo?bi(Oo):wy;function zu(s){return typeof s=="string"||!gt(s)&&tr(s)&&Hr(s)==me}function mi(s){return typeof s=="symbol"||tr(s)&&Hr(s)==Pe}var Ka=Ys?bi(Ys):_y;function Dw(s){return s===t}function Ew(s){return tr(s)&&Lr(s)==be}function Aw(s){return tr(s)&&Hr(s)==Oe}var xw=Ou(Rh),Sw=Ou(function(s,o){return s<=o});function a1(s){if(!s)return[];if(ii(s))return zu(s)?rn(s):ri(s);if(Ro&&s[Ro])return nm(s[Ro]());var o=Lr(s),l=o==fe?wh:o==Se?au:Va;return l(s)}function ns(s){if(!s)return s===0?s:0;if(s=$i(s),s===S||s===-S){var o=s<0?-1:1;return o*x}return s===s?s:0}function yt(s){var o=ns(s),l=o%1;return o===o?l?o-l:o:0}function o1(s){return s?ea(yt(s),0,b):0}function $i(s){if(typeof s=="number")return s;if(mi(s))return p;if(Zt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Zt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=S0(s);var l=Nr.test(s);return l||$r.test(s)?pt(s.slice(2),l?2:8):Rr.test(s)?p:+s}function c1(s){return Dn(s,ni(s))}function Mw(s){return s?ea(yt(s),-M,M):s===0?s:0}function $t(s){return s==null?"":vi(s)}var Iw=ja(function(s,o){if(Ho(o)||ii(o)){Dn(o,mr(o),s);return}for(var l in o)qt.call(o,l)&&qo(s,l,o[l])}),u1=ja(function(s,o){Dn(o,ni(o),s)}),ju=ja(function(s,o,l,A){Dn(o,ni(o),s,A)}),Cw=ja(function(s,o,l,A){Dn(o,mr(o),s,A)}),Pw=ts(Sh);function Ow(s,o){var l=za(s);return o==null?l:z0(l,o)}var Tw=Dt(function(s,o){s=Ht(s);var l=-1,A=o.length,T=A>2?o[2]:t;for(T&&Kr(o[0],o[1],T)&&(A=1);++l1),F}),Dn(s,Vh(s),l),A&&(l=Ri(l,w|O|C,ky));for(var T=o.length;T--;)qh(l,o[T]);return l});function Yw(s,o){return h1(s,Lu(nt(o)))}var Qw=ts(function(s,o){return s==null?{}:Ay(s,o)});function h1(s,o){if(s==null)return{};var l=Xt(Vh(s),function(A){return[A]});return o=nt(o),rp(s,l,function(A,T){return o(A,T[0])})}function Xw(s,o,l){o=Is(o,s);var A=-1,T=o.length;for(T||(T=1,s=t);++Ao){var A=s;s=o,o=A}if(l||s%1||o%1){var T=U0();return qr(s+T*(o-s+jt("1e-"+((T+"").length-1))),o)}return Bh(s,o)}var u5=ka(function(s,o,l){return o=o.toLowerCase(),s+(l?p1(o):o)});function p1(s){return cl($t(s).toLowerCase())}function g1(s){return s=$t(s),s&&s.replace(er,Z2).replace(fh,"")}function f5(s,o,l){s=$t(s),o=vi(o);var A=s.length;l=l===t?A:ea(yt(l),0,A);var T=l;return l-=o.length,l>=0&&s.slice(l,T)==o}function h5(s){return s=$t(s),s&&Xe.test(s)?s.replace(St,em):s}function l5(s){return s=$t(s),s&&ze.test(s)?s.replace(rt,"\\$&"):s}var d5=ka(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),p5=ka(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),g5=mp("toLowerCase");function b5(s,o,l){s=$t(s),o=yt(o);var A=o?$a(s):0;if(!o||A>=o)return s;var T=(o-A)/2;return Pu(vu(T),l)+s+Pu(bu(T),l)}function v5(s,o,l){s=$t(s),o=yt(o);var A=o?$a(s):0;return o&&A>>0,l?(s=$t(s),s&&(typeof o=="string"||o!=null&&!sl(o))&&(o=vi(o),!o&&Ba(s))?Cs(rn(s),0,l):s.split(o,l)):[]}var A5=ka(function(s,o,l){return s+(l?" ":"")+cl(o)});function x5(s,o,l){return s=$t(s),l=l==null?0:ea(yt(l),0,s.length),o=vi(o),s.slice(l,l+o.length)==o}function S5(s,o,l){var A=$.templateSettings;l&&Kr(s,o,l)&&(o=t),s=$t(s),o=ju({},o,A,xp);var T=ju({},o.imports,A.imports,xp),F=mr(T),Q=yh(T,F),X,ie,he=0,de=o.interpolate||Xr,ge="__p += '",Ie=_h((o.escape||Xr).source+"|"+de.source+"|"+(de===et?at:Xr).source+"|"+(o.evaluate||Xr).source+"|$","g"),Je="//# sourceURL="+(qt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++hh+"]")+` +`)}function Xy(s){return gt(s)||na(s)||!!($0&&s&&s[$0])}function is(s,o){var l=typeof s;return o=o??M,!!o&&(l=="number"||l!="symbol"&&Ur.test(s))&&s>-1&&s%1==0&&s0){if(++o>=y)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Bu(s,o){var l=-1,A=s.length,T=A-1;for(o=o===t?A:o;++l1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,Vp(s,l)});function Gp(s){var o=$(s);return o.__chain__=!0,o}function u8(s,o){return o(s),s}function $u(s,o){return o(s)}var f8=rs(function(s){var o=s.length,l=o?s[0]:0,A=this.__wrapped__,T=function(F){return Mh(F,s)};return o>1||this.__actions__.length||!(A instanceof Mt)||!is(l)?this.thru(T):(A=A.slice(l,+l+(o?1:0)),A.__actions__.push({func:$u,args:[T],thisArg:t}),new Ti(A,this.__chain__).thru(function(F){return o&&!F.length&&F.push(t),F}))});function h8(){return Gp(this)}function l8(){return new Ti(this.value(),this.__chain__)}function d8(){this.__values__===t&&(this.__values__=o1(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function p8(){return this}function g8(s){for(var o,l=this;l instanceof _u;){var A=Fp(l);A.__index__=0,A.__values__=t,o?T.__wrapped__=A:o=A;var T=A;l=l.__wrapped__}return T.__wrapped__=s,o}function b8(){var s=this.__wrapped__;if(s instanceof Mt){var o=s;return this.__actions__.length&&(o=new Mt(this)),o=o.reverse(),o.__actions__.push({func:$u,args:[tl],thisArg:t}),new Ti(o,this.__chain__)}return this.thru(tl)}function v8(){return up(this.__wrapped__,this.__actions__)}var m8=Iu(function(s,o,l){qt.call(s,l)?++s[l]:es(s,l,1)});function y8(s,o,l){var A=gt(s)?D0:uy;return l&&Kr(s,o,l)&&(o=t),A(s,nt(o,3))}function w8(s,o){var l=gt(s)?Ds:V0;return l(s,nt(o,3))}var _8=wp(zp),D8=wp(jp);function E8(s,o){return xr(Uu(s,o),1)}function A8(s,o){return xr(Uu(s,o),S)}function x8(s,o,l){return l=l===t?1:yt(l),xr(Uu(s,o),l)}function Jp(s,o){var l=gt(s)?Pi:Ss;return l(s,nt(o,3))}function Wp(s,o){var l=gt(s)?H2:K0;return l(s,nt(o,3))}var S8=Iu(function(s,o,l){qt.call(s,l)?s[l].push(o):es(s,l,[o])});function M8(s,o,l,A){s=ii(s)?s:Ga(s),l=l&&!A?yt(l):0;var T=s.length;return l<0&&(l=pr(T+l,0)),ju(s)?l<=T&&s.indexOf(o,l)>-1:!!T&&Ba(s,o,l)>-1}var I8=Dt(function(s,o,l){var A=-1,T=typeof o=="function",F=ii(s)?oe(s.length):[];return Ss(s,function(Q){F[++A]=T?vr(o,Q,l):zo(Q,o,l)}),F}),C8=Iu(function(s,o,l){es(s,l,o)});function Uu(s,o){var l=gt(s)?Xt:X0;return l(s,nt(o,3))}function P8(s,o,l,A){return s==null?[]:(gt(o)||(o=o==null?[]:[o]),l=A?t:l,gt(l)||(l=l==null?[]:[l]),rp(s,o,l))}var O8=Iu(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function T8(s,o,l){var A=gt(s)?ph:S0,T=arguments.length<3;return A(s,nt(o,4),l,T,Ss)}function R8(s,o,l){var A=gt(s)?K2:S0,T=arguments.length<3;return A(s,nt(o,4),l,T,K0)}function N8(s,o){var l=gt(s)?Ds:V0;return l(s,Fu(nt(o,3)))}function B8(s){var o=gt(s)?z0:My;return o(s)}function $8(s,o,l){(l?Kr(s,o,l):o===t)?o=1:o=yt(o);var A=gt(s)?ny:Iy;return A(s,o)}function U8(s){var o=gt(s)?sy:Py;return o(s)}function q8(s){if(s==null)return 0;if(ii(s))return ju(s)?Ua(s):s.length;var o=Lr(s);return o==fe||o==Se?s.size:Rh(s).length}function L8(s,o,l){var A=gt(s)?gh:Oy;return l&&Kr(s,o,l)&&(o=t),A(s,nt(o,3))}var F8=Dt(function(s,o){if(s==null)return[];var l=o.length;return l>1&&Kr(s,o[0],o[1])?o=[]:l>2&&Kr(o[0],o[1],o[2])&&(o=[o[0]]),rp(s,xr(o,1),[])}),qu=wm||function(){return Ot.Date.now()};function z8(s,o){if(typeof o!="function")throw new Oi(c);return s=yt(s),function(){if(--s<1)return o.apply(this,arguments)}}function Yp(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,ts(s,_,t,t,t,t,o)}function Qp(s,o){var l;if(typeof o!="function")throw new Oi(c);return s=yt(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var il=Dt(function(s,o,l){var A=K;if(l.length){var T=As(l,Ka(il));A|=j}return ts(s,A,o,l,T)}),Xp=Dt(function(s,o,l){var A=K|Y;if(l.length){var T=As(l,Ka(Xp));A|=j}return ts(o,A,s,l,T)});function Zp(s,o,l){o=l?t:o;var A=ts(s,W,t,t,t,t,t,o);return A.placeholder=Zp.placeholder,A}function e1(s,o,l){o=l?t:o;var A=ts(s,B,t,t,t,t,t,o);return A.placeholder=e1.placeholder,A}function t1(s,o,l){var A,T,F,Q,X,ie,he=0,de=!1,ge=!1,Ie=!0;if(typeof s!="function")throw new Oi(c);o=$i(o)||0,Zt(l)&&(de=!!l.leading,ge="maxWait"in l,F=ge?pr($i(l.maxWait)||0,o):F,Ie="trailing"in l?!!l.trailing:Ie);function Je(or){var an=A,as=T;return A=T=t,he=or,Q=s.apply(as,an),Q}function ot(or){return he=or,X=Vo(At,o),de?Je(or):Q}function wt(or){var an=or-ie,as=or-he,w1=o-an;return ge?qr(w1,F-as):w1}function ct(or){var an=or-ie,as=or-he;return ie===t||an>=o||an<0||ge&&as>=F}function At(){var or=qu();if(ct(or))return Tt(or);X=Vo(At,wt(or))}function Tt(or){return X=t,Ie&&A?Je(or):(A=T=t,Q)}function yi(){X!==t&&hp(X),he=0,A=ie=T=X=t}function Vr(){return X===t?Q:Tt(qu())}function wi(){var or=qu(),an=ct(or);if(A=arguments,T=this,ie=or,an){if(X===t)return ot(ie);if(ge)return hp(X),X=Vo(At,o),Je(ie)}return X===t&&(X=Vo(At,o)),Q}return wi.cancel=yi,wi.flush=Vr,wi}var j8=Dt(function(s,o){return H0(s,1,o)}),k8=Dt(function(s,o,l){return H0(s,$i(o)||0,l)});function H8(s){return ts(s,se)}function Lu(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new Oi(c);var l=function(){var A=arguments,T=o?o.apply(this,A):A[0],F=l.cache;if(F.has(T))return F.get(T);var Q=s.apply(this,A);return l.cache=F.set(T,Q)||F,Q};return l.cache=new(Lu.Cache||Zn),l}Lu.Cache=Zn;function Fu(s){if(typeof s!="function")throw new Oi(c);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function K8(s){return Qp(2,s)}var V8=Ty(function(s,o){o=o.length==1&>(o[0])?Xt(o[0],bi(nt())):Xt(xr(o,1),bi(nt()));var l=o.length;return Dt(function(A){for(var T=-1,F=qr(A.length,l);++T=o}),na=W0(function(){return arguments}())?W0:function(s){return tr(s)&&qt.call(s,"callee")&&!B0.call(s,"callee")},gt=oe.isArray,ow=kr?bi(kr):gy;function ii(s){return s!=null&&zu(s.length)&&!ns(s)}function ar(s){return tr(s)&&ii(s)}function cw(s){return s===!0||s===!1||tr(s)&&Hr(s)==V}var Ps=Dm||gl,uw=tn?bi(tn):by;function fw(s){return tr(s)&&s.nodeType===1&&!Go(s)}function hw(s){if(s==null)return!0;if(ii(s)&&(gt(s)||typeof s=="string"||typeof s.splice=="function"||Ps(s)||Va(s)||na(s)))return!s.length;var o=Lr(s);if(o==fe||o==Se)return!s.size;if(Ko(s))return!Rh(s).length;for(var l in s)if(qt.call(s,l))return!1;return!0}function lw(s,o){return jo(s,o)}function dw(s,o,l){l=typeof l=="function"?l:t;var A=l?l(s,o):t;return A===t?jo(s,o,t,l):!!A}function sl(s){if(!tr(s))return!1;var o=Hr(s);return o==H||o==D||typeof s.message=="string"&&typeof s.name=="string"&&!Go(s)}function pw(s){return typeof s=="number"&&U0(s)}function ns(s){if(!Zt(s))return!1;var o=Hr(s);return o==ne||o==ce||o==L||o==Ce}function i1(s){return typeof s=="number"&&s==yt(s)}function zu(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=M}function Zt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function tr(s){return s!=null&&typeof s=="object"}var n1=Ci?bi(Ci):my;function gw(s,o){return s===o||Th(s,o,Wh(o))}function bw(s,o,l){return l=typeof l=="function"?l:t,Th(s,o,Wh(o),l)}function vw(s){return s1(s)&&s!=+s}function mw(s){if(t6(s))throw new dt(a);return Y0(s)}function yw(s){return s===null}function ww(s){return s==null}function s1(s){return typeof s=="number"||tr(s)&&Hr(s)==ye}function Go(s){if(!tr(s)||Hr(s)!=Te)return!1;var o=pu(s);if(o===null)return!0;var l=qt.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&fu.call(l)==bm}var al=_n?bi(_n):yy;function _w(s){return i1(s)&&s>=-M&&s<=M}var a1=To?bi(To):wy;function ju(s){return typeof s=="string"||!gt(s)&&tr(s)&&Hr(s)==me}function mi(s){return typeof s=="symbol"||tr(s)&&Hr(s)==Pe}var Va=Ys?bi(Ys):_y;function Dw(s){return s===t}function Ew(s){return tr(s)&&Lr(s)==be}function Aw(s){return tr(s)&&Hr(s)==Oe}var xw=Tu(Nh),Sw=Tu(function(s,o){return s<=o});function o1(s){if(!s)return[];if(ii(s))return ju(s)?rn(s):ri(s);if(No&&s[No])return nm(s[No]());var o=Lr(s),l=o==fe?_h:o==Se?ou:Ga;return l(s)}function ss(s){if(!s)return s===0?s:0;if(s=$i(s),s===S||s===-S){var o=s<0?-1:1;return o*x}return s===s?s:0}function yt(s){var o=ss(s),l=o%1;return o===o?l?o-l:o:0}function c1(s){return s?ea(yt(s),0,b):0}function $i(s){if(typeof s=="number")return s;if(mi(s))return p;if(Zt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Zt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=M0(s);var l=Nr.test(s);return l||$r.test(s)?pt(s.slice(2),l?2:8):Rr.test(s)?p:+s}function u1(s){return En(s,ni(s))}function Mw(s){return s?ea(yt(s),-M,M):s===0?s:0}function $t(s){return s==null?"":vi(s)}var Iw=ka(function(s,o){if(Ko(o)||ii(o)){En(o,mr(o),s);return}for(var l in o)qt.call(o,l)&&Lo(s,l,o[l])}),f1=ka(function(s,o){En(o,ni(o),s)}),ku=ka(function(s,o,l,A){En(o,ni(o),s,A)}),Cw=ka(function(s,o,l,A){En(o,mr(o),s,A)}),Pw=rs(Mh);function Ow(s,o){var l=ja(s);return o==null?l:j0(l,o)}var Tw=Dt(function(s,o){s=Ht(s);var l=-1,A=o.length,T=A>2?o[2]:t;for(T&&Kr(o[0],o[1],T)&&(A=1);++l1),F}),En(s,Gh(s),l),A&&(l=Ri(l,w|O|I,ky));for(var T=o.length;T--;)Lh(l,o[T]);return l});function Yw(s,o){return l1(s,Fu(nt(o)))}var Qw=rs(function(s,o){return s==null?{}:Ay(s,o)});function l1(s,o){if(s==null)return{};var l=Xt(Gh(s),function(A){return[A]});return o=nt(o),ip(s,l,function(A,T){return o(A,T[0])})}function Xw(s,o,l){o=Is(o,s);var A=-1,T=o.length;for(T||(T=1,s=t);++Ao){var A=s;s=o,o=A}if(l||s%1||o%1){var T=q0();return qr(s+T*(o-s+jt("1e-"+((T+"").length-1))),o)}return $h(s,o)}var u5=Ha(function(s,o,l){return o=o.toLowerCase(),s+(l?g1(o):o)});function g1(s){return ul($t(s).toLowerCase())}function b1(s){return s=$t(s),s&&s.replace(er,Z2).replace(hh,"")}function f5(s,o,l){s=$t(s),o=vi(o);var A=s.length;l=l===t?A:ea(yt(l),0,A);var T=l;return l-=o.length,l>=0&&s.slice(l,T)==o}function h5(s){return s=$t(s),s&&Xe.test(s)?s.replace(St,em):s}function l5(s){return s=$t(s),s&&ze.test(s)?s.replace(rt,"\\$&"):s}var d5=Ha(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),p5=Ha(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),g5=yp("toLowerCase");function b5(s,o,l){s=$t(s),o=yt(o);var A=o?Ua(s):0;if(!o||A>=o)return s;var T=(o-A)/2;return Ou(mu(T),l)+s+Ou(vu(T),l)}function v5(s,o,l){s=$t(s),o=yt(o);var A=o?Ua(s):0;return o&&A>>0,l?(s=$t(s),s&&(typeof o=="string"||o!=null&&!al(o))&&(o=vi(o),!o&&$a(s))?Cs(rn(s),0,l):s.split(o,l)):[]}var A5=Ha(function(s,o,l){return s+(l?" ":"")+ul(o)});function x5(s,o,l){return s=$t(s),l=l==null?0:ea(yt(l),0,s.length),o=vi(o),s.slice(l,l+o.length)==o}function S5(s,o,l){var A=$.templateSettings;l&&Kr(s,o,l)&&(o=t),s=$t(s),o=ku({},o,A,Sp);var T=ku({},o.imports,A.imports,Sp),F=mr(T),Q=wh(T,F),X,ie,he=0,de=o.interpolate||Xr,ge="__p += '",Ie=Dh((o.escape||Xr).source+"|"+de.source+"|"+(de===et?at:Xr).source+"|"+(o.evaluate||Xr).source+"|$","g"),Je="//# sourceURL="+(qt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++lh+"]")+` `;s.replace(Ie,function(ct,At,Tt,yi,Vr,wi){return Tt||(Tt=yi),ge+=s.slice(he,wi).replace(Wi,tm),At&&(X=!0,ge+=`' + __e(`+At+`) + '`),Vr&&(ie=!0,ge+=`'; @@ -67,4 +67,4 @@ __p += '`),Tt&&(ge+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ge+`return __p -}`;var wt=v1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,nl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return S0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=M0(A,T),Q=I0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,P0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=M0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if(Ba(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-$a(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),sl(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=_h(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=ka(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),cl=mp("toUpperCase");function b1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var v1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return nl(l)?l:new dt(l)}}),B5=ts(function(s,o){return Pi(o,function(l){l=En(l),Zn(s,l,rl(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=mh(A,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(b)},_n(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:Bu,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=ou[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),_n(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(Fa,A)||(Fa[A]=[]),Fa[A].push({name:o,func:l})}}),Fa[Iu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,Ro&&($.prototype[Ro]=p8),$},Ua=lm();sr?((sr.exports=Ua)._=Ua,kt._=Ua):Ot._=Ua}).call(ac)})($d,$d.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,jb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,kb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zu=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&kb(r,t,e[t]);if(jb)for(var t of jb(e))PB.call(e,t)&&kb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function bn(r,e,t){var i;const n=fc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ca(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(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 td(r={},e={}){const t=Hb(r),i=Hb(e);return $d.exports.merge(t,i)}function Hb(r){var e,t,i,n;const a={};if(!_c(r))return a;for(const[c,f]of Object.entries(r)){const g=f0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=uc(c);a[O]=OB(Zu(Zu({},a[O]),f),{chains:rf(g,(e=a[O])==null?void 0:e.chains),methods:rf(d,(t=a[O])==null?void 0:t.methods),events:rf(m,(i=a[O])==null?void 0:i.events),rpcMap:Zu(Zu({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Kb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=f0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function rd(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 j2={},Ut=r=>j2[r],id=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Vb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Gb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Gb(r,t,e[t]);if(Vb)for(var t of Vb(e))LB.call(e,t)&&Gb(r,t,e[t]);return r},Wb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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||bn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("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(Ca(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 c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Wb(Jb({},c.sessionProperties||{}),{capabilities:Wb(Jb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}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 f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}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(Fs("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`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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||bn(`${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(mn.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||bn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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 vn(new Wn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=Ca(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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||bn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(mn.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||bn(e,this.namespace);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=Za,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(mn.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=fc(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||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Yb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Qb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Qb(r,t,e[t]);if(Yb)for(var t of Yb(e))ZB.call(e,t)&&Qb(r,t,e[t]);return r},nd=(r,e)=>YB(r,QB(e));class y0{constructor(e){this.events=new Fd,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:Uc(Zf({level:(e==null?void 0:e.logger)||Fb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new y0(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:ef({},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(c=>t(null,th(a,c))).catch(c=>t(c,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:Lt("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 c=Kb(this.session.namespaces);this.namespaces=td(this.namespaces,c),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 c=Kb(a.namespaces);this.namespaces=td(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)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===Za?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(Hn(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 m0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Fb,relayUrl:this.providerOpts.relayUrl||DB,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=>uc(t)))];id("client",this.client),id("events",this.events),id("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=td(this.namespaces,this.optionalNamespaces),c=nd(ef({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[Za]?this.rpcProviders[Za].updateNamespace(c):this.rpcProviders[Za]=new JB({namespace:c})}})}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&&Hn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=uc(n),f=rd(n)!==rd(a)?`${c}:${rd(a)}`:n;this.onChainChanged(f)}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=nd(ef({},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",nd(ef({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(mn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Za]}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(c=>uc(c)).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=uc(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(`${zb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${zb}/${e}`)}}const e$=y0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",Ud=["eth_sendTransaction","personal_sign"],s$=["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"],qd=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Xb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,Zb=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eo=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&Zb(r,t,e[t]);if(Xb)for(var t of Xb(e))h$.call(e,t)&&Zb(r,t,e[t]);return r},sd=(r,e)=>c$(r,u$(e));function Cf(r){return Number(r[0].split(":")[1])}function tf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Hn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||Ud,events:a||qd,rpcMap:eo({},e.length?{[Cf(e)]:f[Cf(e)]}:{})},d=a==null?void 0:a.filter(C=>!qd.includes(C)),m=i==null?void 0:i.filter(C=>!Ud.includes(C));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class w0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,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 w0;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}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(sd(eo({namespaces:eo({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(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,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(sd(eo({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(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",tf(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",sd(eo({},Lt("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",tf(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:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||Ud:[],g=n.length?(e==null?void 0:e.events)||qd:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(C=>this.formatChainId(C)),optionalChains:a.map(C=>this.formatChainId(C)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,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?Cf(this.rpc.chains):Cf(this.rpc.optionalChains),this.signer=await e$.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 _4(()=>import("./index-Dt2-TQyK.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(eo({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&&Hn(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&&Hn(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])||`${n$}?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 V$=w0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,qd as REQUIRED_EVENTS,Ud as REQUIRED_METHODS,w0 as default}; +}`;var wt=m1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,sl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return M0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=I0(A,T),Q=C0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,O0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=C0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if($a(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-Ua(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),al(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=Dh(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=Ha(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),ul=yp("toUpperCase");function v1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var m1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return sl(l)?l:new dt(l)}}),B5=rs(function(s,o){return Pi(o,function(l){l=An(l),es(s,l,il(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=yh(A,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(b)},Dn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:$u,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=cu[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),Dn(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(za,A)||(za[A]=[]),za[A].push({name:o,func:l})}}),za[Cu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,No&&($.prototype[No]=p8),$},qa=lm();sr?((sr.exports=qa)._=qa,kt._=qa):Ot._=qa}).call(oc)})(Ud,Ud.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,kb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,Hb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&Hb(r,t,e[t]);if(kb)for(var t of kb(e))PB.call(e,t)&&Hb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function vn(r,e,t){var i;const n=hc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Pa(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(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 rd(r={},e={}){const t=Kb(r),i=Kb(e);return Ud.exports.merge(t,i)}function Kb(r){var e,t,i,n;const a={};if(!Dc(r))return a;for(const[c,f]of Object.entries(r)){const g=h0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=fc(c);a[O]=OB(ef(ef({},a[O]),f),{chains:nf(g,(e=a[O])==null?void 0:e.chains),methods:nf(d,(t=a[O])==null?void 0:t.methods),events:nf(m,(i=a[O])==null?void 0:i.events),rpcMap:ef(ef({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Vb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=h0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function id(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 j2={},Ut=r=>j2[r],nd=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Gb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Jb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Jb(r,t,e[t]);if(Gb)for(var t of Gb(e))LB.call(e,t)&&Jb(r,t,e[t]);return r},Yb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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||vn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("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(Pa(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 c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Yb(Wb({},c.sessionProperties||{}),{capabilities:Yb(Wb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}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 f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}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(Fs("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`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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||vn(`${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(yn.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||vn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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 mn(new Yn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=Pa(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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||vn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(yn.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||vn(e,this.namespace);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=eo,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("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(yn.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=hc(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||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Qb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Xb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tf=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Xb(r,t,e[t]);if(Qb)for(var t of Qb(e))ZB.call(e,t)&&Xb(r,t,e[t]);return r},sd=(r,e)=>YB(r,QB(e));class w0{constructor(e){this.events=new zd,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:qc(eh({level:(e==null?void 0:e.logger)||zb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new w0(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:tf({},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(c=>t(null,rh(a,c))).catch(c=>t(c,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:Lt("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 c=Vb(this.session.namespaces);this.namespaces=rd(this.namespaces,c),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 c=Vb(a.namespaces);this.namespaces=rd(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)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===eo?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(Kn(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 y0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||zb,relayUrl:this.providerOpts.relayUrl||DB,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=>fc(t)))];nd("client",this.client),nd("events",this.events),nd("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=rd(this.namespaces,this.optionalNamespaces),c=sd(tf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[eo]?this.rpcProviders[eo].updateNamespace(c):this.rpcProviders[eo]=new JB({namespace:c})}})}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&&Kn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=fc(n),f=id(n)!==id(a)?`${c}:${id(a)}`:n;this.onChainChanged(f)}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=sd(tf({},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",sd(tf({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(yn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[eo]}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(c=>fc(c)).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=fc(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(`${jb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${jb}/${e}`)}}const e$=w0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",qd=["eth_sendTransaction","personal_sign"],s$=["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"],Ld=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Zb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,ev=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,to=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&ev(r,t,e[t]);if(Zb)for(var t of Zb(e))h$.call(e,t)&&ev(r,t,e[t]);return r},ad=(r,e)=>c$(r,u$(e));function Pf(r){return Number(r[0].split(":")[1])}function rf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Kn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||qd,events:a||Ld,rpcMap:to({},e.length?{[Pf(e)]:f[Pf(e)]}:{})},d=a==null?void 0:a.filter(I=>!Ld.includes(I)),m=i==null?void 0:i.filter(I=>!qd.includes(I));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class _0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,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 _0;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}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(ad(to({namespaces:to({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(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,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(ad(to({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(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",rf(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",ad(to({},Lt("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",rf(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:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||qd:[],g=n.length?(e==null?void 0:e.events)||Ld:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,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?Pf(this.rpc.chains):Pf(this.rpc.optionalChains),this.signer=await e$.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 _4(()=>import("./index-Do02Tqa-.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(to({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&&Kn(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&&Kn(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])||`${n$}?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 V$=_0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,Ld as REQUIRED_EVENTS,qd as REQUIRED_METHODS,_0 as default}; diff --git a/buddybook/assets/inherits_browser-B8fZ3Rhe.js b/buddybook/assets/inherits_browser-c-WsrrNw.js similarity index 85% rename from buddybook/assets/inherits_browser-B8fZ3Rhe.js rename to buddybook/assets/inherits_browser-c-WsrrNw.js index c9285ba..b9d720c 100644 --- a/buddybook/assets/inherits_browser-B8fZ3Rhe.js +++ b/buddybook/assets/inherits_browser-c-WsrrNw.js @@ -1 +1 @@ -import{j as n,v as s}from"./index-BpI4vT-j.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 f=r.exports;export{f as i,a as r}; +import{g as n,w as s}from"./index-tpwTCyHS.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 f=r.exports;export{f as i,a as r}; diff --git a/buddybook/index.html b/buddybook/index.html index 0a1e1ec..6b03c31 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -23,7 +23,7 @@ browser: true }; - + diff --git a/flush-notes/404.html b/flush-notes/404.html index 169d0bd..67e3d43 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/vaotwJXvn9hargiuIvufd/_buildManifest.js b/flush-notes/_next/static/tXlBvgvDpOl5c8dk_ItTp/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/vaotwJXvn9hargiuIvufd/_buildManifest.js rename to flush-notes/_next/static/tXlBvgvDpOl5c8dk_ItTp/_buildManifest.js diff --git a/flush-notes/_next/static/vaotwJXvn9hargiuIvufd/_ssgManifest.js b/flush-notes/_next/static/tXlBvgvDpOl5c8dk_ItTp/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/vaotwJXvn9hargiuIvufd/_ssgManifest.js rename to flush-notes/_next/static/tXlBvgvDpOl5c8dk_ItTp/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index 7b76855..eae0cdb 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 4c15a7d..a791044 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:["vaotwJXvn9hargiuIvufd",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["tXlBvgvDpOl5c8dk_ItTp",[[["",{"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 e0d6ed0..67e4440 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 b25c1c1..735497d 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:["vaotwJXvn9hargiuIvufd",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["tXlBvgvDpOl5c8dk_ItTp",[[["",{"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,[],""]