From 23b8aa24c22a9dcadee77ce1e0906fb032fe9683 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Thu, 8 Feb 2024 13:21:12 -0800 Subject: [PATCH 1/9] hotfix: bump curve-dalek dep that breaks builds https://github.com/dalek-cryptography/curve25519-dalek/pull/619 via https://github.com/mcginty/snow/blob/main/Cargo.toml#L48 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff957a1..392e73fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1303,9 +1303,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", From ea6dd6a1292bbe6dfd1acd2d258e8ef36e7be519 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Thu, 8 Feb 2024 16:46:48 -0800 Subject: [PATCH 2/9] explicitly specify dalek dep in Cargo.toml --- Cargo.lock | 1 + kinode/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 392e73fd..732d6700 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3115,6 +3115,7 @@ dependencies = [ "chrono", "clap", "crossterm", + "curve25519-dalek", "dashmap", "digest 0.10.7", "elliptic-curve", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index c2e50c04..7dbf00d9 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -37,6 +37,7 @@ chacha20poly1305 = "0.10.1" chrono = "0.4.31" clap = { version = "4.4", features = ["derive"] } crossterm = { version = "0.26.1", features = ["event-stream", "bracketed-paste"] } +curve25519-dalek = "^4.1.2" dashmap = "5.5.3" digest = "0.10" elliptic-curve = { version = "0.13.8", features = ["ecdh"] } From b5b99a3b554b94907bc484df6a9be6a6512b64f8 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 9 Feb 2024 19:47:27 -0300 Subject: [PATCH 3/9] vfs: hotfix remove bug --- kinode/src/vfs.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kinode/src/vfs.rs b/kinode/src/vfs.rs index 731f593e..1c40ec53 100644 --- a/kinode/src/vfs.rs +++ b/kinode/src/vfs.rs @@ -361,7 +361,8 @@ async fn handle_request( ) } VfsAction::RemoveFile => { - fs::remove_file(path).await?; + fs::remove_file(&path).await?; + open_files.remove(&path); (serde_json::to_vec(&VfsResponse::Ok).unwrap(), None) } VfsAction::RemoveDir => { From 190a077989ecb19f694a5334122a7fd1d0ea43a9 Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Sat, 10 Feb 2024 09:32:10 +0000 Subject: [PATCH 4/9] Fix app detail page when no app found --- .../{index-pkTLhk2L.js => index-A09g5OKk.js} | 18 +++++++++--------- kinode/packages/app_store/pkg/ui/index.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) rename kinode/packages/app_store/pkg/ui/assets/{index-pkTLhk2L.js => index-A09g5OKk.js} (89%) diff --git a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js b/kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js similarity index 89% rename from kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js rename to kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js index af5883ec..e4eb126c 100644 --- a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js +++ b/kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js @@ -22,7 +22,7 @@ var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(b,M){var R=b.length;b.push(M);e:for(;0>>1,h=b[S];if(0>>1;Si(y,R))Di(U,y)?(b[S]=U,b[D]=R,S=D):(b[S]=y,b[te]=R,S=te);else if(Di(U,R))b[S]=U,b[D]=R,S=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,m=3,v=!1,p=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!p)if(r(a)!==null)p=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){p=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=m;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!G());){var S=d.callback;if(typeof S=="function"){d.callback=null,m=d.priorityLevel;var h=S(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,m=R,v=!1}}var j=!1,$=null,H=-1,ie=5,X=-1;function G(){return!(t.unstable_now()-Xb||125S?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-S))):(b.sortIndex=h,e(a,b),p||v||(p=!0,A(B))),b},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(b){var M=m;return function(){var R=m;m=M;try{return b.apply(this,arguments)}finally{m=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** + */(function(t){function e(b,M){var R=b.length;b.push(M);e:for(;0>>1,h=b[S];if(0>>1;Si(y,R))Di(U,y)?(b[S]=U,b[D]=R,S=D):(b[S]=y,b[te]=R,S=te);else if(Di(U,R))b[S]=U,b[D]=R,S=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,p=3,v=!1,g=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!g)if(r(a)!==null)g=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){g=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=p;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!G());){var S=d.callback;if(typeof S=="function"){d.callback=null,p=d.priorityLevel;var h=S(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,p=R,v=!1}}var j=!1,$=null,H=-1,ie=5,X=-1;function G(){return!(t.unstable_now()-Xb||125S?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-S))):(b.sortIndex=h,e(a,b),g||v||(g=!0,A(B))),b},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(b){var M=p;return function(){var R=p;p=M;try{return b.apply(this,arguments)}finally{p=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** * @license React * react-dom.production.min.js * @@ -34,10 +34,10 @@ var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,config `+dc+t}var hc=!1;function pc(t,e){if(!t||hc)return"";hc=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var i=u.stack.split(` `),o=n.stack.split(` `),s=i.length-1,l=o.length-1;1<=s&&0<=l&&i[s]!==o[l];)l--;for(;1<=s&&0<=l;s--,l--)if(i[s]!==o[l]){if(s!==1||l!==1)do if(s--,l--,0>l||i[s]!==o[l]){var a=` -`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={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},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({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 xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var X=m(E,$,_[H],O);if(X===null){$===null&&($=ie);break}t&&$&&X.alternate===null&&e(E,$),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(G){return e(E,G)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,X=_.next();$!==null&&!X.done;H++,X=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var G=m(E,$,X.value,O);if(G===null){$===null&&($=ie);break}t&&$&&G.alternate===null&&e(E,$),w=o(G,w,H),j===null?B=G:j.sibling=G,j=G,$=ie}if(X.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!X.done;H++,X=_.next())X=d(E,X.value,O),X!==null&&(w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return nt&&bi(E,H),B}for($=n(E,$);!X.done;H++,X=_.next())X=v($,E,H,X.value,O),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return t&&$.forEach(function(J){return e(E,J)}),nt&&bi(E,H),B}function k(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,k(E,w,j(_._payload),O)}if(ds(_))return p(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return k}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={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},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({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 xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var X=p(E,$,_[H],O);if(X===null){$===null&&($=ie);break}t&&$&&X.alternate===null&&e(E,$),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(G){return e(E,G)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,X=_.next();$!==null&&!X.done;H++,X=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var G=p(E,$,X.value,O);if(G===null){$===null&&($=ie);break}t&&$&&G.alternate===null&&e(E,$),w=o(G,w,H),j===null?B=G:j.sibling=G,j=G,$=ie}if(X.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!X.done;H++,X=_.next())X=d(E,X.value,O),X!==null&&(w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return nt&&bi(E,H),B}for($=n(E,$);!X.done;H++,X=_.next())X=v($,E,H,X.value,O),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return t&&$.forEach(function(J){return e(E,J)}),nt&&bi(E,H),B}function k(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,k(E,w,j(_._payload),O)}if(ds(_))return g(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return k}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,m=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)m=d,d=v;for(;;){if(d===t)break t;if(m===r&&++u===i&&(l=s),m===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var x=p.memoizedProps,k=p.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),k);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return p=F0,F0=!1,p}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** +`+o.stack}return{value:t,source:e,stack:i,digest:null}}function Tc(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Hf(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var sE=typeof WeakMap=="function"?WeakMap:Map;function xv(t,e,r){r=Pn(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Wa||(Wa=!0,Zf=n),Hf(t,e)},r}function Av(t,e,r){r=Pn(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){Hf(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){Hf(t,e),typeof n!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),r}function R0(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new sE;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=EE.bind(null,t,e,r),e.then(t,t))}function T0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function O0(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Pn(-1,1),e.tag=2,ci(r,e,1))),r.lanes|=1),t)}var lE=Dn.ReactCurrentOwner,Zt=!1;function qt(t,e,r,n){e.child=t===null?ev(e,null,r,n):Po(e,t.child,r,n)}function L0(t,e,r,n,i){r=r.render;var o=e.ref;return Eo(e,i),n=nh(t,e,r,n,o,i),r=ih(),t!==null&&!Zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(nt&&r&&Wd(e),e.flags|=1,qt(t,e,n,i),e.child)}function B0(t,e,r,n,i){if(t===null){var o=r.type;return typeof o=="function"&&!ph(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=o,bv(t,e,o,n,i)):(t=fa(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(r=r.compare,r=r!==null?r:Us,r(s,n)&&t.ref===e.ref)return Tn(t,e,i)}return e.flags|=1,t=hi(o,n),t.ref=e.ref,t.return=e,e.child=t}function bv(t,e,r,n,i){if(t!==null){var o=t.memoizedProps;if(Us(o,n)&&t.ref===e.ref)if(Zt=!1,e.pendingProps=n=o,(t.lanes&i)!==0)t.flags&131072&&(Zt=!0);else return e.lanes=t.lanes,Tn(t,e,i)}return qf(t,e,r,n,i)}function _v(t,e,r){var n=e.pendingProps,i=n.children,o=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(uo,lr),lr|=r;else{if(!(r&1073741824))return t=o!==null?o.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Qe(uo,lr),lr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,Qe(uo,lr),lr|=n}else o!==null?(n=o.baseLanes|r,e.memoizedState=null):n=r,Qe(uo,lr),lr|=n;return qt(t,e,i,r),e.child}function Sv(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function qf(t,e,r,n,i){var o=tr(r)?Ri:zt.current;return o=ko(e,o),Eo(e,i),r=nh(t,e,r,n,o,i),n=ih(),t!==null&&!Zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(nt&&n&&Wd(e),e.flags|=1,qt(t,e,r,i),e.child)}function D0(t,e,r,n,i){if(tr(r)){var o=!0;La(e)}else o=!1;if(Eo(e,i),e.stateNode===null)aa(t,e),Xg(e,r,n),$f(e,r,n,i),n=!0;else if(t===null){var s=e.stateNode,l=e.memoizedProps;s.props=l;var a=s.context,u=r.contextType;typeof u=="object"&&u!==null?u=Nr(u):(u=tr(r)?Ri:zt.current,u=ko(e,u));var c=r.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==n||a!==u)&&P0(e,s,n,u),Yn=!1;var p=e.memoizedState;s.state=p,Fa(e,n,s,i),a=e.memoizedState,l!==n||p!==a||er.current||Yn?(typeof c=="function"&&(zf(e,r,c,n),a=e.memoizedState),(l=Yn||N0(e,r,l,n,p,a,u))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=a),s.props=n,s.state=a,s.context=u,n=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{s=e.stateNode,Jg(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:jr(e.type,l),s.props=u,d=e.pendingProps,p=s.context,a=r.contextType,typeof a=="object"&&a!==null?a=Nr(a):(a=tr(r)?Ri:zt.current,a=ko(e,a));var v=r.getDerivedStateFromProps;(c=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==d||p!==a)&&P0(e,s,n,a),Yn=!1,p=e.memoizedState,s.state=p,Fa(e,n,s,i);var g=e.memoizedState;l!==d||p!==g||er.current||Yn?(typeof v=="function"&&(zf(e,r,v,n),g=e.memoizedState),(u=Yn||N0(e,r,u,n,p,g,a)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(n,g,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(n,g,a)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=g),s.props=n,s.state=g,s.context=a,n=u):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),n=!1)}return Wf(t,e,r,n,o,i)}function Wf(t,e,r,n,i,o){Sv(t,e);var s=(e.flags&128)!==0;if(!n&&!s)return i&&A0(e,r,!1),Tn(t,e,o);n=e.stateNode,lE.current=e;var l=s&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&s?(e.child=Po(e,t.child,null,o),e.child=Po(e,null,l,o)):qt(t,e,l,o),e.memoizedState=n.state,i&&A0(e,r,!0),e.child}function kv(t){var e=t.stateNode;e.pendingContext?x0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&x0(t,e.context,!1),Zd(t,e.containerInfo)}function j0(t,e,r,n,i){return No(),Vd(i),e.flags|=256,qt(t,e,r,n),e.child}var Gf={dehydrated:null,treeContext:null,retryLane:0};function Vf(t){return{baseLanes:t,cachePool:null,transitions:null}}function Nv(t,e,r){var n=e.pendingProps,i=at.current,o=!1,s=(e.flags&128)!==0,l;if((l=s)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Qe(at,i&1),t===null)return Uf(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=n.children,t=n.fallback,o?(n=e.mode,o=e.child,s={mode:"hidden",children:s},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=bu(s,n,0,null),t=Mi(t,n,r,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Vf(r),e.memoizedState=Gf,t):lh(e,s));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return aE(t,e,s,n,l,i,r);if(o){o=n.fallback,s=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(s&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=a,e.deletions=null):(n=hi(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=hi(l,o):(o=Mi(o,s,r,null),o.flags|=2),o.return=e,n.return=e,n.sibling=o,e.child=n,n=o,o=e.child,s=t.child.memoizedState,s=s===null?Vf(r):{baseLanes:s.baseLanes|r,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~r,e.memoizedState=Gf,n}return o=t.child,t=o.sibling,n=hi(o,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function lh(t,e){return e=bu({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Dl(t,e,r,n){return n!==null&&Vd(n),Po(e,t.child,null,r),t=lh(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function aE(t,e,r,n,i,o,s){if(r)return e.flags&256?(e.flags&=-257,n=Tc(Error(q(422))),Dl(t,e,s,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=n.fallback,i=e.mode,n=bu({mode:"visible",children:n.children},i,0,null),o=Mi(o,i,s,null),o.flags|=2,n.return=e,o.return=e,n.sibling=o,e.child=n,e.mode&1&&Po(e,t.child,null,s),e.child.memoizedState=Vf(s),e.memoizedState=Gf,o);if(!(e.mode&1))return Dl(t,e,s,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,o=Error(q(419)),n=Tc(o,n,void 0),Dl(t,e,s,n)}if(l=(s&t.childLanes)!==0,Zt||l){if(n=Nt,n!==null){switch(s&-s){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Rn(t,i),Gr(n,t,i,-1))}return hh(),n=Tc(Error(q(421))),Dl(t,e,s,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=xE.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,cr=ui(i.nextSibling),dr=e,nt=!0,zr=null,t!==null&&(br[_r++]=Sn,br[_r++]=kn,br[_r++]=Ti,Sn=t.id,kn=t.overflow,Ti=e),e=lh(e,n.children),e.flags|=4096,e)}function U0(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Ff(t.return,e,r)}function Oc(t,e,r,n,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=i)}function Pv(t,e,r){var n=e.pendingProps,i=n.revealOrder,o=n.tail;if(qt(t,e,n.children,r),n=at.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&U0(t,r,e);else if(t.tag===19)U0(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Qe(at,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&za(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),Oc(e,!1,i,r,o);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&za(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}Oc(e,!0,r,null,o);break;case"together":Oc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function aa(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Tn(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Li|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(q(153));if(e.child!==null){for(t=e.child,r=hi(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=hi(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function uE(t,e,r){switch(e.tag){case 3:kv(e),No();break;case 5:tv(e);break;case 1:tr(e.type)&&La(e);break;case 4:Zd(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Qe(ja,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Qe(at,at.current&1),e.flags|=128,null):r&e.child.childLanes?Nv(t,e,r):(Qe(at,at.current&1),t=Tn(t,e,r),t!==null?t.sibling:null);Qe(at,at.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return Pv(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Qe(at,at.current),n)break;return null;case 22:case 23:return e.lanes=0,_v(t,e,r)}return Tn(t,e,r)}var Cv,Kf,Mv,Iv;Cv=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Kf=function(){};Mv=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,Pi(an.current);var o=null;switch(r){case"input":i=gf(t,i),n=gf(t,n),o=[];break;case"select":i=ft({},i,{value:void 0}),n=ft({},n,{value:void 0}),o=[];break;case"textarea":i=wf(t,i),n=wf(t,n),o=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Ta)}xf(r,n);var s;r=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(s in l)l.hasOwnProperty(s)&&(r||(r={}),r[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Rs.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var a=n[u];if(l=i!=null?i[u]:void 0,n.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(r||(r={}),r[s]="");for(s in a)a.hasOwnProperty(s)&&l[s]!==a[s]&&(r||(r={}),r[s]=a[s])}else r||(o||(o=[]),o.push(u,r)),r=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(o=o||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Rs.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&et("scroll",t),o||l===a||(o=[])):(o=o||[]).push(u,a))}r&&(o=o||[]).push("style",r);var u=o;(e.updateQueue=u)&&(e.flags|=4)}};Iv=function(t,e,r,n){r!==n&&(e.flags|=4)};function rs(t,e){if(!nt)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Bt(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function cE(t,e,r){var n=e.pendingProps;switch(Gd(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(e),null;case 1:return tr(e.type)&&Oa(),Bt(e),null;case 3:return n=e.stateNode,Co(),tt(er),tt(zt),th(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Ll(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,zr!==null&&(rd(zr),zr=null))),Kf(t,e),Bt(e),null;case 5:eh(e);var i=Pi(qs.current);if(r=e.type,t!==null&&e.stateNode!=null)Mv(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(q(166));return Bt(e),null}if(t=Pi(an.current),Ll(e)){n=e.stateNode,r=e.type;var o=e.memoizedProps;switch(n[nn]=e,n[$s]=o,t=(e.mode&1)!==0,r){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,p=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)p=d,d=v;for(;;){if(d===t)break t;if(p===r&&++u===i&&(l=s),p===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,k=g.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),k);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return g=F0,F0=!1,g}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** * @remix-run/router v1.14.2 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let k=c(),E=k==null?null:k-u;u=k,a&&a({action:l,location:x.location,delta:E})}function m(k,E){l=ii.Push;let w=nd(x.location,k,E);r&&r(w,k),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(k,E){l=ii.Replace;let w=nd(x.location,k,E);r&&r(w,k),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function p(k){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof k=="string"?k:Qv(k);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=k,()=>{i.removeEventListener(Y0,d),a=null}},createHref(k){return e(i,k)},createURL:p,encodeLocation(k){let E=p(k);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:m,replace:v,go(k){return s.go(k)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:m,isOptional:v}=c;if(m==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const p=l[d];return v&&!p?u[m]=void 0:u[m]=KE(p||"",m),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),d-=1;i.pathname=m.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** + */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let k=c(),E=k==null?null:k-u;u=k,a&&a({action:l,location:x.location,delta:E})}function p(k,E){l=ii.Push;let w=nd(x.location,k,E);r&&r(w,k),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(k,E){l=ii.Replace;let w=nd(x.location,k,E);r&&r(w,k),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function g(k){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof k=="string"?k:Qv(k);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=k,()=>{i.removeEventListener(Y0,d),a=null}},createHref(k){return e(i,k)},createURL:g,encodeLocation(k){let E=g(k);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:v,go(k){return s.go(k)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:p,isOptional:v}=c;if(p==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[d];return v&&!g?u[p]=void 0:u[p]=KE(g||"",p),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** * React Router v6.21.3 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let k=typeof e=="string"?Ho(e):e;a==="/"||(d=k.pathname)!=null&&d.startsWith(a)||_t(!1),c=k}else c=u;let m=c.pathname||"/",v=a==="/"?m:m.slice(a.length)||"/",p=OE(t,{pathname:v}),x=px(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,m)=>{let v,p=!1,x=null,k=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&m===0?(Ex("route-fallback",!1),p=!0,k=null):u===m&&(p=!0,k=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,m+1)),w=()=>{let _;return v?_=x:p?_=k:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:m="",state:v=null,key:p="default"}=n,x=L.useMemo(()=>{let k=Xv(c,a);return k==null?null:{location:{pathname:k,search:d,hash:m,state:v,key:p},navigationType:i}},[a,c,d,m,v,p,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** + */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let k=typeof e=="string"?Ho(e):e;a==="/"||(d=k.pathname)!=null&&d.startsWith(a)||_t(!1),c=k}else c=u;let p=c.pathname||"/",v=a==="/"?p:p.slice(a.length)||"/",g=OE(t,{pathname:v}),x=px(g&&g.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,p)=>{let v,g=!1,x=null,k=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&p===0?(Ex("route-fallback",!1),g=!0,k=null):u===p&&(g=!0,k=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,p+1)),w=()=>{let _;return v?_=x:g?_=k:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:p="",state:v=null,key:g="default"}=n,x=L.useMemo(()=>{let k=Xv(c,a);return k==null?null:{location:{pathname:k,search:d,hash:p,state:v,key:g},navigationType:i}},[a,c,d,p,v,g,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** * React Router DOM v6.21.3 * * Copyright (c) Remix Software Inc. @@ -64,14 +64,14 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var g=function(){};g.prototype=f.prototype,C.prototype=new g,C.prototype.constructor=C}function o(C,f,g){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(C||0,f||10,g||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,g){return f.cmp(g)>0?f:g},o.min=function(f,g){return f.cmp(g)<0?f:g},o.prototype._init=function(f,g,A){if(typeof f=="number")return this._initNumber(f,g,A);if(typeof f=="object")return this._initArray(f,g,A);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var g=C.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+C)}function a(C,f,g){var A=l(C,g);return g-1>=f&&(A|=l(C,g-1)<<4),A}o.prototype._parseHex=function(f,g,A){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var N=0;N=g;N-=2)R=a(f,g,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var S=f.length-g;for(N=S%2===0?g+1:g;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,g,A){for(var N=0,b=0,M=Math.min(C.length,g),R=f;R=49?b=S-49+10:S>=17?b=S-17+10:b=S,n(S>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){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"],v=[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];o.prototype.toString=function(f,g){f=f||10,g=g|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=m[6-S.length]+S+A:A=S+A}for(b!==0&&(A=b.toString(16)+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=p[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=m[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,g){return this.toArrayLike(s,f,g)}),o.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var x=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};o.prototype.toArrayLike=function(f,g,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=g==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,g){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var g=f,A=0;return g>=4096&&(A+=13,g>>>=13),g>=64&&(A+=7,g>>>=7),g>=8&&(A+=4,g>>>=4),g>=2&&(A+=2,g>>>=2),A+g},o.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,A=0;return g&8191||(A+=13,g>>>=13),g&127||(A+=7,g>>>=7),g&15||(A+=4,g>>>=4),g&3||(A+=2,g>>>=2),g&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function k(C){for(var f=new Array(C.bitLength()),g=0;g>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var g,A;this.length>f.length?(g=this,A=f):(g=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,A=f%26;this._expand(g),A>0&&g--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),g?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=g&67108863;for(;M!==0&&R>26,this.words[R]=g&67108863;if(M===0&&R>>26,te=S&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}g.words[h]=te|0,S=P|0}return S!==0?g.words[h]=S|0:g.length--,g._strip()}var w=function(f,g,A){var N=f.words,b=g.words,M=A.words,R=0,S,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,Y=oe&8191,K=oe>>>13,Je=N[3]|0,Q=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^g.negative,A.length=19,S=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,S=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),S=S+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,S=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(K,Ce)|0,P=Math.imul(K,We),S=S+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,S=S+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,S=Math.imul(Q,Ce),h=Math.imul(Q,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),S=S+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(K,Be)|0,P=P+Math.imul(K,Ge)|0,S=S+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,S=S+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,S=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),S=S+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,S=S+Math.imul(Y,De)|0,h=h+Math.imul(Y,ne)|0,h=h+Math.imul(K,De)|0,P=P+Math.imul(K,ne)|0,S=S+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,S=S+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,S=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),S=S+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,S=S+Math.imul(Q,De)|0,h=h+Math.imul(Q,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,S=S+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(K,ge)|0,P=P+Math.imul(K,de)|0,S=S+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,S=S+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,S=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),S=S+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,S=S+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,S=S+Math.imul(Q,ge)|0,h=h+Math.imul(Q,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,S=S+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(K,be)|0,P=P+Math.imul(K,_e)|0,S=S+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,S=S+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,S=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),S=S+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,S=S+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,S=S+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,S=S+Math.imul(Q,be)|0,h=h+Math.imul(Q,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,S=S+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(K,Me)|0,P=P+Math.imul(K,je)|0,S=S+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,S=S+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,S=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),S=S+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,S=S+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,S=S+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,S=S+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,S=S+Math.imul(Q,Me)|0,h=h+Math.imul(Q,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,S=S+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(K,Ve)|0,P=P+Math.imul(K,Ke)|0,S=S+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,S=S+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,S=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),S=S+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,S=S+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,S=S+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,S=S+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,S=S+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,S=S+Math.imul(Q,Ve)|0,h=h+Math.imul(Q,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,S=S+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ue)|0,S=S+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,S=S+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,S=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),S=S+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,S=S+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,S=S+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,S=S+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,S=S+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,S=S+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,S=S+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(K,ke)|0,P=P+Math.imul(K,Ye)|0,S=S+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,S=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),S=S+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,S=S+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,S=S+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,S=S+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,S=S+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,S=S+Math.imul(Q,ke)|0,h=h+Math.imul(Q,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,S=S+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(K,Xe)|0,P=P+Math.imul(K,Ze)|0;var nc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,S=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),S=S+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,S=S+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,S=S+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,S=S+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,S=S+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,S=S+Math.imul(Q,Xe)|0,h=h+Math.imul(Q,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,S=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),S=S+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,S=S+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,S=S+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,S=S+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,S=S+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,S=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),S=S+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,S=S+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,S=S+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,S=S+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,S=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),S=S+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,S=S+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,S=S+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,S=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),S=S+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,S=S+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,S=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),S=S+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,S=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+S|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,g){g.negative=f.negative^C.negative,g.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}g.words[b]=R,A=M,M=N}return A!==0?g.words[b]=A:g.length--,g._strip()}function O(C,f,g){return _(C,f,g)}o.prototype.mulTo=function(f,g){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,g):N<63?A=E(this,f,g):N<1024?A=_(this,f,g):A=O(this,f,g),A},o.prototype.mul=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},o.prototype.mulf=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),O(this,f,g)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),g?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var g=k(f);if(g.length===0)return new o(1);for(var A=this,N=0;N=0);var g=f%26,A=(f-g)/26,N=67108863>>>26-g<<26-g,b;if(g!==0){var M=0;for(b=0;b>>26-g}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;g?N=(g-g%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return S&&P!==0&&(S.words[S.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,g,A){return n(this.negative===0),this.iushrn(f,g,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,A=(f-g)/26,N=1<=0);var g=f%26,A=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(g!==0&&A++,this.length=Math.min(A,this.length),g!==0){var N=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(S/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,g){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var S=N.length-b.length,h;if(g!=="mod"){h=new o(null),h.length=S+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),g!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,g,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,g),g!=="mod"&&(N=M.div.neg()),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),g),g!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),g),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,g)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var A=g.div.negative!==0?g.mod.isub(f):g.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},o.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return g?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),g?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),S=0;g.isEven()&&A.isEven();)g.iushrn(1),A.iushrn(1),++S;for(var h=A.clone(),P=g.clone();!g.isZero();){for(var te=0,y=1;!(g.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(g.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(M),b.isub(R)):(A.isub(g),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(S)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=A.clone();g.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,S=1;!(g.words[0]&S)&&R<26;++R,S<<=1);if(R>0)for(g.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(b)):(A.isub(g),b.isub(N))}var te;return g.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),A=f.clone();g.negative=0,A.negative=0;for(var N=0;g.isEven()&&A.isEven();N++)g.iushrn(1),A.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=g.cmp(A);if(b<0){var M=g;g=A,A=M}else if(b===0||A.cmpn(1)===0)break;g.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,A=(f-g)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var A;if(this.length>1)A=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(g=1);break}}return g},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new G(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,A;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),A=g.bitLength();while(A>this.n);var N=A0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,g){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,A=0;A>>=26,f.words[A]=b,g=N}return g!==0&&(f.words[f.length++]=g),f},o._prime=function(f){if(B[f])return B[f];var g;if(f==="k256")g=new $;else if(f==="p224")g=new H;else if(f==="p192")g=new ie;else if(f==="p25519")g=new X;else throw new Error("Unknown prime "+f);return B[f]=g,g};function G(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var A=f.add(g);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var A=f.iadd(g);return A.cmp(this.m)>=0&&A.isub(this.m),A},G.prototype.sub=function(f,g){this._verify2(f,g);var A=f.sub(g);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var A=f.isub(g);return A.cmpn(0)<0&&A.iadd(this.m),A},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),S=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,S).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=g.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){S=0;continue}R<<=1,R|=y,S++,!(S!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),S=0,R=0)}h=26}return M},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},o.mont=function(f){return new J(f)};function J(C){G.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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(J,G),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},J.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new o(0)._forceRed(this);var A=f.mul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):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 i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** + */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var m=function(){};m.prototype=f.prototype,C.prototype=new m,C.prototype.constructor=C}function o(C,f,m){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(C||0,f||10,m||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,m){return f.cmp(m)>0?f:m},o.min=function(f,m){return f.cmp(m)<0?f:m},o.prototype._init=function(f,m,A){if(typeof f=="number")return this._initNumber(f,m,A);if(typeof f=="object")return this._initArray(f,m,A);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var m=C.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+C)}function a(C,f,m){var A=l(C,m);return m-1>=f&&(A|=l(C,m-1)<<4),A}o.prototype._parseHex=function(f,m,A){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var N=0;N=m;N-=2)R=a(f,m,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var S=f.length-m;for(N=S%2===0?m+1:m;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,m,A){for(var N=0,b=0,M=Math.min(C.length,m),R=f;R=49?b=S-49+10:S>=17?b=S-17+10:b=S,n(S>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var p=["","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"],v=[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],g=[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];o.prototype.toString=function(f,m){f=f||10,m=m|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=p[6-S.length]+S+A:A=S+A}for(b!==0&&(A=b.toString(16)+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=g[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=p[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,m){return this.toArrayLike(s,f,m)}),o.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var x=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};o.prototype.toArrayLike=function(f,m,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=m==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,m){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var m=f,A=0;return m>=4096&&(A+=13,m>>>=13),m>=64&&(A+=7,m>>>=7),m>=8&&(A+=4,m>>>=4),m>=2&&(A+=2,m>>>=2),A+m},o.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,A=0;return m&8191||(A+=13,m>>>=13),m&127||(A+=7,m>>>=7),m&15||(A+=4,m>>>=4),m&3||(A+=2,m>>>=2),m&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function k(C){for(var f=new Array(C.bitLength()),m=0;m>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var m,A;this.length>f.length?(m=this,A=f):(m=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,A=f%26;this._expand(m),A>0&&m--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,m){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),m?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=m&67108863;for(;M!==0&&R>26,this.words[R]=m&67108863;if(M===0&&R>>26,te=S&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}m.words[h]=te|0,S=P|0}return S!==0?m.words[h]=S|0:m.length--,m._strip()}var w=function(f,m,A){var N=f.words,b=m.words,M=A.words,R=0,S,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,Y=oe&8191,K=oe>>>13,Je=N[3]|0,Q=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^m.negative,A.length=19,S=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,S=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),S=S+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,S=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(K,Ce)|0,P=Math.imul(K,We),S=S+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,S=S+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,S=Math.imul(Q,Ce),h=Math.imul(Q,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),S=S+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(K,Be)|0,P=P+Math.imul(K,Ge)|0,S=S+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,S=S+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,S=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),S=S+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,S=S+Math.imul(Y,De)|0,h=h+Math.imul(Y,ne)|0,h=h+Math.imul(K,De)|0,P=P+Math.imul(K,ne)|0,S=S+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,S=S+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,S=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),S=S+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,S=S+Math.imul(Q,De)|0,h=h+Math.imul(Q,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,S=S+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(K,ge)|0,P=P+Math.imul(K,de)|0,S=S+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,S=S+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,S=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),S=S+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,S=S+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,S=S+Math.imul(Q,ge)|0,h=h+Math.imul(Q,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,S=S+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(K,be)|0,P=P+Math.imul(K,_e)|0,S=S+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,S=S+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,S=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),S=S+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,S=S+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,S=S+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,S=S+Math.imul(Q,be)|0,h=h+Math.imul(Q,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,S=S+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(K,Me)|0,P=P+Math.imul(K,je)|0,S=S+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,S=S+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,S=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),S=S+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,S=S+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,S=S+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,S=S+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,S=S+Math.imul(Q,Me)|0,h=h+Math.imul(Q,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,S=S+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(K,Ve)|0,P=P+Math.imul(K,Ke)|0,S=S+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,S=S+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,S=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),S=S+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,S=S+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,S=S+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,S=S+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,S=S+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,S=S+Math.imul(Q,Ve)|0,h=h+Math.imul(Q,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,S=S+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ue)|0,S=S+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,S=S+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,S=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),S=S+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,S=S+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,S=S+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,S=S+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,S=S+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,S=S+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,S=S+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(K,ke)|0,P=P+Math.imul(K,Ye)|0,S=S+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,S=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),S=S+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,S=S+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,S=S+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,S=S+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,S=S+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,S=S+Math.imul(Q,ke)|0,h=h+Math.imul(Q,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,S=S+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(K,Xe)|0,P=P+Math.imul(K,Ze)|0;var nc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,S=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),S=S+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,S=S+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,S=S+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,S=S+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,S=S+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,S=S+Math.imul(Q,Xe)|0,h=h+Math.imul(Q,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,S=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),S=S+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,S=S+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,S=S+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,S=S+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,S=S+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,S=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),S=S+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,S=S+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,S=S+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,S=S+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,S=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),S=S+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,S=S+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,S=S+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,S=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),S=S+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,S=S+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,S=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),S=S+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,S=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+S|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,m){m.negative=f.negative^C.negative,m.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}m.words[b]=R,A=M,M=N}return A!==0?m.words[b]=A:m.length--,m._strip()}function O(C,f,m){return _(C,f,m)}o.prototype.mulTo=function(f,m){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,m):N<63?A=E(this,f,m):N<1024?A=_(this,f,m):A=O(this,f,m),A},o.prototype.mul=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},o.prototype.mulf=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),O(this,f,m)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var m=f<0;m&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),m?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var m=k(f);if(m.length===0)return new o(1);for(var A=this,N=0;N=0);var m=f%26,A=(f-m)/26,N=67108863>>>26-m<<26-m,b;if(m!==0){var M=0;for(b=0;b>>26-m}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;m?N=(m-m%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return S&&P!==0&&(S.words[S.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,m,A){return n(this.negative===0),this.iushrn(f,m,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var m=f%26,A=(f-m)/26,N=1<=0);var m=f%26,A=(f-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(m!==0&&A++,this.length=Math.min(A,this.length),m!==0){var N=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,m){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var S=N.length-b.length,h;if(m!=="mod"){h=new o(null),h.length=S+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),m!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,m,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,m),m!=="mod"&&(N=M.div.neg()),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),m),m!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),m),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,m)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var A=m.div.negative!==0?m.mod.isub(f):m.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return m?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),m?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),S=0;m.isEven()&&A.isEven();)m.iushrn(1),A.iushrn(1),++S;for(var h=A.clone(),P=m.clone();!m.isZero();){for(var te=0,y=1;!(m.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(m.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(M),b.isub(R)):(A.isub(m),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(S)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=A.clone();m.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,S=1;!(m.words[0]&S)&&R<26;++R,S<<=1);if(R>0)for(m.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(b)):(A.isub(m),b.isub(N))}var te;return m.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),A=f.clone();m.negative=0,A.negative=0;for(var N=0;m.isEven()&&A.isEven();N++)m.iushrn(1),A.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=m.cmp(A);if(b<0){var M=m;m=A,A=M}else if(b===0||A.cmpn(1)===0)break;m.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var m=f%26,A=(f-m)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var A;if(this.length>1)A=1;else{m&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(m=1);break}}return m},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new G(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var m=f,A;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),A=m.bitLength();while(A>this.n);var N=A0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(f,m){f.iushrn(this.n,0,m)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,m){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,A=0;A>>=26,f.words[A]=b,m=N}return m!==0&&(f.words[f.length++]=m),f},o._prime=function(f){if(B[f])return B[f];var m;if(f==="k256")m=new $;else if(f==="p224")m=new H;else if(f==="p192")m=new ie;else if(f==="p25519")m=new X;else throw new Error("Unknown prime "+f);return B[f]=m,m};function G(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,m){n((f.negative|m.negative)===0,"red works only with positives"),n(f.red&&f.red===m.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,m){this._verify2(f,m);var A=f.add(m);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},G.prototype.iadd=function(f,m){this._verify2(f,m);var A=f.iadd(m);return A.cmp(this.m)>=0&&A.isub(this.m),A},G.prototype.sub=function(f,m){this._verify2(f,m);var A=f.sub(m);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},G.prototype.isub=function(f,m){this._verify2(f,m);var A=f.isub(m);return A.cmpn(0)<0&&A.iadd(this.m),A},G.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},G.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},G.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),S=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,S).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=m.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){S=0;continue}R<<=1,R|=y,S++,!(S!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),S=0,R=0)}h=26}return M},G.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},G.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},o.mont=function(f){return new J(f)};function J(C){G.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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(J,G),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},J.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new o(0)._forceRed(this);var A=f.mul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):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 i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={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(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],m=[1,256,65536,16777216],v=[6,1536,393216,100663296],p=[0,8,16,24],x=[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],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,Y){return f["cshake"+y].update(F,W,oe,Y)[U]()}},$=function(y,D,U){return function(F,W,oe,Y){return f["kmac"+y].update(F,W,oe,Y)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,Y=this.blockCount,K=0,Je=this.s,Q,le;K>2]|=y[K]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[Q>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=Q-W,this.block=F[Y],Q=0;Q>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];oe%y===0&&(te(D),W=0)}return F&&(K=D[W],Y+=u[K>>4&15]+u[K&15],F>1&&(Y+=u[K>>12&15]+u[K>>8&15]),F>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,Y=this.outputBits>>3,K;F?K=new ArrayBuffer(U+1<<2):K=new ArrayBuffer(Y);for(var Je=new Uint32Array(K);oe>8&255,Y[K+2]=Je>>16&255,Y[K+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(K=oe<<2,Je=D[W],Y[K]=Je&255,F>1&&(Y[K+1]=Je>>8&255),F>2&&(Y[K+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,Y,K,Je,Q,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],K=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],Q=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|K>>>31),U=Ne^(K<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|Q>>>31),U=oe^(Q<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=K^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=Q^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let m=i.writeUpdatableValue();s.push(v=>{m(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,m=Math.pow(2,d),v=m>>>1,p=v>>1,x=m-1;let k=0;for(let B=0;B1;){let X=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let m=d*n;return[a+d*r,u.map(v=>v+m)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("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 Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let m=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==m)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:m,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((m,v)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:m.name})),s.push(!0)):(i.push(m),s.push(!1)):(o.push(m),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((m,v)=>{if(m.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(p){u[v]=p}else try{u[v]=a[c++]}catch(p){u[v]=p}if(m.name&&u[m.name]==null){const p=u[v];p instanceof Error?Object.defineProperty(u,m.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(m.name)}`,p)}}):u[m.name]=p}});for(let m=0;m{throw Np(`index ${m}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){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}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,m=c&255;d?a.push(d,m):a.push(m)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(m>>1)-1?x=(m>>1)-k:x=k,v.isubn(x)):x=0,d[p]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,m=0,v;a.cmpn(-d)>0||u.cmpn(-m)>0;){var p=a.andln(3)+d&3,x=u.andln(3)+m&3;p===3&&(p=-1),x===3&&(x=-1);var k;p&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?k=-p:k=p):k=0,c[0].push(k);var E;x&1?(v=u.andln(7)+m&7,(v===3||v===5)&&p===2?E=-x:E=x):E=0,c[1].push(E),2*d===k+1&&(d=1-d),2*m===E+1&&(m=1-m),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),m=o;m>0;m--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,m;for(c=0;c=1;c-=2){var p=c-1,x=c;if(s[p]!==1||s[x]!==1){a[p]=Za(n[p],s[p],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[p].length,u),u=Math.max(a[x].length,u);continue}var k=[r[p],null,null,r[x]];r[p].y.cmp(r[x].y)===0?(k[1]=r[p].add(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg())):r[p].y.cmp(r[x].y.redNeg())===0?(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].add(r[x].neg())):(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[p],n[x]);for(u=Math.max(w[0].length,u),a[p]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?m=l[d][ie-1>>1]:ie<0&&(m=l[d][-ie-1>>1].neg()),m.type==="affine"?B=B.mixedAdd(m):B=B.add(m))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,p=c),d.negative&&(d=d.neg(),m=m.neg()),v.negative&&(v=v.neg(),p=p.neg()),[{a:d,b:m},{a:v,b:p}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),m=u.add(c).neg();return{k1:d,k2:m}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.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 r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.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 r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(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)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.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)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.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 Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(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.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),m=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(m).redISub(m),p=u.redMul(m.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,p,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),m=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(m)).redISub(o.redMul(c)),p=this.z.redMul(l);return this.curve.jpoint(m,v,p)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("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:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:en.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"]}),o("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:en.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("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:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("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:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var m=this.g.mul(d);if(!m.isInfinity()){var v=m.getX(),p=v.umod(this.n);if(p.cmpn(0)!==0){var x=d.invm(this.n).mul(p.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var k=(m.getY().isOdd()?1:0)|(v.cmp(p)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),k^=1),new Uu({r:p,s:x,recoveryParam:k})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),m=l.mul(c).umod(i);return this.g.mulAdd(d,s,m)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(m):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(l).forEach(E=>{const w=l[E];p[w.key]=w.value}),u.headers=p;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),k=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,p)=>(v.status=p.statusCode,v));if(d.data)return d.data;const m=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${m}`,T.errors.SERVER_ERROR,{url:a,errorMessage:m});s.push(m)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(m=>{m()}),!1)},d=m=>{m.confirmations{this.removeListener(e,d)}),i){let m=i.startBlock,v=null;const p=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(k=>ae(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)m=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=m-3,v{u||this.once("block",p)}))});if(u)return;this.once("block",p),a.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const m=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);m.unref&&m.unref(),a.push(()=>{clearTimeout(m)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+p.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const m=i.reduce((v,p)=>{if(!p.done||p.error==null)return v;const x=p.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:p.error,weight:0}),v[x].weight+=p.weight),v},{});if(Object.keys(m).forEach(v=>{const p=m[v];if(p.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=p.error,k={};Z3.forEach(E=>{x[E]!=null&&(k[E]=x[E])}),Si.throwError(x.reason||x.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const m=new Error(d.error.message);m.code=d.error.code,m.data=d.error.data,u.reject(m)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],g=[0,8,16,24],x=[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],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,Y){return f["cshake"+y].update(F,W,oe,Y)[U]()}},$=function(y,D,U){return function(F,W,oe,Y){return f["kmac"+y].update(F,W,oe,Y)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,Y=this.blockCount,K=0,Je=this.s,Q,le;K>2]|=y[K]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[Q>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=Q-W,this.block=F[Y],Q=0;Q>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];oe%y===0&&(te(D),W=0)}return F&&(K=D[W],Y+=u[K>>4&15]+u[K&15],F>1&&(Y+=u[K>>12&15]+u[K>>8&15]),F>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,Y=this.outputBits>>3,K;F?K=new ArrayBuffer(U+1<<2):K=new ArrayBuffer(Y);for(var Je=new Uint32Array(K);oe>8&255,Y[K+2]=Je>>16&255,Y[K+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(K=oe<<2,Je=D[W],Y[K]=Je&255,F>1&&(Y[K+1]=Je>>8&255),F>2&&(Y[K+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,Y,K,Je,Q,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],K=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],Q=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|K>>>31),U=Ne^(K<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|Q>>>31),U=oe^(Q<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=K^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=Q^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let p=i.writeUpdatableValue();s.push(v=>{p(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,p=Math.pow(2,d),v=p>>>1,g=v>>1,x=p-1;let k=0;for(let B=0;B1;){let X=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let p=d*n;return[a+d*r,u.map(v=>v+p)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("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 Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==p)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:p.name})),s.push(!0)):(i.push(p),s.push(!1)):(o.push(p),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(g){u[v]=g}else try{u[v]=a[c++]}catch(g){u[v]=g}if(p.name&&u[p.name]==null){const g=u[v];g instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(p.name)}`,g)}}):u[p.name]=g}});for(let p=0;p{throw Np(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){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}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,p=c&255;d?a.push(d,p):a.push(p)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(p>>1)-1?x=(p>>1)-k:x=k,v.isubn(x)):x=0,d[g]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,p=0,v;a.cmpn(-d)>0||u.cmpn(-p)>0;){var g=a.andln(3)+d&3,x=u.andln(3)+p&3;g===3&&(g=-1),x===3&&(x=-1);var k;g&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?k=-g:k=g):k=0,c[0].push(k);var E;x&1?(v=u.andln(7)+p&7,(v===3||v===5)&&g===2?E=-x:E=x):E=0,c[1].push(E),2*d===k+1&&(d=1-d),2*p===E+1&&(p=1-p),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,p;for(c=0;c=1;c-=2){var g=c-1,x=c;if(s[g]!==1||s[x]!==1){a[g]=Za(n[g],s[g],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[g].length,u),u=Math.max(a[x].length,u);continue}var k=[r[g],null,null,r[x]];r[g].y.cmp(r[x].y)===0?(k[1]=r[g].add(r[x]),k[2]=r[g].toJ().mixedAdd(r[x].neg())):r[g].y.cmp(r[x].y.redNeg())===0?(k[1]=r[g].toJ().mixedAdd(r[x]),k[2]=r[g].add(r[x].neg())):(k[1]=r[g].toJ().mixedAdd(r[x]),k[2]=r[g].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[g],n[x]);for(u=Math.max(w[0].length,u),a[g]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?p=l[d][ie-1>>1]:ie<0&&(p=l[d][-ie-1>>1].neg()),p.type==="affine"?B=B.mixedAdd(p):B=B.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,g=c),d.negative&&(d=d.neg(),p=p.neg()),v.negative&&(v=v.neg(),g=g.neg()),[{a:d,b:p},{a:v,b:g}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),p=u.add(c).neg();return{k1:d,k2:p}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.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 r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.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 r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(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)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.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)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.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 Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(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.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),p=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(p).redISub(p),g=u.redMul(p.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,g,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),p=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(p)).redISub(o.redMul(c)),g=this.z.redMul(l);return this.curve.jpoint(p,v,g)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("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:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:en.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"]}),o("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:en.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("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:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("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:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var v=p.getX(),g=v.umod(this.n);if(g.cmpn(0)!==0){var x=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var k=(p.getY().isOdd()?1:0)|(v.cmp(g)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),k^=1),new Uu({r:g,s:x,recoveryParam:k})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),p=l.mul(c).umod(i);return this.g.mulAdd(d,s,p)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(p):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const g={};Object.keys(l).forEach(E=>{const w=l[E];g[w.key]=w.value}),u.headers=g;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),k=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,g)=>(v.status=g.statusCode,v));if(d.data)return d.data;const p=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${p}`,T.errors.SERVER_ERROR,{url:a,errorMessage:p});s.push(p)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(p=>{p()}),!1)},d=p=>{p.confirmations{this.removeListener(e,d)}),i){let p=i.startBlock,v=null;const g=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(k=>ae(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)p=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",g)}))});if(u)return;this.once("block",g),a.push(()=>{this.removeListener("block",g)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),a.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+g.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(g=>{g.staller&&g.staller.cancel(),g.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const p=i.reduce((v,g)=>{if(!g.done||g.error==null)return v;const x=g.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:g.error,weight:0}),v[x].weight+=g.weight),v},{});if(Object.keys(p).forEach(v=>{const g=p[v];if(g.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=g.error,k={};Z3.forEach(E=>{x[E]!=null&&(k[E]=x[E])}),Si.throwError(x.reason||x.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const p=new Error(d.error.message);p.code=d.error.code,p.data=d.error.data,u.reject(p)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -87,4 +87,4 @@ Error generating stack: `+o.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var p=s.value;if(i(p,v))return d=p}return d=v}if(p=d,MS(c,v))return p;var x=n(v);return i!==void 0&&i(p,x)?p:(c=v,d=x)}var u=!1,c,d,m=r===void 0?null:r;return[function(){return a(e())},m===null?void 0:function(){return a(m())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const m=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===m&&l.setState({activating:!1})}}function c(m){if(m.chainId!==void 0&&n(m.chainId),m.accounts!==void 0)for(let v=0;v{var p,x;const k=(p=m.chainId)!==null&&p!==void 0?p:v.chainId,E=(x=m.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&k&&E&&(w=!1),{chainId:k,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const m=t.findIndex(([v])=>d===v);if(m===-1)throw new Error("Connector not found");return m}function r(d){const m=t[e(d)][2];if(!m)throw new Error("Stores not passed");return m}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,m){const v=e(d);return t.map(([,{useProvider:x}],k)=>x(m,k===v))[v]}function u(d,m){const v=e(d);return t.map(([,{useENSNames:x}],k)=>x(k===v?m:void 0))[v]}function c(d,m){const v=e(d);return t.map(([,{useENSName:x}],k)=>x(k===v?m:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function m(){return r(c())}function v(){return n(c())}function p(){return i(c())}function x(){return o(c())}function k(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:m,usePriorityAccounts:v,usePriorityIsActivating:p,usePriorityAccount:x,usePriorityIsActive:k,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[m,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(m)return;let p=!1;return nk().then(()=>{p||v(!0)}),()=>{p=!0}},[m]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[m,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,m),p=r?r+u:u;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],v]:a._events[p].push(v):(a._events[p]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var m=0,v=d.length,p=new Array(v);me),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((X,G)=>{const J=o.current[G];return X[0]!==J[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:m,useSelectedProvider:v,useSelectedENSNames:p,useSelectedENSName:x}=s,k=l(),E=r??k,w=a(E),_=u(E),O=c(E),B=d(E),j=m(E),$=v(E,n),H=p(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,E)=>({...E,...k}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=sl(o.serialize),d=()=>{const k=o.partialize({...n()});let E;const w=c({state:k,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},m=i.setState;i.setState=(k,E)=>{m(k,E),d()};const v=t((...k)=>{r(...k),d()},n,i);let p;const x=()=>{var k;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return p=o.merge(w,(_=n())!=null?_:v),r(p,!0),d()}).then(()=>{E==null||E(p,void 0),s=!0,a.forEach(w=>w(p))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:k=>{o={...o,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:k=>(l.add(k),()=>{l.delete(k)}),onFinishHydration:k=>(a.add(k),()=>{a.delete(k)})},x(),p||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,k)=>({...k,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,k)=>{d(x,k),c()};const m=t((...x)=>{r(...x),c()},n,i);let v;const p=()=>{var x,k;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:m)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(x=n())!=null?x:m))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:m),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||p(),v||m},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsxs("div",{className:"col title",children:[I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)}),((s=t.metadata)==null?void 0:s.subtitle)&&I.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.subtitle)==null?void 0:a.slice(0,100)})]})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,H,ie,X,G;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((H=($=t.metadata)==null?void 0:$.mirrors)==null?void 0:H[0])||""),[d,m]=L.useState([]),[v,p]=L.useState(""),{clean:x,installed:k,downloaded:E,updatable:w}=L.useMemo(()=>{var A,N,b,M,R;const J=((A=t.metadata)==null?void 0:A.versions)&&((b=t.metadata)==null?void 0:b.versions[((N=t.metadata)==null?void 0:N.versions.length)-1]),C=t.installed,f=!!t.state,g=!!((M=t.state)!=null&&M.our_version&&J)&&((R=t.state)==null?void 0:R.our_version)!==J&&t.publisher!==window.our.node;return{clean:!C&&!f&&!g,installed:C,downloaded:f,updatable:g}},[t]),_=L.useCallback(async()=>{k&&!w?window.alert("App is installed"):(E&&o(t).then(J=>{m(J.request_capabilities)}),a(!0))},[t,k,E,w,a,o]),O=L.useCallback(async()=>{try{p(`Downloading ${cs(t)}...`),await n(t);const J=setInterval(()=>{s(t).then(()=>{p(""),a(!1),clearInterval(J)}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert(`Failed to download app from ${u}, please try a different mirror.`),p("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{p(`Installing ${cs(t)}...`),await i(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to install, please try again."),p("")}},[t,i,s]),j=L.useCallback(async()=>{try{p(`Updating ${cs(t)}...`),await r(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to update, please try again."),p("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:k&&w?"Update":k?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ie=t.metadata)==null?void 0:ie.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:J=>c(J.target.value),children:(G=(X=t.metadata)==null?void 0:X.mirrors)==null?void 0:G.map(J=>I.jsx("option",{value:J,children:J},J))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:m}=o,v=()=>{if(o.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(k,E)-_m(k,w)),o.sorted=!0};let p=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=k=>k===u?void 0:k;break;case xt.FIRST:v(),p=0,x=d[p];break;case xt.LAST:v(),p=d.length-1,x=d[p];break;case xt.SET_INDEX:v(),p=c,x=d[p];break;case xt.INCREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p++,p>=d.length&&(p=0),x=d[p];break;case xt.DECREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p--,p<0&&(p=d.length-1),x=d[p];break}x||(p=-1),n(x),o.hoverIndex=p},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=p=>p+o.left-s.left-l.left,u=p=>p+o.left+i.width-s.right+l.right,c=p=>p+o.top-s.top-l.top,d=p=>p+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:p=>{let x=a(p);if(x<0)p-=x;else{const k=u(p);k>0&&(p-=k,x=a(p),x<0&&(p-=x))}return p},confineVertically:p=>{let x=c(p);if(x<0)p-=x;else{const k=d(p);k>0&&(p-=k,x=c(p),x<0&&(p-=x))}return p}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let k,E,w;return p==="left"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="right")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let k,E,w;return p==="top"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="bottom")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let m=d?n:i,v=d?i:n;if(t){const B=l.current;d?m+=B.offsetWidth:v+=B.offsetHeight}const p=s.left-c.left-u.width-m,x=s.right-c.left+m,k=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=m,_+=v;const O={...a,anchorRect:s,placeLeftX:p,placeRightX:x,placeLeftorRightY:_,placeTopY:k,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:m="start",direction:v="bottom",position:p="auto",overflow:x="visible",setDownOverflow:k,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:X,...G})=>{const[J,C]=L.useState({x:Pm,y:Pm}),[f,g]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[S,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:K,reposSubmenu:Je=E}=L.useContext(Sm),Q=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(Q,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,Q,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:m,direction:v,gap:$,shift:H,position:p,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&g({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,m,y,v,$,H,p,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!k&&(Q.current.scrollTop=0)},[A,k]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(X,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,X,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=Q.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=Q.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(k?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:S,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:Q,parentDir:b}),[S,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:K==null?void 0:K.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},G),ref:Uh(c,Q),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:J.x,top:J.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:m=150,viewScroll:v="initial",portal:p,theming:x,onItemClick:k,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:m}),[i,o,s,l,B,a,u,c,v,d,m]),ie=L.useMemo(()=>({handleClick(G,J){G.stopPropagation||hr(k,G);let C=G.keepOpen;C===void 0&&(C=J&&G.key===$r.SPACE),C||hr($,{value:G.value,key:G.key,reason:ul.CLICK})},handleClose(G){hr($,{key:G,reason:ul.CLICK})}}),[k,$]);if(!j)return null;const X=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return p===!0&&typeof document<"u"?Qs.createPortal(X,document.body):p?p.target?Qs.createPortal(X,p.target):p.stablePosition?null:X:X}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),m=L.useRef(),[v,p]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,m,a)},[a,l]),k=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,m,a),O){case Ad:v>=0&&(m.current=setTimeout(x,v));break;case cu:p>=0&&(m.current=setTimeout(x,p));break;case xd:case uu:m.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,p,l]);return L.useEffect(()=>()=>clearTimeout(m.current),[]),[u,k,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:m}=u,v=G1(m),p=L.useRef(null),x=k4(m,(B,j)=>d(j.detail?void 0:Ms.FIRST)),k=L.useCallback(B=>{c(!1),B.key&&p.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,p),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:p,ref:a,onClose:k})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=p=>{r&&!p.currentTarget.contains(p.relatedTarget)&&c()},m=p=>{n||(p.stopPropagation(),s.on(i,u,u))},v=(p,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:m,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...m}){const v=!!s,{setHover:p,...x}=I4(c,c,u,v),k=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=G=>{if(v){G.stopPropagation(),G.preventDefault();return}const J={value:r,syntheticEvent:G};G.key!==void 0&&(J.key=G.key),_&&(J.checked=!B),w&&(J.name=E.name),hr(a,J),w&&hr(E.onRadioChange,J),k.handleClick(J,_||w)},$=G=>{if(u)switch(G.key){case $r.ENTER:G.preventDefault();case $r.SPACE:O?c.current.click():j(G)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:p,onKeyDown:$,onClick:j},m),X={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...X})}):I.jsx("li",{...X})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.website)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.website,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(p,x)=>x+1),[l]);L.useEffect(()=>{const p=(u-1)*10,x=p+10;a(e.slice(p,x))},[e]),L.useEffect(()=>{r().then(p=>{a(Object.values(p))}).catch(p=>console.error(p))},[]);const m=L.useCallback(async p=>{},[]),v=L.useCallback(p=>{s(p);const x=e.filter(k=>{var E,w,_,O;return k.package.toLowerCase().includes(p.toLowerCase())||((w=(E=k.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(p.toLowerCase()))||((O=(_=k.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(p.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:p=>{i(p.target.value),m(p.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(p=>{var x;return I.jsx(ys,{app:p},xe(p)+(((x=p.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(p=>I.jsx("div",{className:`page-selector ${p===u?"selected":""}`,onClick:()=>c(p),children:p},`page-${p}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,m)=>(d[m]=e[m].filter(v=>{var p,x,k,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(p=v.metadata)==null?void 0:p.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(k=v.metadata)==null?void 0:k.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var a,u,c,d,m;const{myApps:e,listedApps:r}=Qo(),n=lx(),[i,o]=L.useState(void 0);L.useEffect(()=>{const v=e.local.find(p=>xe(p)===n.id);if(v)return o(v);if(n.id){const p=r.find(x=>xe(x)===n.id);if(p)return o(p)}},[n,e,r]);const s=L.useMemo(()=>{var v;return((v=i==null?void 0:i.metadata)==null?void 0:v.version)||"Unknown"},[i]),l=((a=i==null?void 0:i.state)==null?void 0:a.our_version)||"";return i?I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:i?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:i,size:"large"}),I.jsx(W1,{app:i,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((u=i.metadata)==null?void 0:u.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:i.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:s})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((c=i.metadata)==null?void 0:c.mirrors)||[]).map((v,p)=>I.jsx("div",{className:"value underline",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Permissions"}),I.jsx("div",{className:"col",children:(d=i.permissions)==null?void 0:d.map((v,p)=>I.jsx("div",{className:"value permission",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:l})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((m=i.metadata)==null?void 0:m.screenshots)||[]).map((v,p)=>I.jsx("img",{src:v},p+v))})]}):I.jsx("h3",{children:"App not found"})})]}):I.jsx("div",{children:"Loading..."})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,m;if((((m=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||m===void 0?void 0:m.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){var X;const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[m,v]=L.useState(""),[p,x]=L.useState(((X=window.our)==null?void 0:X.node)||""),[k,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(G){console.error(G)}},[]),$=L.useCallback(async()=>{if(!k){_("");return}try{const J=await(await fetch(k)).text();JSON.parse(J);const C=ut(mr(J));_(C)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[k]),H=L.useCallback(async G=>{var C;G.preventDefault(),G.stopPropagation();let J=w;try{if(!J){const A=await fetch(k);await A.json();const N=await A.text();J=ut(mr(N))}l("Please confirm the transaction in your wallet");const f=W4(p);await Om(fu);const g=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[m,f])),k,J):e.registerApp(m,f,k,J));await new Promise(A=>setTimeout(A,2e3)),l("Publishing package..."),await g.wait(),u({packageName:m,publisherId:p}),v(""),x(((C=window.our)==null?void 0:C.node)||p),E(""),_(""),B(!1)}catch(f){console.error(f),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[m,O,p,k,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||m&&p&&r.find(G=>G.package===m&&G.publisher===p)&&B(!0)},[r,m,p,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:m,onChange:G=>v(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:p,onChange:G=>x(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:k,onChange:G=>E(G.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:G=>_(G.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); + */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var g=s.value;if(i(g,v))return d=g}return d=v}if(g=d,MS(c,v))return g;var x=n(v);return i!==void 0&&i(g,x)?g:(c=v,d=x)}var u=!1,c,d,p=r===void 0?null:r;return[function(){return a(e())},p===null?void 0:function(){return a(p())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const p=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===p&&l.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var g,x;const k=(g=p.chainId)!==null&&g!==void 0?g:v.chainId,E=(x=p.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&k&&E&&(w=!1),{chainId:k,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const p=t.findIndex(([v])=>d===v);if(p===-1)throw new Error("Connector not found");return p}function r(d){const p=t[e(d)][2];if(!p)throw new Error("Stores not passed");return p}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,p){const v=e(d);return t.map(([,{useProvider:x}],k)=>x(p,k===v))[v]}function u(d,p){const v=e(d);return t.map(([,{useENSNames:x}],k)=>x(k===v?p:void 0))[v]}function c(d,p){const v=e(d);return t.map(([,{useENSName:x}],k)=>x(k===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function p(){return r(c())}function v(){return n(c())}function g(){return i(c())}function x(){return o(c())}function k(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:g,usePriorityAccount:x,usePriorityIsActive:k,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[p,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(p)return;let g=!1;return nk().then(()=>{g||v(!0)}),()=>{g=!0}},[p]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[p,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,p),g=r?r+u:u;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,v=d.length,g=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((X,G)=>{const J=o.current[G];return X[0]!==J[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:g,useSelectedENSName:x}=s,k=l(),E=r??k,w=a(E),_=u(E),O=c(E),B=d(E),j=p(E),$=v(E,n),H=g(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,E)=>({...E,...k}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=sl(o.serialize),d=()=>{const k=o.partialize({...n()});let E;const w=c({state:k,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},p=i.setState;i.setState=(k,E)=>{p(k,E),d()};const v=t((...k)=>{r(...k),d()},n,i);let g;const x=()=>{var k;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return g=o.merge(w,(_=n())!=null?_:v),r(g,!0),d()}).then(()=>{E==null||E(g,void 0),s=!0,a.forEach(w=>w(g))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:k=>{o={...o,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:k=>(l.add(k),()=>{l.delete(k)}),onFinishHydration:k=>(a.add(k),()=>{a.delete(k)})},x(),g||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,k)=>({...k,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,k)=>{d(x,k),c()};const p=t((...x)=>{r(...x),c()},n,i);let v;const g=()=>{var x,k;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:p)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(x=n())!=null?x:p))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:p),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||g(),v||p},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsxs("div",{className:"col title",children:[I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)}),((s=t.metadata)==null?void 0:s.subtitle)&&I.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.subtitle)==null?void 0:a.slice(0,100)})]})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,H,ie,X,G;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((H=($=t.metadata)==null?void 0:$.mirrors)==null?void 0:H[0])||""),[d,p]=L.useState([]),[v,g]=L.useState(""),{clean:x,installed:k,downloaded:E,updatable:w}=L.useMemo(()=>{var A,N,b,M,R;const J=((A=t.metadata)==null?void 0:A.versions)&&((b=t.metadata)==null?void 0:b.versions[((N=t.metadata)==null?void 0:N.versions.length)-1]),C=t.installed,f=!!t.state,m=!!((M=t.state)!=null&&M.our_version&&J)&&((R=t.state)==null?void 0:R.our_version)!==J&&t.publisher!==window.our.node;return{clean:!C&&!f&&!m,installed:C,downloaded:f,updatable:m}},[t]),_=L.useCallback(async()=>{k&&!w?window.alert("App is installed"):(E&&o(t).then(J=>{p(J.request_capabilities)}),a(!0))},[t,k,E,w,a,o]),O=L.useCallback(async()=>{try{g(`Downloading ${cs(t)}...`),await n(t);const J=setInterval(()=>{s(t).then(()=>{g(""),a(!1),clearInterval(J)}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert(`Failed to download app from ${u}, please try a different mirror.`),g("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{g(`Installing ${cs(t)}...`),await i(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to install, please try again."),g("")}},[t,i,s]),j=L.useCallback(async()=>{try{g(`Updating ${cs(t)}...`),await r(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to update, please try again."),g("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:k&&w?"Update":k?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ie=t.metadata)==null?void 0:ie.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:J=>c(J.target.value),children:(G=(X=t.metadata)==null?void 0:X.mirrors)==null?void 0:G.map(J=>I.jsx("option",{value:J,children:J},J))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:p}=o,v=()=>{if(o.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(k,E)-_m(k,w)),o.sorted=!0};let g=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=k=>k===u?void 0:k;break;case xt.FIRST:v(),g=0,x=d[g];break;case xt.LAST:v(),g=d.length-1,x=d[g];break;case xt.SET_INDEX:v(),g=c,x=d[g];break;case xt.INCREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g++,g>=d.length&&(g=0),x=d[g];break;case xt.DECREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g--,g<0&&(g=d.length-1),x=d[g];break}x||(g=-1),n(x),o.hoverIndex=g},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=g=>g+o.left-s.left-l.left,u=g=>g+o.left+i.width-s.right+l.right,c=g=>g+o.top-s.top-l.top,d=g=>g+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:g=>{let x=a(g);if(x<0)g-=x;else{const k=u(g);k>0&&(g-=k,x=a(g),x<0&&(g-=x))}return g},confineVertically:g=>{let x=c(g);if(x<0)g-=x;else{const k=d(g);k>0&&(g-=k,x=c(g),x<0&&(g-=x))}return g}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let k,E,w;return g==="left"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,g="right")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let k,E,w;return g==="top"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,g="bottom")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let p=d?n:i,v=d?i:n;if(t){const B=l.current;d?p+=B.offsetWidth:v+=B.offsetHeight}const g=s.left-c.left-u.width-p,x=s.right-c.left+p,k=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=p,_+=v;const O={...a,anchorRect:s,placeLeftX:g,placeRightX:x,placeLeftorRightY:_,placeTopY:k,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:p="start",direction:v="bottom",position:g="auto",overflow:x="visible",setDownOverflow:k,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:X,...G})=>{const[J,C]=L.useState({x:Pm,y:Pm}),[f,m]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[S,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:K,reposSubmenu:Je=E}=L.useContext(Sm),Q=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(Q,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,Q,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:p,direction:v,gap:$,shift:H,position:g,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&m({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,p,y,v,$,H,g,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!k&&(Q.current.scrollTop=0)},[A,k]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(X,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,X,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=Q.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=Q.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(k?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:S,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:Q,parentDir:b}),[S,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:K==null?void 0:K.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},G),ref:Uh(c,Q),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:J.x,top:J.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:g,theming:x,onItemClick:k,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:p}),[i,o,s,l,B,a,u,c,v,d,p]),ie=L.useMemo(()=>({handleClick(G,J){G.stopPropagation||hr(k,G);let C=G.keepOpen;C===void 0&&(C=J&&G.key===$r.SPACE),C||hr($,{value:G.value,key:G.key,reason:ul.CLICK})},handleClose(G){hr($,{key:G,reason:ul.CLICK})}}),[k,$]);if(!j)return null;const X=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return g===!0&&typeof document<"u"?Qs.createPortal(X,document.body):g?g.target?Qs.createPortal(X,g.target):g.stablePosition?null:X:X}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),p=L.useRef(),[v,g]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,p,a)},[a,l]),k=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,p,a),O){case Ad:v>=0&&(p.current=setTimeout(x,v));break;case cu:g>=0&&(p.current=setTimeout(x,g));break;case xd:case uu:p.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,g,l]);return L.useEffect(()=>()=>clearTimeout(p.current),[]),[u,k,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:p}=u,v=G1(p),g=L.useRef(null),x=k4(p,(B,j)=>d(j.detail?void 0:Ms.FIRST)),k=L.useCallback(B=>{c(!1),B.key&&g.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,g),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:g,ref:a,onClose:k})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=g=>{r&&!g.currentTarget.contains(g.relatedTarget)&&c()},p=g=>{n||(g.stopPropagation(),s.on(i,u,u))},v=(g,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:p,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...p}){const v=!!s,{setHover:g,...x}=I4(c,c,u,v),k=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=G=>{if(v){G.stopPropagation(),G.preventDefault();return}const J={value:r,syntheticEvent:G};G.key!==void 0&&(J.key=G.key),_&&(J.checked=!B),w&&(J.name=E.name),hr(a,J),w&&hr(E.onRadioChange,J),k.handleClick(J,_||w)},$=G=>{if(u)switch(G.key){case $r.ENTER:G.preventDefault();case $r.SPACE:O?c.current.click():j(G)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:g,onKeyDown:$,onClick:j},p),X={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...X})}):I.jsx("li",{...X})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.website)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.website,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(g,x)=>x+1),[l]);L.useEffect(()=>{const g=(u-1)*10,x=g+10;a(e.slice(g,x))},[e]),L.useEffect(()=>{r().then(g=>{a(Object.values(g))}).catch(g=>console.error(g))},[]);const p=L.useCallback(async g=>{},[]),v=L.useCallback(g=>{s(g);const x=e.filter(k=>{var E,w,_,O;return k.package.toLowerCase().includes(g.toLowerCase())||((w=(E=k.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(g.toLowerCase()))||((O=(_=k.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(g.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:g=>{i(g.target.value),p(g.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(g=>{var x;return I.jsx(ys,{app:g},xe(g)+(((x=g.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(g=>I.jsx("div",{className:`page-selector ${g===u?"selected":""}`,onClick:()=>c(g),children:g},`page-${g}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,p)=>(d[p]=e[p].filter(v=>{var g,x,k,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(g=v.metadata)==null?void 0:g.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(k=v.metadata)==null?void 0:k.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var u,c,d,p,v,g,x,k;const{myApps:e,listedApps:r,getListedApp:n}=Qo(),i=lx(),[o,s]=L.useState(void 0);L.useEffect(()=>{const E=e.local.find(w=>xe(w)===i.id);if(E)return s(E);if(i.id){const w=r.find(_=>xe(_)===i.id);w?s(w):n(i.id).then(_=>s(_)).catch(console.error)}},[i.id]);const l=L.useMemo(()=>{var E;return((E=o==null?void 0:o.metadata)==null?void 0:E.version)||"Unknown"},[o]),a=((u=o==null?void 0:o.state)==null?void 0:u.our_version)||((v=(c=o==null?void 0:o.metadata)==null?void 0:c.versions)==null?void 0:v[(((p=(d=o==null?void 0:o.metadata)==null?void 0:d.versions)==null?void 0:p.length)||1)-1])||"";return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:o?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:o,size:"large"}),I.jsx(W1,{app:o,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((g=o.metadata)==null?void 0:g.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:o.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:l})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((x=o.metadata)==null?void 0:x.mirrors)||[]).map((E,w)=>I.jsx("div",{className:"value underline",children:E},w+E))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:a})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((k=o.metadata)==null?void 0:k.screenshots)||[]).map((E,w)=>I.jsx("img",{src:E},w+E))})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"App details not found for "}),I.jsx("h3",{children:i.id})]})})]})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,p;if((((p=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){var X;const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[p,v]=L.useState(""),[g,x]=L.useState(((X=window.our)==null?void 0:X.node)||""),[k,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(G){console.error(G)}},[]),$=L.useCallback(async()=>{if(!k){_("");return}try{const J=await(await fetch(k)).text();JSON.parse(J);const C=ut(mr(J));_(C)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[k]),H=L.useCallback(async G=>{var C;G.preventDefault(),G.stopPropagation();let J=w;try{if(!J){const A=await fetch(k);await A.json();const N=await A.text();J=ut(mr(N))}l("Please confirm the transaction in your wallet");const f=W4(g);await Om(fu);const m=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[p,f])),k,J):e.registerApp(p,f,k,J));await new Promise(A=>setTimeout(A,2e3)),l("Publishing package..."),await m.wait(),u({packageName:p,publisherId:g}),v(""),x(((C=window.our)==null?void 0:C.node)||g),E(""),_(""),B(!1)}catch(f){console.error(f),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[p,O,g,k,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||p&&g&&r.find(G=>G.package===p&&G.publisher===g)&&B(!0)},[r,p,g,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:p,onChange:G=>v(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:g,onChange:G=>x(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:k,onChange:G=>E(G.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:G=>_(G.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/index.html b/kinode/packages/app_store/pkg/ui/index.html index 62ed67cd..7bb3aae7 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -18,7 +18,7 @@ content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" /> - + From acebc82a5926d6eacabe6c654bf93d2290969091 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Sat, 10 Feb 2024 19:17:23 -0300 Subject: [PATCH 5/9] app_store: allow frontend to select mirror to use via POST body --- .../app_store/app_store/src/http_api.rs | 17 +++++++++++------ kinode/packages/app_store/app_store/src/lib.rs | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 30bb66e8..d6d24880 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -235,10 +235,12 @@ fn serve_paths( } Method::POST => { // download an app - // TODO get fields from POST body let pkg_listing: &PackageListing = state .get_listing(&package_id) .ok_or(anyhow::anyhow!("No package"))?; + // from POST body, look for download_from field and use that as the mirror + let body = crate::get_blob()?.bytes; + let body_json: serde_json::Value = serde_json::from_slice(&body)?; let mirrors: &Vec = pkg_listing .metadata .as_ref() @@ -246,11 +248,14 @@ fn serve_paths( .mirrors .as_ref() .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; - // TODO select on FE - let download_from = mirrors - .first() - .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; - // TODO select on FE + let download_from = body_json + .get("download_from") + .ok_or(json!(mirrors.first().ok_or(anyhow::anyhow!( + "No mirrors for package {package_id}" + ))?))? + .as_str() + .ok_or(json!("download_from not a string"))?; + // TODO select on FE? or after download but before install? let mirror = false; let auto_update = false; let desired_version_hash = None; diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 96bb5901..56b19066 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -407,7 +407,7 @@ fn handle_receive_download( Some(hash) => { if download_hash != hash { return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" + "app store: downloaded package is not desired version--rejecting download! download hash: {download_hash}, desired hash: {hash}" )); } } @@ -422,7 +422,7 @@ fn handle_receive_download( if let Some(latest_hash) = metadata.versions.clone().unwrap_or(vec![]).last() { if &download_hash != latest_hash { return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" + "app store: downloaded package is not latest version--rejecting download! download hash: {download_hash}, latest hash: {latest_hash}" )); } } else { From a8b2d3534c438a8c2d68806a15662631970a1aa5 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Sat, 10 Feb 2024 20:21:15 -0300 Subject: [PATCH 6/9] add auto-update, make `update` http action real --- Cargo.lock | 2 +- .../app_store/app_store/src/http_api.rs | 52 +++++++++++++++---- .../packages/app_store/app_store/src/lib.rs | 39 ++++++++++++-- .../packages/app_store/app_store/src/types.rs | 49 ++++++++++++++++- 4 files changed, 125 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf..c7285c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index d6d24880..4d52c077 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -188,8 +188,38 @@ fn serve_paths( } Method::PUT => { // update an app - // TODO - Ok((StatusCode::NO_CONTENT, None, format!("TODO").into_bytes())) + let pkg_listing: &PackageListing = state + .get_listing(&package_id) + .ok_or(anyhow::anyhow!("No package"))?; + let pkg_state: &PackageState = state + .downloaded_packages + .get(&package_id) + .ok_or(anyhow::anyhow!("No package"))?; + let download_from = pkg_state + .mirrored_from + .as_ref() + .ok_or(anyhow::anyhow!("No mirror for package {package_id}"))? + .to_string(); + match crate::start_download( + our, + requested_packages, + &package_id, + &download_from, + pkg_state.mirroring, + pkg_state.auto_update, + &None, + ) { + DownloadResponse::Started => Ok(( + StatusCode::CREATED, + None, + format!("Downloading").into_bytes(), + )), + DownloadResponse::Failure => Ok(( + StatusCode::SERVICE_UNAVAILABLE, + None, + format!("Failed to download").into_bytes(), + )), + } } Method::DELETE => { // uninstall an app @@ -239,8 +269,11 @@ fn serve_paths( .get_listing(&package_id) .ok_or(anyhow::anyhow!("No package"))?; // from POST body, look for download_from field and use that as the mirror - let body = crate::get_blob()?.bytes; - let body_json: serde_json::Value = serde_json::from_slice(&body)?; + let body = crate::get_blob() + .ok_or(anyhow::anyhow!("missing blob"))? + .bytes; + let body_json: serde_json::Value = + serde_json::from_slice(&body).unwrap_or_default(); let mirrors: &Vec = pkg_listing .metadata .as_ref() @@ -250,11 +283,12 @@ fn serve_paths( .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; let download_from = body_json .get("download_from") - .ok_or(json!(mirrors.first().ok_or(anyhow::anyhow!( - "No mirrors for package {package_id}" - ))?))? + .unwrap_or(&json!(mirrors + .first() + .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?)) .as_str() - .ok_or(json!("download_from not a string"))?; + .ok_or(anyhow::anyhow!("download_from not a string"))? + .to_string(); // TODO select on FE? or after download but before install? let mirror = false; let auto_update = false; @@ -263,7 +297,7 @@ fn serve_paths( our, requested_packages, &package_id, - download_from, + &download_from, mirror, auto_update, &desired_version_hash, diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 56b19066..a2bde02d 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -178,7 +178,7 @@ fn handle_message( if source.node() != our.node() || source.process != "eth:distro:sys" { return Err(anyhow::anyhow!("eth sub event from weird addr: {source}")); } - handle_eth_sub_event(&mut state, e)?; + handle_eth_sub_event(our, &mut state, e)?; } Req::Http(incoming) => { if source.node() != our.node() @@ -187,7 +187,7 @@ fn handle_message( return Err(anyhow::anyhow!("http_server from non-local node")); } if let HttpServerRequest::Http(req) = incoming { - http_api::handle_http_request(&our, &mut state, requested_packages, &req)?; + http_api::handle_http_request(our, &mut state, requested_packages, &req)?; } } }, @@ -269,6 +269,7 @@ fn handle_local_request( our_version, installed: false, caps_approved: true, // TODO see if we want to auto-approve local installs + manifest_hash: None, // generated in the add fn mirroring: *mirror, auto_update: false, // can't auto-update a local package metadata: None, // TODO @@ -436,6 +437,14 @@ fn handle_receive_download( } } + let old_manifest_hash = match state.downloaded_packages.get(&package_id) { + Some(package_state) => package_state + .manifest_hash + .clone() + .unwrap_or("OLD".to_string()), + _ => "OLD".to_string(), + }; + state.add_downloaded_package( &package_id, PackageState { @@ -443,12 +452,28 @@ fn handle_receive_download( our_version: download_hash, installed: false, caps_approved: false, + manifest_hash: None, // generated in the add fn mirroring: requested_package.mirror, auto_update: requested_package.auto_update, metadata: None, // TODO }, Some(blob.bytes), - ) + )?; + + let new_manifest_hash = match state.downloaded_packages.get(&package_id) { + Some(package_state) => package_state + .manifest_hash + .clone() + .unwrap_or("NEW".to_string()), + _ => "NEW".to_string(), + }; + + // lastly, if auto_update is true, AND the caps_hash has NOT changed, + // trigger install! + if requested_package.auto_update && old_manifest_hash == new_manifest_hash { + handle_install(our, state, &package_id)?; + } + Ok(()) } fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { @@ -470,11 +495,15 @@ fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { Ok(()) } -fn handle_eth_sub_event(state: &mut State, event: EthSubEvent) -> anyhow::Result<()> { +fn handle_eth_sub_event( + our: &Address, + state: &mut State, + event: EthSubEvent, +) -> anyhow::Result<()> { let EthSubEvent::Log(log) = event else { return Err(anyhow::anyhow!("app store: got non-log event")); }; - state.ingest_listings_contract_event(log) + state.ingest_listings_contract_event(our, log) } fn fetch_package_manifest(package: &PackageId) -> anyhow::Result> { diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 3e9504f6..c31bc1ad 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -1,3 +1,4 @@ +use crate::LocalRequest; use alloy_rpc_types::Log; use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::kernel_types as kt; @@ -86,6 +87,7 @@ pub struct PackageState { pub our_version: String, pub installed: bool, pub caps_approved: bool, + pub manifest_hash: Option, /// are we serving this package to others? pub mirroring: bool, /// if we get a listing data update, will we try to download it? @@ -171,7 +173,7 @@ impl State { pub fn add_downloaded_package( &mut self, package_id: &PackageId, - package_state: PackageState, + mut package_state: PackageState, package_bytes: Option>, ) -> anyhow::Result<()> { if let Some(package_bytes) = package_bytes { @@ -215,6 +217,13 @@ impl State { })?) .blob(blob) .send_and_await_response(5)??; + + let manifest_file = vfs::File { + path: format!("/{}/pkg/manifest.json", package_id), + }; + let manifest_bytes = manifest_file.read()?; + let manifest_hash = generate_metadata_hash(&manifest_bytes); + package_state.manifest_hash = Some(manifest_hash); } self.downloaded_packages .insert(package_id.to_owned(), package_state); @@ -296,6 +305,10 @@ impl State { // generate entry from this data // for the version hash, take the SHA-256 hash of the zip file let our_version = generate_version_hash(&zip_file_bytes); + let manifest_file = vfs::File { + path: format!("/{}/pkg/manifest.json", package_id), + }; + let manifest_bytes = manifest_file.read()?; // the user will need to turn mirroring and auto-update back on if they // have to reset the state of their app store for some reason. the apps // themselves will remain on disk unless explicitly deleted. @@ -306,6 +319,7 @@ impl State { our_version, installed: true, caps_approved: true, // since it's already installed this must be true + manifest_hash: Some(generate_metadata_hash(&manifest_bytes)), mirroring: false, auto_update: false, metadata: None, @@ -362,7 +376,11 @@ impl State { } /// only saves state if last_saved_block is more than 1000 blocks behind - pub fn ingest_listings_contract_event(&mut self, log: Log) -> anyhow::Result<()> { + pub fn ingest_listings_contract_event( + &mut self, + our: &Address, + log: Log, + ) -> anyhow::Result<()> { let block_number: u64 = log .block_number .ok_or(anyhow::anyhow!("app store: got log with no block number"))? @@ -454,6 +472,33 @@ impl State { current_listing.metadata_hash = metadata_hash; current_listing.metadata = metadata; + + let package_id = PackageId::new(¤t_listing.name, ¤t_listing.publisher); + + // if we have this app installed, and we have auto_update set to true, + // we should try to download new version from the mirrored_from node + // and install it if successful. + if let Some(package_state) = self.downloaded_packages.get(&package_id) { + if package_state.auto_update { + if let Some(mirrored_from) = &package_state.mirrored_from { + crate::print_to_terminal( + 1, + &format!( + "app store: auto-updating package {package_id} from {mirrored_from}" + ), + ); + Request::to(our) + .body(serde_json::to_vec(&LocalRequest::Download { + package: package_id, + download_from: mirrored_from.clone(), + mirror: package_state.mirroring, + auto_update: package_state.auto_update, + desired_version_hash: None, + })?) + .send()?; + } + } + } } Transfer::SIGNATURE_HASH => { let from = alloy_primitives::Address::from_word(log.topics[1]); From 382b9174ac540081ece240b9d77ee2b611a2a105 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 12 Feb 2024 12:41:11 -0500 Subject: [PATCH 7/9] timer refactor --- Cargo.lock | 2 +- kinode/src/timer.rs | 77 +++++++++++++++++++++++++-------------------- lib/src/core.rs | 6 ++++ 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf..c7285c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/src/timer.rs b/kinode/src/timer.rs index 12c62eac..c6ccb003 100644 --- a/kinode/src/timer.rs +++ b/kinode/src/timer.rs @@ -1,7 +1,7 @@ use anyhow::Result; use lib::types::core::{ Address, KernelMessage, Message, MessageReceiver, MessageSender, PrintSender, Printout, - Response, TIMER_PROCESS_ID, + Response, TIMER_PROCESS_ID, TimerAction, }; use serde::{Deserialize, Serialize}; @@ -11,8 +11,8 @@ use serde::{Deserialize, Serialize}; /// requests made by other nodes. /// /// The interface of the timer module is as follows: -/// One kind of request is accepted: the IPC must be a little-endian byte-representation -/// of an unsigned 64-bit integer, in milliseconds. This request should always expect a Response. +/// One kind of request is accepted: TimerAction::SetTimer(u64), where the u64 is the time to wait +/// in milliseconds. This request should always expect a Response. /// If the request does not expect a Response, the timer will not be set. /// /// A proper Request will trigger the timer module to send a Response. The Response will be @@ -39,44 +39,53 @@ pub async fn timer_service( // we only handle Requests which contain a little-endian u64 as IPC, // except for a special "debug" message, which prints the current state let Message::Request(req) = km.message else { continue }; - if req.body == "debug".as_bytes() { + let Ok(timer_action) = serde_json::from_slice::(&req.body) else { let _ = print_tx.send(Printout { - verbosity: 0, - content: format!("timer service active timers ({}):", timer_map.timers.len()), + verbosity: 1, + content: "timer service received a request with an invalid body".to_string(), }).await; - for (k, v) in timer_map.timers.iter() { + continue + }; + match timer_action { + TimerAction::Debug => { let _ = print_tx.send(Printout { verbosity: 0, - content: format!("{}: {:?}", k, v), + content: format!("timer service active timers ({}):", timer_map.timers.len()), }).await; + for (k, v) in timer_map.timers.iter() { + let _ = print_tx.send(Printout { + verbosity: 0, + content: format!("{}: {:?}", k, v), + }).await; + } + continue + } + TimerAction::SetTimer(timer_millis) => { + // if the timer is set to pop in 0 millis, we immediately respond + // otherwise, store in our persisted map, and spawn a task that + // sleeps for the given time, then sends the response + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() as u64; + let pop_time = now + timer_millis; + if timer_millis == 0 { + send_response(&our, km.id, km.rsvp.unwrap_or(km.source), &kernel_message_sender).await; + continue + } + let _ = print_tx.send(Printout { + verbosity: 1, + content: format!("set timer to pop in {}ms", timer_millis), + }).await; + if !timer_map.contains(pop_time) { + timer_tasks.spawn(async move { + tokio::time::sleep(std::time::Duration::from_millis(timer_millis - 1)).await; + pop_time + }); + } + timer_map.insert(pop_time, km.id, km.rsvp.unwrap_or(km.source)); } - continue } - let Ok(bytes): Result<[u8; 8], _> = req.body.try_into() else { continue }; - let timer_millis = u64::from_le_bytes(bytes); - // if the timer is set to pop in 0 millis, we immediately respond - // otherwise, store in our persisted map, and spawn a task that - // sleeps for the given time, then sends the response - let now = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_millis() as u64; - let pop_time = now + timer_millis; - if timer_millis == 0 { - send_response(&our, km.id, km.rsvp.unwrap_or(km.source), &kernel_message_sender).await; - continue - } - let _ = print_tx.send(Printout { - verbosity: 1, - content: format!("set timer to pop in {}ms", timer_millis), - }).await; - if !timer_map.contains(pop_time) { - timer_tasks.spawn(async move { - tokio::time::sleep(std::time::Duration::from_millis(timer_millis - 1)).await; - pop_time - }); - } - timer_map.insert(pop_time, km.id, km.rsvp.unwrap_or(km.source)); } Some(Ok(time)) = timer_tasks.join_next() => { // when a timer pops, we send the response to the process(es) that set diff --git a/lib/src/core.rs b/lib/src/core.rs index f4bbdf2d..d8450446 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1486,3 +1486,9 @@ impl From> for SqliteError { } } } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TimerAction { + Debug, + SetTimer(u64), +} From 452676cd26881dfdd59f48be935243c001df2adf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:41:39 +0000 Subject: [PATCH 8/9] Format Rust code using rustfmt --- kinode/src/timer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/src/timer.rs b/kinode/src/timer.rs index c6ccb003..9b93a1c2 100644 --- a/kinode/src/timer.rs +++ b/kinode/src/timer.rs @@ -1,7 +1,7 @@ use anyhow::Result; use lib::types::core::{ Address, KernelMessage, Message, MessageReceiver, MessageSender, PrintSender, Printout, - Response, TIMER_PROCESS_ID, TimerAction, + Response, TimerAction, TIMER_PROCESS_ID, }; use serde::{Deserialize, Serialize}; From 1d7043600ebf6516db939b00f18d7b9a056c8a64 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 13 Feb 2024 14:46:51 -0300 Subject: [PATCH 9/9] kernel: adjust message queueing to only ingest responses/errors for which we have an outstanding request in context map --- Cargo.lock | 2 +- kinode/src/kernel/process.rs | 230 +++++++++++++++++++---------------- 2 files changed, 128 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf..c7285c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 4759e299..1edc104f 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -112,11 +112,7 @@ impl ProcessState { ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { let res = match self.message_queue.pop_front() { Some(message_from_queue) => message_from_queue, - None => self - .recv_in_process - .recv() - .await - .expect("fatal: process couldn't receive next message"), + None => self.ingest_message().await, }; self.kernel_message_to_process_receive(res) } @@ -138,11 +134,7 @@ impl ProcessState { } // next, wait for the awaited message to arrive loop { - let res = self - .recv_in_process - .recv() - .await - .expect("fatal: process couldn't receive next message"); + let res = self.ingest_message().await; let id = match &res { Ok(km) => km.id, Err(e) => e.id, @@ -155,6 +147,131 @@ impl ProcessState { } } + /// ingest next valid message from kernel. + /// cancel any timeout task associated with this message. + /// if the message is a response, only enqueue if we have an outstanding request for it. + async fn ingest_message(&mut self) -> Result { + loop { + let message = self + .recv_in_process + .recv() + .await + .expect("fatal: process couldn't receive next message"); + + match &message { + Ok(km) => match &km.message { + t::Message::Response(_) => { + if let Some((_context, timeout_handle)) = self.contexts.get_mut(&km.id) { + timeout_handle.abort(); + return message; + } + } + _ => { + return message; + } + }, + Err(e) => { + if let Some((_context, timeout_handle)) = self.contexts.get_mut(&e.id) { + timeout_handle.abort(); + return message; + } + } + } + } + } + + /// Convert a message from the main event loop into a result for the process to receive. + /// If the message is a response or error, get context if we have one. + fn kernel_message_to_process_receive( + &mut self, + incoming: Result, + ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { + let (mut km, context) = match incoming { + Ok(mut km) => match km.message { + t::Message::Request(_) => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) + } + t::Message::Response(_) => match self.contexts.remove(&km.id) { + Some((context, _timeout_handle)) => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = context.prompting_message; + (km, context.context) + } + None => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) + } + }, + }, + Err(e) => match self.contexts.remove(&e.id) { + None => return Err((t::en_wit_send_error(e.error), None)), + Some((context, _timeout_handle)) => { + self.prompting_message = context.prompting_message; + return Err((t::en_wit_send_error(e.error), context.context)); + } + }, + }; + + let pk = signature::UnparsedPublicKey::new( + &signature::ED25519, + self.keypair.as_ref().public_key(), + ); + + // prune any invalid capabilities before handing to process + // where invalid = supposedly issued by us, but not signed properly by us + match &mut km.message { + t::Message::Request(request) => { + request.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + t::Message::Response((response, _)) => { + response.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + }; + + Ok(( + km.source.en_wit(), + match km.message { + t::Message::Request(request) => wit::Message::Request(t::en_wit_request(request)), + // NOTE: we throw away whatever context came from the sender, that's not ours + t::Message::Response((response, _sent_context)) => { + wit::Message::Response((t::en_wit_response(response), context)) + } + }, + )) + } + /// takes Request generated by a process and sends it to the main event loop. /// will only fail if process does not have capability to send to target. /// if the request has a timeout (expects response), start a task to track @@ -362,99 +479,6 @@ impl ProcessState { .await .expect("fatal: kernel couldn't send response"); } - - /// Convert a message from the main event loop into a result for the process to receive. - /// If the message is a response or error, get context if we have one. - fn kernel_message_to_process_receive( - &mut self, - incoming: Result, - ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { - let (mut km, context) = match incoming { - Ok(mut km) => match km.message { - t::Message::Request(_) => { - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = Some(km.clone()); - (km, None) - } - t::Message::Response(_) => { - if let Some((context, timeout_handle)) = self.contexts.remove(&km.id) { - timeout_handle.abort(); - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = context.prompting_message; - (km, context.context) - } else { - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = Some(km.clone()); - (km, None) - } - } - }, - Err(e) => match self.contexts.remove(&e.id) { - None => return Err((t::en_wit_send_error(e.error), None)), - Some((context, timeout_handle)) => { - timeout_handle.abort(); - self.prompting_message = context.prompting_message; - return Err((t::en_wit_send_error(e.error), context.context)); - } - }, - }; - - let pk = signature::UnparsedPublicKey::new( - &signature::ED25519, - self.keypair.as_ref().public_key(), - ); - - // prune any invalid capabilities before handing to process - // where invalid = supposedly issued by us, but not signed properly by us - match &mut km.message { - t::Message::Request(request) => { - request.capabilities.retain(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => true, - Err(_) => false, - } - } else { - return true; - } - }); - } - t::Message::Response((response, _)) => { - response.capabilities.retain(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => true, - Err(_) => false, - } - } else { - return true; - } - }); - } - }; - - Ok(( - km.source.en_wit(), - match km.message { - t::Message::Request(request) => wit::Message::Request(t::en_wit_request(request)), - // NOTE: we throw away whatever context came from the sender, that's not ours - t::Message::Response((response, _sent_context)) => { - wit::Message::Response((t::en_wit_response(response), context)) - } - }, - )) - } } /// create a specific process, and generate a task that will run it.